# include & lt; Opencv2/core/core. Hpp>
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace cv;
using namespace std;
Int main ()
{
Mat frame;
Mat foreground;
VideoCapture capture (" bike. Avi ");
if (! The capture. IsOpened ())
{
return 0;
}
NamedWindow (" Extracted Foreground ");
NamedWindow (" Source Video ");
//mixed gaussian objects
BackgroundSubtractorMOG mog;
Bool stop (false);
while (! Stop)
{
if (! The capture. Read (frame))
{
break;
}
Mog (frame, foreground, 0.01);
Threshold (foreground, the foreground, 128, 255, THRESH_BINARY_INV);
Imshow (" Extracted Foreground, "Foreground);
Imshow (" Source Video, "frame);
If (waitKey (10)==27)
{
Stop=true;
}
}
}
I find BackgroundSubtractorMOG opencv2/video/background_segm HPP within
But still
1> MOGExtractForeground. CPP
1> MOGExtractForeground. CPP (58) : error C2065: "BackgroundSubtractorMOG" : no statement of identifiers
1> MOGExtractForeground. CPP (58) : error C2146: syntax errors: lack of ";" (in front of the identifier "service")
1> MOGExtractForeground. CPP (58) : error C2065: "he" : no statement of identifiers
1> MOGExtractForeground. CPP (67) : error C3861: "he" : can't find the identifier
==========: zero success, failure, latest 0, 0 skip==========
I am a pure novice, contact opencv study foreground extraction technology, hope god give me answers, this code from the blog up and down, with is processed pixels to extract the prospect of the gaussian mixture model,
CodePudding user response:
Fewer people good nightCodePudding user response:
Opencv3.0 use Ptr