Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Static Video Background Subtractor?

Hi all,

Is it possible to have a background subtractor that doesn't compare to the previous frame? Here is my current code

- (void)processImage:(Mat&)image;
{
  Mat fg;
  if (sampleBG){
    bg = createBackgroundSubtractorMOG2(0,10);
    sampleBG = false; sampleHand = true;
  }else if (sampleHand){
      //TODO
    sampleHand = false; samplesExist = true;
  }else if (cameraOn && samplesExist){
    bg->apply(image, fg);
    image = fg;
  }
}

Running this results in the background being subtracted, however once I move into the frame and stay in the same spot I fade away. Surely since I create bg on the first pass it should keep me as I am a difference from the original frame? Any advice?