#include "highgui.h" #include "cv.h" /* * 读入一个彩色视频文件并以灰度格式输出这个视频文件 * "学习OpenCV", P32, 例2-10 * 2010-05-16 */ int main( int argc, char** argv ) { CvCapture* capture = 0; capture = cvCreateFileCapture( argv[1] ); if( !capture ) return -1; IplImage* bgr_frame = cvQueryFrame( capture );//Init the video read double fps = cvGetCaptureProperty( capture, CV_CAP_PROP_FPS );//获取fps CvSize size = cvSize( (int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH), (int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT) ); CvVideoWriter *writer = cvCreateVideoWriter( argv[2], CV_FOURCC('X','V','I','D'), fps, size ); IplImage* logpolar_frame = cvCreateImage( size, IPL_DEPTH_8U, 1 ); while( (bgr_frame = cvQueryFrame(capture)) != NULL ) { //