vs2008下的opencv安装过程,请猛击这里。
---------------------------------------------------------------
代码改编自《learning openCV 》(中文版),example 2-2,2-4。
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
using namespace cv;
void doubleVideo(string filename){
cvNamedWindow("video Demo",CV_WINDOW_AUTOSIZE);
cvNamedWindow("smooth video Demo",CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCaptureFromFile("test.avi");
IplImage* before = 0;
IplImage* after = 0;
while(1){
before = cvQueryFrame(capture);
if(before == NULL)
break;
after = cvCreateImage(cvGetSize(before),IPL_DEPTH_8U,3);
cvSmooth(before,after,CV_GAUSSIAN,3,3);
cvShowImage("video Demo",before);
cvShowImage("smooth video Demo",after);
char c = cvWaitKey(33);
if (c == 27)
break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("video Demo");
cvDestroyWindow("smooth video Demo");
}
int _tmain(int argc, _TCHAR* argv[])
{
doubleVideo("test.avi");
return 0;
}
#include "cv.h"
#include "highgui.h"
using namespace cv;
void doubleVideo(string filename){
cvNamedWindow("video Demo",CV_WINDOW_AUTOSIZE);
cvNamedWindow("smooth video Demo",CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCaptureFromFile("test.avi");
IplImage* before = 0;
IplImage* after = 0;
while(1){
before = cvQueryFrame(capture);
if(before == NULL)
break;
after = cvCreateImage(cvGetSize(before),IPL_DEPTH_8U,3);
cvSmooth(before,after,CV_GAUSSIAN,3,3);
cvShowImage("video Demo",before);
cvShowImage("smooth video Demo",after);
char c = cvWaitKey(33);
if (c == 27)
break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("video Demo");
cvDestroyWindow("smooth video Demo");
}
int _tmain(int argc, _TCHAR* argv[])
{
doubleVideo("test.avi");
return 0;
}
效果截图:
视频内容来自:德国Fraunhofer的手势UI,【视频地址】
------------------------------
End
请发表评论