Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BackgroundSubtractorMOG sensitivity

I'm using a background subtractor which I declared like this:

BackgroundSubtractorMOG subtractor;

Now I would like to use the subtractor with non-default paramters. I tried number of paramter value combinations in the following declaration:

BackgroundSubtractorMOG subtractor = BackgroundSubtractorMOG(100, 10, 0.9 20);

However, I cannot see any difference in the foreground mask produced by the subtractor, as if the parameters have no effect.

Am I not setting the parameters correctly? What is the correct way to set them?

like image 798
zoran119 Avatar asked Mar 06 '26 09:03

zoran119


2 Answers

I have the same problem, it seems the parameters offered by the constructor, doesn't affect the detector, I got a good background subtraction with default parameters but also a poor performance. I got better results on performance using a variation called: BackgroundSubtractorMOG2, You can use it in the same way You would use BackgroundSubtractorMOG. cv::BackgroundSubtractorMOG2 mog; //--Update Background mog(frame,foreground,0.01);

like image 179
Jorge Ivan Rivalcoba Rivas Avatar answered Mar 08 '26 22:03

Jorge Ivan Rivalcoba Rivas


when you are getting the foreground mask, are you setting a learningRate? In the java version of OpenCV that I'm using for an Android app, I produce the foreground mask as follows:

subtractor.apply(mRgb, mFGMask, 0.1);

This learning rate of 0.1 works very quickly. I'm thinking that it takes 10 frames to completely dim my output mask to a black screen.

like image 38
austin Avatar answered Mar 09 '26 00:03

austin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!