OpenCV - getting the slider to update its position during video playback

后端 未结 6 1927
-上瘾入骨i
-上瘾入骨i 2020-12-28 21:12

I\'ve picked up \'Learning OpenCV\' and have been trying some of the code examples/exercises. In this code snippet, I want to get the slider to update its position with each

6条回答
  •  不思量自难忘°
    2020-12-28 21:46

    Hi I have simlar code and I did the following:

    void onTrackbarSlide(int pos)
    {
    if(pos > g_lastPosition+1 || pos < g_lastPosition)
    cvSetCaptureProperty(g_capture,CV_CAP_PROP_POS_FRAMES,pos);
    g_lastPosition = pos;
    }
    

    .............

    while(1)
    {
    frame = cvQueryFrame( g_capture );
    if( !frame ) break;
    cvShowImage( "Example3", frame );
    cvSetTrackbarPos("Position", "Example3", g_slider_position+1);
    char c = cvWaitKey(33);
    if( c == 27 ) break;
    }
    

    So you can grab the slide bar to any direction , I hope this can help

提交回复
热议问题