Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

BackgroundSubtractorMOG2 is inherited from BackgroundSubtractor which is inherited from cv::Algorithm (read the documentation carefully). That means that you can use Algorithm::set and Algorithm::get methods for accessing parameters. Here is a sample on how you can work with cv::Algorithm.


  1. You can write bg(frame,foreground); instead of your second line.
  2. Do not make protected members public, try to avoid the modification of OpenCV header files, it is usually a bad practice.