diff options
author | N.N. <sevyves@users.sourceforge.net> | 2009-09-08 20:28:23 +0000 |
---|---|---|
committer | N.N. <sevyves@users.sourceforge.net> | 2009-09-08 20:28:23 +0000 |
commit | 624fc8a5c74aa58025932eb242777f237c4bd0a9 (patch) | |
tree | 0f5c0365ffc5ca71cff4cb68eea92a916702529b | |
parent | e7b74888e5c42c73f73a82a87a59393b005accf6 (diff) |
fixed alpha parameter
svn path=/trunk/externals/pix_opencv/; revision=12258
-rw-r--r-- | pix_opencv_bgstats-help.pd | 50 | ||||
-rw-r--r-- | pix_opencv_bgstats.cc | 26 | ||||
-rwxr-xr-x | pix_opencv_bgstats.h | 6 |
3 files changed, 42 insertions, 40 deletions
diff --git a/pix_opencv_bgstats-help.pd b/pix_opencv_bgstats-help.pd index ba8a518..fa1d841 100644 --- a/pix_opencv_bgstats-help.pd +++ b/pix_opencv_bgstats-help.pd @@ -1,4 +1,4 @@ -#N canvas -60 46 1070 675 10; +#N canvas 6 49 1069 675 10; #X obj 407 -28 gemhead; #X obj 365 487 pix_texture; #X obj 365 515 square 2; @@ -59,15 +59,7 @@ #X obj 517 8 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X obj 364 259 translateXYZ 4 0 0; -#X text 24 67 Comments and support @ ydegoyon.gmail.com; -#X text 24 -2 Objects disappear from the foreground after a certain -amount of time after they disappeared ( delta ) and make noise filtering -using erosion and dilation steps ( erode paramater ). It also eliminates -from the foreground object that are less than minarea parameter.; -#X text 26 -47 pix_opencv_bgstats : foreground extraction using a statitical -method.; #X obj 363 452 pix_opencv_bgstats; -#X msg 406 300 delta \$1; #X obj 467 300 / 100; #X floatatom 508 302 5 0 0 0 - - -; #X floatatom 472 336 5 0 0 0 - - -; @@ -87,6 +79,16 @@ the foreground ( default : 0.1 seconds ); #X obj 584 20 loadbang; #X msg 678 45 colorspace RGB; #X msg 778 45 colorspace Grey; +#X text 26 69 Comments and support @ ydegoyon.gmail.com; +#X text 25 -20 Objects disappear from the background after a certain +amount of time of presence ( alpha ) \, they are then considered as +background.; +#X text 27 20 This object does noise filtering using erosion and dilation +steps ( erode paramater ). It also eliminates from the foreground object +that are less than a minumum size ( minarea parameter ).; +#X text 27 -47 pix_opencv_bgstats : background and foreground extraction +using a statitical method.; +#X msg 406 300 alpha \$1; #X connect 0 0 21 0; #X connect 1 0 2 0; #X connect 4 0 5 0; @@ -108,18 +110,18 @@ the foreground ( default : 0.1 seconds ); #X connect 21 2 17 0; #X connect 22 0 21 0; #X connect 23 0 22 0; -#X connect 24 0 28 0; -#X connect 28 0 1 0; -#X connect 29 0 28 0; -#X connect 30 0 29 0; -#X connect 31 0 30 0; -#X connect 31 0 30 1; -#X connect 32 0 33 0; -#X connect 33 0 28 0; -#X connect 34 0 35 0; -#X connect 35 0 28 0; -#X connect 37 0 28 0; -#X connect 44 0 21 0; -#X connect 45 0 44 0; -#X connect 46 0 21 0; -#X connect 47 0 21 0; +#X connect 24 0 25 0; +#X connect 25 0 1 0; +#X connect 26 0 48 0; +#X connect 27 0 26 0; +#X connect 27 0 26 1; +#X connect 28 0 29 0; +#X connect 29 0 25 0; +#X connect 30 0 31 0; +#X connect 31 0 25 0; +#X connect 33 0 25 0; +#X connect 40 0 21 0; +#X connect 41 0 40 0; +#X connect 42 0 21 0; +#X connect 43 0 21 0; +#X connect 48 0 25 0; diff --git a/pix_opencv_bgstats.cc b/pix_opencv_bgstats.cc index 639e44c..155ca8e 100644 --- a/pix_opencv_bgstats.cc +++ b/pix_opencv_bgstats.cc @@ -34,7 +34,7 @@ pix_opencv_bgstats :: pix_opencv_bgstats() x_erode = 2; x_minarea = 10*10; - x_delta = 0.1; // 0.1 seconds + x_alpha = 0.1; // 0.1 seconds x_frames = 0; foreground = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); @@ -104,13 +104,13 @@ void pix_opencv_bgstats :: processRGBAImage(imageStruct &image) x_modelparams.N1cc = CV_BGFG_FGD_N1CC; x_modelparams.N2cc = CV_BGFG_FGD_N2CC; x_modelparams.is_obj_without_holes = 1; - x_modelparams.alpha1 = CV_BGFG_FGD_ALPHA_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.delta = x_delta; + x_modelparams.alpha1 = x_alpha; + x_modelparams.delta = CV_BGFG_FGD_DELTA; x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); } else if ( x_frames == 5 ) @@ -169,13 +169,13 @@ void pix_opencv_bgstats :: processRGBImage(imageStruct &image) x_modelparams.N1cc = CV_BGFG_FGD_N1CC; x_modelparams.N2cc = CV_BGFG_FGD_N2CC; x_modelparams.is_obj_without_holes = 1; - x_modelparams.alpha1 = CV_BGFG_FGD_ALPHA_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.delta = x_delta; + x_modelparams.alpha1 = x_alpha; + x_modelparams.delta = CV_BGFG_FGD_DELTA; x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); } else if ( x_frames == 5 ) @@ -232,12 +232,12 @@ void pix_opencv_bgstats :: floatErodeMess(float erode) } } -void pix_opencv_bgstats :: floatDeltaMess(float delta) +void pix_opencv_bgstats :: floatAlphaMess(float alpha) { - if ( ( delta>0.0 ) && ( x_model != NULL ) ) + if ( ( alpha>0.0 ) && ( x_model != NULL ) ) { - x_delta = delta; - x_modelparams.delta = delta; + x_alpha = alpha; + x_modelparams.alpha1 = alpha; cvReleaseBGStatModel( &x_model ); x_model = cvCreateFGDStatModel( incoming, &x_modelparams ); } @@ -262,8 +262,8 @@ void pix_opencv_bgstats :: obj_setupCallback(t_class *classPtr) gensym("minarea"), A_FLOAT, A_NULL); class_addmethod(classPtr, (t_method)&pix_opencv_bgstats::floatErodeMessCallback, gensym("erode"), A_FLOAT, A_NULL); - class_addmethod(classPtr, (t_method)&pix_opencv_bgstats::floatDeltaMessCallback, - gensym("delta"), A_FLOAT, A_NULL); + class_addmethod(classPtr, (t_method)&pix_opencv_bgstats::floatAlphaMessCallback, + gensym("alpha"), A_FLOAT, A_NULL); class_addmethod(classPtr, (t_method)&pix_opencv_bgstats::resetMessCallback, gensym("reset"), A_NULL); @@ -279,9 +279,9 @@ void pix_opencv_bgstats :: floatErodeMessCallback(void *data, t_floatarg erode) GetMyClass(data)->floatErodeMess((float)erode); } -void pix_opencv_bgstats :: floatDeltaMessCallback(void *data, t_floatarg delta) +void pix_opencv_bgstats :: floatAlphaMessCallback(void *data, t_floatarg alpha) { - GetMyClass(data)->floatDeltaMess((float)delta); + GetMyClass(data)->floatAlphaMess((float)alpha); } void pix_opencv_bgstats :: resetMessCallback(void *data) diff --git a/pix_opencv_bgstats.h b/pix_opencv_bgstats.h index 09bbf80..01935d1 100755 --- a/pix_opencv_bgstats.h +++ b/pix_opencv_bgstats.h @@ -63,13 +63,13 @@ class GEM_EXTERN pix_opencv_bgstats : public GemPixObj // Set the new edge threshold void floatMinAreaMess(float minarea); void floatErodeMess(float erode); - void floatDeltaMess(float delta); + void floatAlphaMess(float alpha); void resetMess(void); // The new threshold int x_erode; float x_minarea; - float x_delta; + float x_alpha; int x_frames; // to detect changes in the image size @@ -82,7 +82,7 @@ class GEM_EXTERN pix_opencv_bgstats : public GemPixObj // Static member functions static void floatMinAreaMessCallback(void *data, float minarea); static void floatErodeMessCallback(void *data, float erode); - static void floatDeltaMessCallback(void *data, float delta); + static void floatAlphaMessCallback(void *data, float alpha); static void resetMessCallback(void *data); ///////// |