传统弱校HFUT的蒟蒻,真相只有一个

OpencV2.4.13前景提取示例代码

OpenCV2编译  基于高斯混合模型

#include<fstream>
#include<iostream>
#include<iostream> 
#include<highgui.h>
#include<opencv2/opencv.hpp>
#include<opencv2\core\core.hpp>
#include<opencv2/core/core.hpp> 
#include<opencv2\highgui\highgui.hpp>
#include<opencv2/highgui/highgui.hpp>  
#include<opencv2/imgproc/imgproc.hpp> 
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/objdetect/objdetect.hpp>
using namespace std;
using namespace cv;
int main()
{
    VideoCapture video(0);
    Mat frame, mask, thresholdImage, output;
    BackgroundSubtractorMOG2 bgSubtractor(20, 16, true);
    namedWindow("background");
    while (true){
        video >> frame;
        bgSubtractor(frame, mask, 0.001);
        imshow("background", mask);
        char c = (char)waitKey(20);
        if (c == 27)
            break;
    }
    return 0;
}

 

posted @ 2016-08-14 14:11  未名亚柳  阅读(1818)  评论(0编辑  收藏  举报