Wednesday 15 August 2012

c - OpenCV - Video playback is slow if slider updates its position while playing -


I have picked 'OpenCV' and trying some code examples / exercises. In this code snippet, I want to get the slider to update my position with each video frame change, but for some reason this video is slowing the playback speed.

The slider is updating status during video playback using the cvSetTrackbarPos () function but this playback is slowing down #include & lt; Cv.h & gt; #include & lt; Hyogo H & gt; using namespace std; Int g_slider_position = 0; Cvcpaint * gicTouch = faucet; Zero traversers slide (int pauses) {cvSetCaptureProperty (GCCPT, CV_APPROOP_POS_FRAMES, pauses); } Int main (int argc, char * argv []) {if (argc & lt; 2) {printf ("use: main & lt; video file name"; \ n \ 7 "); Exit (0); } // Create a Window CV Named Window ("Playing Video with Slider", CV_Windoo_AutOSIE); GECAppecher = CVCT FTP Capture (AGR [1]); Int frame = (int) cvGetCaptureProperty (GCCapture, \ CV_CAP_PROP_FRAME_COUNT); If (frame! = 0) {cvCreateTrackbar ("slider", "Playing video with slider", \ & amp; g_slider_position, frame, onTrackbarSlide); } IplImage * frame = 0; While (1) {frame = cvQueryFrame (GCCPretcher); If (! Frame) {break; } CvShowImage ("Playing video with slider", frame); CvSetTrackbarPos ("Slider", "Playing video with slider", \ g_slider_position + 1); // playback char c = cvWaitKey (33); If (c = 27) {break; }} // image cvReleaseImage (& frame) release; CvReleaseCapture (& amp; g_capture); // Delete window cvDestroyWindow ("Playing video with slider"); Return 0; }

line char c = cvWaitKey (33); The problem is.

This is in time (1) and takes 33 milliseconds to wait for the key pressed each time. Reduce this number.

  Edit Now:   

Make changes as shown below

  on record bar slide (visor position) {pos = G_slider_position; CvSetCaptureProperty (g_capture, CV_CAP_PROP_POS_FRAMES, status); }    

No comments:

Post a Comment