The video processing is for the foreground extraction, the mixed Gaussian algorithm is called in the CV space domain name but in opencv2.4.7 the direct call error occurs:
Backgroundsubtractormog This member is not indicated in CV;
I looked it up on the Internet. The analysis says: 2.4.7 cannot detect an example in the home page when it is used. In the only I added the header file, found just add:
#include <cvaux.h> can call Backgroundsubtractormog this member;
Attached code:
1#include <cv.h>2#include 3#include <cvaux.h>4 5 intMain ()6 {7 //open a video file8Cv::videocapture Capture ("D:\\1\\1.mp4");9 //Check if the video is open successfullyTen if(!capture.isopened ()) One return 0; A //Current Video Frame - Cv::mat frame; - //Foreground Image the Cv::mat foreground; -Cv::namedwindow ("extracted F"); - //mixture of Gaussian object with default parameters - Cv::backgroundsubtractormog Mog; + BOOLStopfalse); - //iterate through each frame + while(!stop) { A //Read Next Frame at if(!Capture.read (frame)) - Break; - //update the background and return to the foreground -Mog (Frame,foreground,0.01); - //Reverse the image -Cv::threshold (foreground, foreground, -,255, CV::THRESH_BINARY_INV); in //Show Foreground -Cv::imshow ("extracted F", foreground); to //introduce delay; month can end video by pressing ESC + if(Cv::waitkey (Ten) >=0) -Stop =true; the } *}
Summary: Or the commonly used header files are written, so as not to appear this unnecessary error!!
- #include <cv.h>
- #include <cxcore.h>
- #include
- #include <cvaux.h>
- #include <iostream>
- #include <string>
Backgroundsubtractormog problem of mixed Gaussian algorithm for OpenCV 2.4.7