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

后端 未结 6 1923
-上瘾入骨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:29

    OK I finally solved this problem of updating the slider and also if you want to move the slider the video will update there is no problem of picture freezing now

    #include "stdafx.h"
    
    #include
    #include
    #include
    
    int g_slider_position = 0;
    CvCapture* g_capture = NULL;
    int count=0;              //initiate a global counter
    
    
    
    void onTrackbarSlide( int pos )
    {// if you are moving the slider for more than two frames then this loop will initiate      to
     // to update the video
        if(pos>count+2 || pos

    ok now what i have done is that i have created a global counter which will be updated alongside with the frames

    now when we use the slider with the mouse to a different position then in onTrackbarSlider routine the if loop will be initiated and it will set the video to the new position

提交回复
热议问题