Update the trunk to the OpenCV's CVS (2008-07-14)
[opencv] / cvaux / src / vs / bgfg_estimation.cpp
index a16fbec..65ae78b 100644 (file)
@@ -39,8 +39,8 @@
 //M*/
 #include "_cvaux.h"
 
-//Function cvCreateBGStatModel creates and returns initialized BG model
-// parameters:
+// Function cvCreateBGStatModel creates and returns initialized BG model.
+// Parameters:
 //      first_frame   - frame from video sequence
 //      model_type \96 type of BG model (CV_BG_MODEL_MOG, CV_BG_MODEL_FGD,\85)
 //      parameters  - (optional) if NULL the default parameters of the algorithm will be used
@@ -63,7 +63,7 @@ class CvFGDetectorBase:public CvFGDetector
 protected:
     CvBGStatModel*  m_pFG;
     int             m_FGType;
-    void*           m_pFGParam; /* foreground params */
+    void*           m_pFGParam; /* Foreground parameters. */
     CvFGDStatModelParams        m_ParamFGD;
     CvGaussBGStatModelParams    m_ParamMOG;
     char*                       m_SaveName;
@@ -132,21 +132,23 @@ public:
             AddParam("ObjWithoutHoles",&m_ParamFGD.is_obj_without_holes);
             AddParam("Morphology",&m_ParamFGD.perform_morphing);
         }
-        else if( m_FGType == CV_BG_MODEL_MOG )
+        else if( m_FGType == CV_BG_MODEL_MOG )                 // "MOG" == "Mixture Of Gaussians"
         {
             if(m_pFGParam)
             {
                 m_ParamMOG = *(CvGaussBGStatModelParams*)m_pFGParam;
             }
             else
-            {
-                m_ParamMOG.win_size = CV_BGFG_MOG_WINDOW_SIZE;
-                m_ParamMOG.bg_threshold = CV_BGFG_MOG_BACKGROUND_THRESHOLD;
+            {                              // These constants are all from cvaux/include/cvaux.h
+                m_ParamMOG.win_size      = CV_BGFG_MOG_WINDOW_SIZE;
+                m_ParamMOG.bg_threshold  = CV_BGFG_MOG_BACKGROUND_THRESHOLD;
+
                 m_ParamMOG.std_threshold = CV_BGFG_MOG_STD_THRESHOLD;
-                m_ParamMOG.weight_init = CV_BGFG_MOG_WEIGHT_INIT;
+                m_ParamMOG.weight_init   = CV_BGFG_MOG_WEIGHT_INIT;
+
                 m_ParamMOG.variance_init = CV_BGFG_MOG_SIGMA_INIT*CV_BGFG_MOG_SIGMA_INIT;
-                m_ParamMOG.minArea = CV_BGFG_MOG_MINAREA;
-                m_ParamMOG.n_gauss = CV_BGFG_MOG_NGAUSSIANS;
+                m_ParamMOG.minArea       = CV_BGFG_MOG_MINAREA;
+                m_ParamMOG.n_gauss       = CV_BGFG_MOG_NGAUSSIANS;
             }
             AddParam("NG",&m_ParamMOG.n_gauss);
         }
@@ -165,7 +167,8 @@ public:
     {
         return m_pFG?m_pFG->foreground:NULL;
     };
-    /* process current image */
+
+    /* Process current image: */
     virtual void    Process(IplImage* pImg)
     {
         if(m_pFG == NULL)
@@ -190,7 +193,8 @@ public:
             cvUpdateBGStatModel( pImg, m_pFG );
         }
     };
-    /* release foreground detector */
+
+    /* Release foreground detector: */
     virtual void    Release()
     {
         SaveState(0);