opencv混合高斯模型
来源:互联网 发布:超级理财软件官网 编辑:程序博客网 时间:2024/05/16 04:56
基于混合高斯模型,对运动背景下的背景进行建模学习,其中运动物体可以较好的判断
#include <stdio.h>#include <cv.h>#include <cxcore.h>#include <highgui.h>#include <cvaux.h>//必须引此头文件#include <iostream>#include <string>#include <opencv2/opencv.hpp>using namespace std;using namespace cv;int main(int argc, char** argv){ string videoFile = "test3.avi"; VideoCapture capture; capture.open(videoFile); if (!capture.isOpened()) { cout<<"read video failure"<<endl; return -1; } BackgroundSubtractorMOG2 mog; Mat foreground; Mat background; Mat frame; long frameNo = 0; while (capture.read(frame)) { ++frameNo; cout<<frameNo<<endl; // 运动前景检测,并更新背景 mog(frame, foreground, 0.001); // 腐蚀 erode(foreground, foreground, Mat());// 膨胀 dilate(foreground, foreground, Mat()); mog.getBackgroundImage(background); // 返回当前背景图像 imshow("高斯模型前景", foreground); imshow("高斯模型背景", background);//// //当前帧与背景图像差分//// Mat sub1=frame-background;//// Mat sub2=background-frame;//// Mat sub=sub1+sub2;////////// Mat sub=(sub3+foreground);//// IplImage subimage=sub;//// //cvCvtColor(&subimage,&subimage,CV_BGR2GRAY);//// //imshow("chafen",sub);//// //// cvSaveImage("subimage.jpg",&subimage);//// IplImage* subjpg = cvLoadImage("subimage.jpg");//// IplImage* psubImg = cvCreateImage(cvSize(subjpg->width, subjpg->height), IPL_DEPTH_8U,1);////CvMat* psubMat = cvCreateMat(subjpg->height, subjpg->width, CV_32FC1);////cvCvtColor(subjpg,psubImg,CV_BGR2GRAY);////cvConvert(psubImg, psubMat);//////二值化前景图////cvThreshold(psubMat, psubImg, 15, 255.0, CV_THRESH_BINARY);////cvErode(psubImg, psubImg, 0, 1);////cvDilate(psubImg, psubImg, 0, 1);////cvShowImage("背景差分法前景目标",psubImg); if (waitKey(25) > 0) { break; } } return 0;}
0 0
- opencv高斯混合模型
- opencv混合高斯模型
- 混合高斯模型 opencv
- OpenCv的混合高斯模型
- OpenCV混合高斯模型前景分离
- OpenCV混合高斯模型前景分离
- OPENCV混合高斯模型原理
- OpenCV 中的GMM模型 高斯混合模型
- OPENCV中混合高斯背景模型的实现
- OPENCV中混合高斯背景模型的实现
- Opencv学习笔记(十)高斯混合模型
- OPENCV中混合高斯背景模型的实现
- OpenCV中混合高斯模型的实现
- OpenCV混合高斯模型函数注释说明
- OpenCV混合高斯模型代码分析与完善
- 混合高斯背景模型及opencv实现
- OpenCv中混合高斯模型的实现
- 高斯混合模型在opencv中的源码详解
- [1298] Death Moon\'s Inspiration
- [1302] Happy Or Sad
- Readint and Writint
- HDU 1035 Robot Motion (搜索-DFS)
- NBUT 2012 Weekly - 16th Mar for 12x
- opencv混合高斯模型
- [笔试题] 指出程序片段的三个错误
- [C#] C#中的委托,你熟练了吗
- [笔试题] union的原理探究
- android面试题六
- [杂谈] 计算机中的小端模式和大端模式
- Google揭露“仙女座”虚拟网络,及分散和集中架构之辩
- [杂谈] C#中的集合初始化器&&匿名类
- [笔试题] 金山2013开发笔试 - 读程序,写结果