OpenCV 3.2 gives Select Timeout when grabbing, but fswebcam works

落花浮王杯 提交于 2019-12-02 11:42:53
Acherrum

For everyone who's dealing with this same issue (Select Timeout). I fixed it for my case, I don't know if this is going to work for everyone, but I'd love if this helped others out there.

The problem is probably because the camera you're trying to use is only semi-UVC compatible. UVC is familiar with products being sold as UVC compatible, when in fact they're not. So they added something called quirks. Read more about this here: UVC FAQ

So, how to fix the Select Timeout? Well, easy apparently. First, we close the uvcvideo module

rmmod uvcvideo

Next we enable it again, but with the bandwidth quirk enabled; and just in case add the nodrop and timeout flags as well.

modprobe uvcvideo quirks=128 nodrop=1 timeout=6000

If you want the solution to work after rebooting, add both those lines to your .bash_profile

I tested the BeagleBone Black with my USB2.0 camera after this fix thoroughly: Average framerate: 4 (highly dependent on light, get 5 FPS with a darker environment) Average error percentage: 2.4% (1953 succesful pictures out of 2000 read()'s)

Tested by grabbing 100 frames in a loop and doing this 20 times. I rebooted after 10, to make sure my .bash_profile edit worked as well and to see if there was any performance difference after a fresh reboot. There is none ;)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!