#include "highgui.h"
#include"cv.h"
int g_slider_position = 0;
CvCapture* g_capture = NULL;
void onTrackbarSlide(int pos)
{
cvSetCaptureProperty( g_capture , CV_CAP_PROP_POS_FRAMES , pos );
}
int main( int argc , char** argv )
{
cvNamedWindow( "video" , CV_WINDOW_AUTOSIZE );
g_capture = cvCreateFileCapture( "H:\\红外森林防火项目\\火焰视频\\火焰1.avi" );
int frames = (int) cvGetCaptureProperty( g_capture , CV_CAP_PROP_FRAME_COUNT );
if ( frames!= 0 )
{
cvCreateTrackbar( "Position" , "video" , &g_slider_position , frames , onTrackbarSlide );
}
IplImage* frame;
while( 1 )
{
frame = cvQueryFrame( g_capture );
if( !frame ) break;
cvShowImage( "video" , frame );
char c = cvWaitKey( 33 );
if( c == 27 ) break;
}
cvReleaseCapture( &g_capture );
cvDestroyWindow( "video" );
return 0;
}