
#include<opencv2/core/core.hpp>#include<opencv2/imgproc/imgproc.hpp>#include<opencv2/highgui/highgui.hpp>#include<opencv2/video/video.hpp>#include<iostream>usingnamespace...#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/video/video.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()

{
Mat frame;
Mat foreground;// 前景图片
VideoCapture capture("bike.avi");
if (!capture.isOpened())
{
return 0;
}

namedWindow("Extracted Foreground");
namedWindow("Source Video");
// 混合高斯物体
BackgroundSubtractorMOG mog;
bool stop(false);
while (!stop)
{
if (!capture.read(frame))

{
break;
}
// 更新背景图片以及输出前景
mog(frame, foreground, 0.01);
// 输出的前景图片并不是2值图片,要处理一下显示
threshold(foreground, foreground, 128, 255, THRESH_BINARY_INV);
// show foreground

imshow("Extracted Foreground", foreground);
imshow("Source Video", frame);
if (waitKey(10) == 27)
{
stop = true;
}
}
}
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/bofangqi/article-140830-1.html
小米公司知道国家质检总局抢不到小米手机后马上赶过来送上几部意思意思
没有击沉
说白了就是要个面子