Ask Your Question
0

Constant Time Random Access to Video Frames

asked 2014-09-29 21:32:02 -0600

kevin.gurney gravatar image

Is it possible to access a frame at a particular offset in a video using a constant time O(1) operation, similar to the constant time random access of an array by index? If so, how can this be achieved in OpenCV 2.4.9?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-09-29 23:16:40 -0600

Hi,

I remember when learning OpenCV I did an example with the old C API that would allow the video to jump to a frame using the track bar; it used

cvSetCaptureProperty(capture, CV_CAP_PROP_POS_FRAMES, frame_nmber)

you can see the documentation under VideoCapture::set with this link and with C++ should look something like this:

capture.set(CV_CAP_PROP_POS_FRAMES, frame_number);
edit flag offensive delete link more

Comments

Is this operation O(n)? i.e. do you have to walk through each of the frames from the beginning of the video in order to move to another frame with trackbar?

kevin.gurney gravatar imagekevin.gurney ( 2014-09-30 12:20:27 -0600 )edit

Using your notation it will be O.set(CV_CAP_PROP_POS_FRAMES, n), and you can call it at the start. From there you can either step through the video using n or as you would normally.

Messina Vision Systems gravatar imageMessina Vision Systems ( 2014-09-30 20:16:35 -0600 )edit

Thank you for clarifying.

kevin.gurney gravatar imagekevin.gurney ( 2014-10-01 12:33:59 -0600 )edit

Question Tools

Stats

Asked: 2014-09-29 21:32:02 -0600

Seen: 1,052 times

Last updated: Sep 29 '14