diff options
Diffstat (limited to 'pix_opencv_bgstats.cc')
-rw-r--r-- | pix_opencv_bgstats.cc | 57 |
1 files changed, 9 insertions, 48 deletions
diff --git a/pix_opencv_bgstats.cc b/pix_opencv_bgstats.cc index 155ca8e..c1fe298 100644 --- a/pix_opencv_bgstats.cc +++ b/pix_opencv_bgstats.cc @@ -32,9 +32,9 @@ pix_opencv_bgstats :: pix_opencv_bgstats() comp_xsize=320; comp_ysize=240; - x_erode = 2; - x_minarea = 10*10; - x_alpha = 0.1; // 0.1 seconds + x_erode = 1; + x_minarea = CV_BGFG_FGD_MINAREA; + x_alpha = CV_BGFG_FGD_ALPHA_1; x_frames = 0; foreground = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); @@ -97,27 +97,13 @@ void pix_opencv_bgstats :: processRGBAImage(imageStruct &image) if ( x_model == NULL ) { - x_modelparams.Lc = CV_BGFG_FGD_LC; - x_modelparams.N1c = CV_BGFG_FGD_N1C; - x_modelparams.N2c = CV_BGFG_FGD_N2C; - x_modelparams.Lcc = CV_BGFG_FGD_LCC; - x_modelparams.N1cc = CV_BGFG_FGD_N1CC; - x_modelparams.N2cc = CV_BGFG_FGD_N2CC; - x_modelparams.is_obj_without_holes = 1; - x_modelparams.alpha2 = CV_BGFG_FGD_ALPHA_2; - x_modelparams.alpha3 = CV_BGFG_FGD_ALPHA_3; - x_modelparams.T = CV_BGFG_FGD_T; - x_modelparams.perform_morphing = x_erode; - x_modelparams.minArea = x_minarea; - x_modelparams.alpha1 = x_alpha; - x_modelparams.delta = CV_BGFG_FGD_DELTA; - x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); + x_model = cvCreateFGDStatModel( incoming ); } else if ( x_frames == 5 ) { // strange model stabilize after a few frames - cvReleaseBGStatModel( &x_model ); - x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); + //cvReleaseBGStatModel( &x_model ); + //x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); } else { @@ -162,27 +148,13 @@ void pix_opencv_bgstats :: processRGBImage(imageStruct &image) if ( x_model == NULL ) { - x_modelparams.Lc = CV_BGFG_FGD_LC; - x_modelparams.N1c = CV_BGFG_FGD_N1C; - x_modelparams.N2c = CV_BGFG_FGD_N2C; - x_modelparams.Lcc = CV_BGFG_FGD_LCC; - x_modelparams.N1cc = CV_BGFG_FGD_N1CC; - x_modelparams.N2cc = CV_BGFG_FGD_N2CC; - x_modelparams.is_obj_without_holes = 1; - x_modelparams.alpha2 = CV_BGFG_FGD_ALPHA_2; - x_modelparams.alpha3 = CV_BGFG_FGD_ALPHA_3; - x_modelparams.T = CV_BGFG_FGD_T; - x_modelparams.perform_morphing = x_erode; - x_modelparams.minArea = x_minarea; - x_modelparams.alpha1 = x_alpha; - x_modelparams.delta = CV_BGFG_FGD_DELTA; - x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); + x_model = cvCreateFGDStatModel( incoming ); } else if ( x_frames == 5 ) { // strange model stabilize after a few frames - cvReleaseBGStatModel( &x_model ); - x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); + //cvReleaseBGStatModel( &x_model ); + //x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); } else { @@ -215,9 +187,6 @@ void pix_opencv_bgstats :: floatMinAreaMess (float minarea) if ( ( (int)minarea>0 ) && ( x_model != NULL ) ) { x_minarea = minarea; - x_modelparams.minArea = minarea; - cvReleaseBGStatModel( &x_model ); - x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); } } @@ -226,9 +195,6 @@ void pix_opencv_bgstats :: floatErodeMess(float erode) if ( ( (int)erode>0 ) && ( x_model != NULL ) ) { x_erode = (int)erode; - x_modelparams.perform_morphing = (int)erode; - cvReleaseBGStatModel( &x_model ); - x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); } } @@ -237,9 +203,6 @@ void pix_opencv_bgstats :: floatAlphaMess(float alpha) if ( ( alpha>0.0 ) && ( x_model != NULL ) ) { x_alpha = alpha; - x_modelparams.alpha1 = alpha; - cvReleaseBGStatModel( &x_model ); - x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); } } @@ -247,8 +210,6 @@ void pix_opencv_bgstats :: resetMess () { if ( x_model != NULL ) { - cvReleaseBGStatModel( &x_model ); - x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); } } |