1 #include "stdafx.h" 2 #include "highgui.h" 3 int g_slider_position = 0; 4 CvCapture* g_capture = NULL; 5 void onTrackbarSlide(int pos) 6 { 7 cvSetCaptureProperty(g_capture, CV_CAP_PROP_POS_FRAMES,pos); 8 } 9 10 int main()11 {12 cvNamedWindow("Test Vedio Slide",CV_WINDOW_AUTOSIZE);13 g_capture = cvCreateFileCapture("test.avi");14 int frames = (int)cvGetCaptureProperty(g_capture,CV_CAP_PROP_FRAME_COUNT);15 int frameRate = (int)cvGetCaptureProperty(g_capture,CV_CAP_PROP_FPS);16 17 if(frames!=0)18 {19 cvCreateTrackbar("position","Test Vedio Slide", &g_slider_position, frames, onTrackbarSlide);20 }21 IplImage* frame;22 for(g_slider_position = 0;g_slider_position