My question is related to the solution provided in this answer.
When I update the slider position, the video always starts from frame zero, whereas, slider continues from the moved position on-wards. How can I correct this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Make sure you understand all the parameters used to create a trackbar. One of them is named
count, and it defines the maximal position of the slider (the minimum is 0).All you need to do is retrieve the total number of frames in the video file (before you start to read the frames of the video) and pass this value as the
countparam, so the maximum position of the slider is the total frames of the video.Hints:
cvGetCaptureProperty()andCV_CAP_PROP_FRAME_COUNT.And then to update the slider, simply retrieve the number of the current frame (take a look at
CV_CAP_PROP_POS_FRAMES) and make sure that your callback of typeCvTrackbarCallbacksets this information on the trackbar to update it’s position correctly.