Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <stdio.h>
- #include "opencv/cv.h"
- #include "opencv/highgui.h"
- #include "opencv/cvaux.h"
- #include "opencv/cxcore.h"
- int main()
- {
- CvCapture * capture = cvCaptureFromAVI("square.avi");
- IplImage * frame;
- if(!capture)
- {
- perror("");
- return 10;
- }
- char key = 'c';
- int fps = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
- cvNamedWindow("Video");
- while(key != 'q' && key != 'Q')
- {
- frame = cvQueryFrame(capture);
- if(!frame)
- {
- perror("");
- return 20;
- }
- cvShowImage("Video", frame);
- key = cvWaitKey(1000 / fps);
- }
- cvReleaseImage(&frame);
- cvReleaseCapture(&capture);
- cvDestroyAllWindows();
- return 0;
- }
Add Comment
Please, Sign In to add comment