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?
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);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With