opencv笔记1:读写视频

#include <opencv/cv.h>
#include <opencv/highgui.h>

using namespace cv;  

void main()  
{  
	VideoCapture capture("E:/mov.avi");  
	VideoWriter writer("VideoTest.avi", CV_FOURCC('M', 'J', 'P', 'G'), 25.0, Size(640, 480));  
	Mat frame1;
	Mat frame;//(640,480,CV_8UC3);

	while (capture.isOpened())  
	{  
		capture >> frame1;  
		resize(frame1,frame,Size(640,480));
	//	resize(frame1,frame);
		writer << frame;  
		imshow("video", frame);  
		if (cvWaitKey(20) == 27)  
		{  
			break;  
		}  
	}  
}  

你可能感兴趣的:(opencv笔记1:读写视频)