Ask Your Question

OpenCV4Android, Read UVC USB Camera

asked 2015-06-25 04:38:05 -0500

benT gravatar image

Hi, I would like to access a UVC Camera attached to the USB Host of my Samsung Galaxy S5 via OpenCV. Is there any way to achieve that? I can only find camera-indexes for the front and back camera, but not for USB cameras. Since there are Apps on the PlayStore that manage to do this, I guess OpenCV should be able to as well. Thanks for any tipps!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-10-18 11:03:42 -0500

benT gravatar image

After almost two years of trying, I gave up to do this in a neat way. Most android-phones have the v4l2-kernel modules loaded, so I just used that one. Big disadvantage: On most phones, the devices nodes in dev (like /dev/videoX on the galaxy S5) are not readable by apps, so you have to root your phone and access them with root privileges (or change the rights on those files before accessing them).

This is the example I used to base my code on.

There is also an other library out there that tries to do what the v4l2-kernel extension does by using libusb and libuvc (you request the rights to the USB device via androids mechanisms, then pass the native pointer to libusb to read from it), but it is really buggy and I rarely got the cameras running for more than a few seconds, so I decided against it. Maybe it is stable now, so maybe if you want to do this as well you want to try it out.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-06-25 04:38:05 -0500

Seen: 2,198 times

Last updated: Oct 18 '16