Camera Stream Capture Delay

Hello,

I have some sort of algorithm of lane detection that doesn’t utilize GPU and not based on neural networks. I am capturing the frame of the camera using cv function video capture.

The execution time of the algo is 130 ms and my camera is 30 fps so I am expecting i am dropping 5 frames because of the 130 ms delay however, that isn’t what happening. I am operating on 7-8 frames per second so its like the algorithm is processing on each frame of the camera continuously not the up-to date frame.

So i am trapped in a loop that has a delay, however, what I want to do is to process the algorithm each time on the last newest up-to date camera frame and neglect the previous frames that was in the delay period so i can process the algorithm faster.

@ShaneCCC appreciate if you can help

You got 7-8 frames is reasonable due to your post processing take 130ms.
Because 1/0.13 = 7.6
I would suggest to skip one or two frames in your post processing to maintain the frame rate.

Do you have a suggestion how we can skip one or two frames in opencv? or it would be like make a counter per each frame received and skip ?

Yes, you can have your post process to do the things every 3 or 4 frames.

You may find an example in this post.

.