Beagleboard_OpenCV Cannot detect the Logitech webcam

Hello everyone,

I am using a Beagleboard-xM rev.B with Angstrom v2012.05 (Core edition).
When I pluged the webcam in, the board detected the camera:

root@dhcppc13:/# [ 5600.255554] usb 1-2.4: new high speed USB device number 5 using ehci-omap
[ 5600.647827] usb 1-2.4: New USB device found, idVendor=046d, idProduct=0826
[ 5600.655120] usb 1-2.4: New USB device strings: Mfr=0, Product=2, SerialNumber=1
[ 5600.662872] usb 1-2.4: Product: HD Webcam C525
[ 5600.667541] usb 1-2.4: SerialNumber: 82115D90
[ 5601.066345] uvcvideo: Found UVC 1.00 device HD Webcam C525 (046d:0826)
[ 5601.156890] input: HD Webcam C525 as /devices/platform/usbhs-omap.0/ehci-omap.0/usb1/1-2/1-2.4/1-2.4:1.2/input/input2
[ 5601.168731] usbcore: registered new interface driver uvcvideo
[ 5601.174896] USB Video Class driver (v1.1.0)

And when I check in /dev/, video1 was showed.

And this is my opencv program: (version 2.4.2)

#include “/home/cuongle/build_3/install/include/opencv/cv.h”
#include “/home/cuongle/build_3/install/include/opencv/highgui.h”
#include <stdio.h>
// A Simple Camera Capture Framework
int main() {
CvCapture* capture = cvCaptureFromCAM(-1);

if(!capture)
{
printf(“no camera\n”);
return -1;
}
}

The return value always No camera. I also changed the index in the cvCaptureFromCAM to 0 or 1 but still No camera.
Do I need install any driver to able to use with opencv.

Thank you so much.

You need to make sure OpenCV is built with V4L included, and possibly select V4L as the camera rather than taking the default.

Dear Rich, I tried to turn on V4L when compile opencv but I got this error:

/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/…/…/…/…/arm-angstrom-linux-gnueabi/bin/ld: skipping incompatible /usr/local/lib/libv4l1.so when searching for -lv4l1
/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/…/…/…/…/arm-angstrom-linux-gnueabi/bin/ld: cannot find -lv4l1
collect2: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.2] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

I followed this link to build:
http://processors.wiki.ti.com/index.php/Building_OpenCV_for_ARM_Cortex-A8
If I turn off V4L, the build-process is OK.
What should I do now?
Thank you so much.