1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#include "cv.h"
#include "highgui.h"
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 );
CvSize size = cvSize( (int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH),
(int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT) );
// creates video: file to write -- codec that's gonna be used -- frame per second -- size of video frames -- grayscale or not
CvVideoWriter *writer = cvCreateVideoWriter( argv[2], CV_FOURCC('M','J','P','G'), fps, size, 0 );
IplImage* logpolar_frame = cvCreateImage( size, IPL_DEPTH_8U, 3 );
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 );
cvWriteFrame( writer, logpolar_frame );
}//
cvReleaseVideoWriter( &writer );
cvReleaseImage( &logpolar_frame );
cvReleaseCapture( &capture );
return(0);
}
|