Background Subraction Tutorial
Hi i'm implementing the opencv background subtraction MOG and MOG2 technique.The problem i'm facing is this that the moving objects are detected along with some black and white portion of the background.In general or in tutorial the background is black and only moving objects should be detected. What have i missed?? I mean should i set some threshold as well??
Mat frame; //current frame
Mat fgMaskMOG; //fg mask generated by MOG method
Ptr<BackgroundSubtractor> pMOG; //MOG Background subtractor
namedWindow("Frame");
namedWindow("FG Mask MOG");
pMOG = createBackgroundSubtractorMOG();
VideoCapture capture(videoFilename);
pMOG->apply(frame, fgMaskMOG); imshow("Frame", frame);
imshow("FG Mask MOG", fgMaskMOG);