opencv——播放视频

#include "stdafx.h"

#include <opencv2\opencv.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std; CvCapture* capture=NULL;
int g_slider_position=;
void onTrackbarSlide(int pos)
{
cvSetCaptureProperty(capture,CV_CAP_PROP_POS_FRAMES,pos);
} int _tmain(int argc, _TCHAR* argv[])
{
cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
//CvCapture* capture = cvCaptureFromAVI( argv[1] ); // either one will work
capture= cvCreateFileCapture( "test.avi");
IplImage* frame;
int frames=cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_COUNT);
if(frames!=)
{
cvCreateTrackbar("Position","Example2",&g_slider_position,frames,onTrackbarSlide);
} while()
{
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "Example2", frame );
char c = cvWaitKey();
if( c == ) break;
}
cvReleaseCapture( &capture );
cvDestroyWindow( "Example2" );
}

opencv——播放视频

上一篇:使用Comparable接口自定义排序


下一篇:c++,opencv播放视频