用OpenCV调整视频大小
// videoProcess.cpp : 定义控制台应用程序的入口点。
//
#include"stdafx.h"
#include <stdio.h>
#include <cv.h>
#include <highgui.h>
int main(int argc, char *argv[])
{
CvCapture* capture = cvCaptureFromAVI("D:\\video\\sunglass\\day\\x12.avi");
IplImage* frame = 0;
int isColor = 1;
int fps = 25; // or 25
CvVideoWriter *writer = cvCreateVideoWriter("D:\\video\\sunglass\\day\\xx12.avi",CV_FOURCC('X','V','I','D'),fps,cvSize(640,480),isColor);
cvNamedWindow( "vivi");
//读取和显示
while(1)
{
frame = cvQueryFrame(capture); //获取一帧图片
if(frame == NULL)
break;
CvSize dstSize = cvSize(frame->width * 2, frame->height * 2);
IplImage *dst = cvCreateImage(dstSize, frame->depth, frame->nChannels);
cvResize( frame, dst, CV_INTER_LINEAR );
cvShowImage( "vivi", dst ); //将其显示
char key = cvWaitKey(10);
cvWriteFrame(writer, dst);
frame = NULL;
cvReleaseImage(&dst);
}
cvReleaseVideoWriter(&writer);
cvDestroyWindow("vivi");
return 0;
}
--------------------------------------分割线 --------------------------------------
CentOS下OpenCV无法读取视频文件
--------------------------------------分割线 --------------------------------------