Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to change BackgroundSubtractorMOG2 options

I'm learning OpenCV and loving it so far. Currently I'm looking into background subtractor and it's awesome that the library already offers algorithms for this. I was looking at BackgroundSubtractorMOG2 and I've managed to get a basic setup running:

cv::BackgroundSubtractorMOG2 bg;
//in update loop
bg.operator ()(frame,foreground);
bg.getBackgroundImage(background);

but I haven't worked out how change/use options with for this class. The documentation lists members to control the algorithm (such as nmixtures,backgroundRatio,etc.), but they appear to be protected (in OpenCV 2.4.1). Would I still be able to control the algorithm using OpenCV 2.4 ? If so, how ?

Thanks!