Ask Your Question

UVC Camera and OpenCV 2.4.3 for Android 4.2

asked 2013-01-08 23:15:56 -0500

adnanhk gravatar image


I am relatively new to Android programming and to OpenCV. This is also my first post/question on this forum.

I am currently working on a project that requires I use an external camera and OpenCV on an android device (Nexus 7). Is there any way to do this? OpenCV 2.4.3 seems to handle the camera component on its own in the background, so I am not sure how to pass the external camera frames to it.

I have managed to get the external camera (UVC compatible) working on the Nexus 7.

Any help will be appreciated.



edit retag flag offensive close merge delete


Hey adnanhk , It would be great help if you can suggest me how you were able to make external UVC external camera working with Android phone. I have been trying hard to make it working , I did enable v4l driver in kernel and verify it loads v4l driver in logs and also added /dev/video0 0666 root system in resource configuration but all the time when i run application i get /dev/video0 device or resource busy. I followed same link you described below can please help and provide your code snippet ?.

I used same source but did not work for me


himanshu jain gravatar imagehimanshu jain ( 2013-02-05 11:40:34 -0500 )edit

Hi Himanshu. I am really sorry for the late response. I just read your comment did not get a notification when you sent it. Did you manage to get the UVC camera working? Please let me know and I will be more then happy to help you out anyway I can. Sorry again for the late response. Thanks.

adnanhk gravatar imageadnanhk ( 2013-04-20 22:34:44 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-01-09 01:02:19 -0500

  1. OpenCV uses Android Camera software stack, NOT V4L directly. So, if you can work with external camera using standard applications, so you can do it with OpenCV to. The only thing you need is set device index.

  2. If your camera is available through V4L only the only solution for camera support is enabling V4L back-end for VideoCapture on Android. In this case OpenCV code modification is needed.

edit flag offensive delete link more



Hi Alexander, Thank you for the response and information.

1) What you say makes sense and I am pretty sure that the camera I have is working off the V4L and not via the camera stack. So I cannot use the camera via device index for OpenCV. The sample application/source code I am using can be found here ( if anybody wants or is interested.

2) I think that OpenCV code modification will be required in my case. Any pointers on how I am supposed to start doing this?

Thanks again for your help. It is appreciated.



adnanhk gravatar imageadnanhk ( 2013-01-09 21:51:08 -0500 )edit
  1. I review the source code of the application by your link. The author builds kernel modules for V4L2 support and uses V4L2 API directly without Android Camera stack.

  2. If you want to use V4L back-end on Android you need to modify OpenCV. Start from file opencv/modules/highgui/src/cap.cpp. It is implementation for VideoCapture. There several back-ends with appropriate names that are used here. cap_libv4l.cpp is what you need.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-01-10 02:50:15 -0500 )edit

Hi, Alexander, can you give some detail how to do this? Just enable the V4L flag?

hukuba gravatar imagehukuba ( 2013-10-28 08:15:14 -0500 )edit

Question Tools


Asked: 2013-01-08 23:15:56 -0500

Seen: 8,674 times

Last updated: Jan 09 '13