Ask Your Question

InakiE's profile - activity

2016-11-22 01:36:51 -0600 received badge  Famous Question (source)
2015-10-19 02:59:00 -0600 received badge  Notable Question (source)
2015-05-04 03:06:06 -0600 received badge  Popular Question (source)
2014-06-24 02:47:50 -0600 received badge  Supporter (source)
2014-06-24 02:47:48 -0600 received badge  Scholar (source)
2014-04-10 02:27:38 -0600 received badge  Student (source)
2014-03-14 03:23:17 -0600 asked a question highgui.VideoCapture buffer introducing lag

Dear all,

I am working with a Beaglebone Black, creating a project for future usage in a differente machine with lower capabilities. Problem is I have a timer working on kernel which pulls a triger every X seconds (user can change this value). When the program starts I open the webcam with VideoCapture, and at every tick of the timer I get a frame either with "camera >> cameraFrame" or with "camera.read(cameraFrame, 0)".

The problem is that the VideoCapture buffer is introducing a lag, so at every new frame I get it is not the very last frame but one of the lasts, so I see a lag of about 10 seconds (variable)

I have read that one possible solution is creating a new thread that handles the camera frames and get them in a cv::Mat, so when the main thread needs the last frame it just asks for it. The problem with this solution is that we need to elude this kind of proccesses so when the timmer acts I get a frame and the everything stops.

So, is there any possibility of modifying the VideoCapture buffer, or even clear it before acquiring the new frame?

Thanks for your help in advanced!