I am trying to access a USB Webcam from Android ndk.
The Android system has the V4L Kernel modules, so I thought it would be best to use the V4L libraries. They are bundeled in the ndk so it was not a big deal to include them into my project.
My problem is the following:
I need to open /dev/video4 and send the ioctl to that file descriptor, but I do not have the rights to access /dev/video4. I thought about three things:
1) Why do I lack permissions on /dev/video4? My app uses the android.permission.CAMERA permission, so the user that runs the app should be in the camera group, and the camera group has r+w permissions on /dev/video4, so why can't I open it?
2) I tried to get the file descriptor from java side, that is possible with the UsbManager class, but that file descriptor points do /dev/bus/usb/001/004. Is there a way to request permission for /dev/video4 from Java side? Or can I include a userspace V4L library and pass the pointer to the generic USB device in /dev/bus/usb/001/004?
3) Does the android version of OpenCV come with V4L support? Can I use it to preview the camera without having to access /dev/video4?
Has anybody tried something like this before?
Also, I know there are libraries out there that use libusb and libuvc to interface the camera (such as https://github.com/saki4510t/UVCCamera), but this library is very unsatble and does not provide satisfying results.