Skip to content

Instantly share code, notes, and snippets.

@luizventurote
Created February 3, 2018 19:23
Show Gist options
  • Save luizventurote/9b20aa1006a75cec5f1c7fe1635e3afe to your computer and use it in GitHub Desktop.
Save luizventurote/9b20aa1006a75cec5f1c7fe1635e3afe to your computer and use it in GitHub Desktop.
OpenCV load a video.
#include <iostream>
#include <stdio.h>
#include "opencv2/highgui/highgui.hpp"
int main( int argc, const char** argv ) {
cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCreateFileCapture( argv[1] );
IplImage* frame;
while(1) {
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage("Example2", frame);
char c = cvWaitKey(33);
if( c == 27 ) break;
}
cvReleaseCapture( &capture );
cvDestroyWindow("Example2");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment