i am trying to use Opencv to video capture from the raspi cam to do some operation on it, the problem is i am using v4l2 to capture the video and it is so slow (10 sec delay and 2 fps). what i have tried : 1- overclocking my raspberry to turbo mode 2- working with small Resolution video (256x256). 3- put some sleep and delays to execute code every 10 sec or so. nothing helped to overcome the delays and poor frame rates. i really need help in this one
1 Answer
If you are using OpenCV to show the video feed then you are probably following their suggested tutorial in doing so. In which case, usually there is some sort of waitkey()
command that gives the system time to show each individual frame. Try making this number something smaller, say: waitkey(1)
. Also, you should keep in mind that running analysis on live video is extremely heavy on the CPU. I would suggest recording video to a file and then processing it. Or quickly taking individual pictures and processing those. If none of these work for you then you can try following the examples shown in this article: https://thinkrpi.wordpress.com/2013/05/22/opencvpi-cam-step-4-link-with-opencv/
to possibly get better performance. Keep in mind though, i've heard of decreased quality using this method.