Ask Your Question

Valdaine's profile - activity

2014-07-27 13:44:26 -0600 answered a question highgui.VideoCapture buffer introducing lag

Dear all, I experienced the same problem as InakiE. Thanks to Tytan, I tried the solution to read several images in the buffer. I tried an enhancement by measuring the time it takes to capture the image. I remarked that it takes around 4ms to capture from the buffer and then around 30ms when buffer empty. I wrote the following code (I use Qt library but can be easily adapted):

   int delai=0;
   QTime h;
        do
        {   h.start();//Start the chronometer
            cap>>AcquisitionFrame; //Declarations not included in this example
            delai=h.elapsed(); //Compute delay in ms since the start commande
            qDebug() << delai; //Display the delay for test 
                               // and measurement purposes in debug windows
         }
        while(delai<10);

With that config, the number of frame to loose is independant from the time it takes to process the image. We are "just in time".

If it can help others.