#include <cv.h>#includeintMainintargcChar**argv) {Cvcapture* Capture =NULL; Capture= Cvcreatefilecapture ("Red moving China Design Network video material 2185.avi"); if(!capture)return-1; //get the first frame of the video and coexist in Bgr_frameIplimage *bgr_frame =Cvqueryframe (Capture); //get the total number of frames in a video cv_cap_prop_fps frame rate Doublefps =Cvgetcaptureproperty (Capture, Cv_cap_prop_fps); //Get the height and width of the original videoCvsize size = Cvsize ((int) Cvgetcaptureproperty (Capture, Cv_cap_prop_frame_width), (int) Cvgetcaptureproperty (Capture, cv_cap_prop_frame_height)); ///Create a video file parameter representing the new video's name, respectively. Video compression encoding format new video frame rate new video image sizeCvvideowriter *writer = Cvcreatevideowriter ("1ai.avi", CV_FOURCC ('M','J','P','G'), FPS, size); //Create a first address and allocate storage spaceiplimage* logpolar_frame = cvcreateimage (size, ipl_depth_8u,3); //get the next frame of a video while((Bgr_frame = Cvqueryframe (capture))! =NULL) { //transferring video from Cartesian coordinate system to polar coordinate system parameter indicates input image output Image Transform Center scale parameter fill output image all parameters + Cv_inter_linear denotes bilinear parameter value (specifically what meaning)Cvlogpolar (Bgr_frame, Logpolar_frame, cvpoint2d32f (Bgr_frame->width/2, Bgr_frame->height/2), the, Cv_inter_linear +cv_warp_fill_outliers); //Save the retrieved frames from the Cartesian coordinate system to the new video fileCvwriteframe (writer, logpolar_frame); //The captured video is displayed through the Mainwin windowCvshowimage ("Mainwin", Logpolar_frame); Charc = Cvwaitkey ( -); //ESC exits by default if(c = = -) Break; } //free space requested in the programCvreleasevideowriter (&writer); Cvreleaseimage (&logpolar_frame); Cvreleasecapture (&capture); return(0);}
opencv-write avi video file