用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;
}
--------------------------------------分割線 --------------------------------------
Ubuntu Linux下安裝OpenCV2.4.1所需包 http://www.linuxidc.com/Linux/2012-08/68184.htm
Ubuntu 12.04 安裝 OpenCV2.4.2 http://www.linuxidc.com/Linux/2012-09/70158.htm
CentOS下OpenCV無法讀取視頻文件 http://www.linuxidc.com/Linux/2011-07/39295.htm
Ubuntu 12.04下安裝OpenCV 2.4.5總結 http://www.linuxidc.com/Linux/2013-06/86704.htm
Ubuntu 10.04中安裝OpenCv2.1九步曲 http://www.linuxidc.com/Linux/2010-09/28678.htm
基於QT和OpenCV的人臉識別系統 http://www.linuxidc.com/Linux/2011-11/47806.htm
--------------------------------------分割線 --------------------------------------
OpenCV的詳細介紹:請點這裡
OpenCV的下載地址:請點這裡