#include "cv.h"
#include "highgui.h"
int main( int argc, char** argv )
{
CvCapture* capture = 0;
capture = cvCreateFileCapture("E://1.avi");
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(
"E://2.avi",
CV_FOURCC('X','V','I','D'),
fps,
size
);
IplImage* logpolar_frame = cvCreateImage(
size,
IPL_DEPTH_8U,
1
);
while( (bgr_frame = cvQueryFrame(capture)) != NULL )
{
// cvLogPolar( bgr_frame,
// logpolar_frame,
// cvPoint2D32f(bgr_frame->width/2, bgr_frame->height/2),
// 40,
// CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS
// );
cvCvtColor( bgr_frame, logpolar_frame, CV_RGB2GRAY );//彩色转换为灰度图像
cvFlip( logpolar_frame, NULL, 0 );//翻转图像
cvWriteFrame( writer, logpolar_frame );
}
cvReleaseVideoWriter( &writer );
cvReleaseImage( &logpolar_frame );
cvReleaseCapture( &capture );
return(0);
}
评论0