3

I have a question. What does cvQueryFrame exactly do ? As I understand it picks a frame from an 'already captured frame' in the buffer, right?

In my application, the processing of each frame takes 1 second but my camera's fps is 30fps. How can I take the next snap after 1 second is over/ when the processing of the current frame's related process is over ? I don't want old frames !

Right now, as I see for the second loop run (when I call cvQueryFrame again, it retrieves the frame that was captured almost 1 second back, from the buffer.

How can I do everything REAL TIME ?? Any help is really appreciated !!

Sammy
  • 257
  • 2
  • 8
  • From the documentation: "This function is just a combination of GrabFrame and RetrieveFrame , but in one call". Have you tried using GrabFrame and RetrieveFrame separately? Check also this: http://stackoverflow.com/questions/7248058/does-cvqueryframe-have-buffer-for-frames-in-advance – Sassa Aug 23 '12 at 23:14

1 Answers1

0

It will basically give you frames in sequence, so no matter how long it takes to process, it will not drop frames. Keep in mind that the API is also used to read from videos, in which case it makes sense.

You can call cvQueryFrame continuously and do your processing on a separate thread. Alternative, you could use a system API (e.g. DirectShow) or your camera's API to do the reading, this will generally make it easier to drop frames.

Patrick Simpson
  • 554
  • 4
  • 12