beaglebone, webcams and opencv

Hi everybody,

After 5 days of pulling my hair out, I need to appeal to this group. I am trying to get a beaglebone up and running with a webcam and opencv. Looks like lots of people are. I had this running on a BeagleBoard but cannot get it to work on the bone. I’ve read many theories including: there is no port for uvcvideo for beaglebone and there is an issue with USB DMA. Anecdotally, I’ve read of people getting it to work. But, no matter what I try, no joy.

The good stuff:

  • the usb cameras (I’ve tried many) appear in dmesg and lsusb
  • I see /dev/video0
  • My OpenCV code compiles without complaints
  • the mplayer test works

The bad stuff:
Open CV “facedetect” sample gives me “Capture from Cam 0 didn’t work” no matter what I do

So here’s my request: can someone suggest a sure-fire way to be up and running with beaglebone, webcam and opencv? I’m willing to change linux distributions, webcams, etc. DSP would be nice and disabling USB DMA isn’t desirable.

Help would be much, much appreciated.

Thank you

Have you tried a recent image from http://www.angstrom-distribution.org/demo/beaglebone/ ?

Hi Koen,

I haven’t tried the April 10th version yet. I narrowed down my problem to a missing or bad uvcvideo module but didn’t see a reference to anything in the change log. Has the uvcvideo module been ported to the bone yet?

Thanks

Koen,

     I have tried the latest image as you suggest, but UVC video YUYV streaming still only works if I disable DMA with CONFIG_MUSB_PIO_ONLY=y :frowning:

Dave.

Koen,

   I have tried the latest image as you suggest, but UVC video YUYV streaming still only works if I disable DMA with CONFIG_MUSB_PIO_ONLY=y :frowning:

That is sort of good news, since the image after that turns DMA off :slight_smile:

Give http://dominion.thruhere.net/koen/angstrom/beaglebone/Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.04-core-beaglebone-2012.04.13.img.xz a try (400MB, starts up a GUI if you have a dvi/vga/lcd cape attached).

regards,

Koen

Sean,
     I believe that UVC video is built directly into the kernel, not as a module. From .config:

CONFIG_USB_VIDEO_CLASS=y

Consequently there will be no uvcvideo module.

Unfortunately this still does not appear to work unless DMA is disabled :frowning:

Regards,

Dave.

Thank you for the background both of you. The problem I was experiencing was that uvcvideo would not show in lsmod even though /dev/video0 would appear and dmesg showed a new device. If the latest image includes a disabled DMA and a disabled DMA will allow uvcvideo to load correctly, that sounds encouraging. Did I understand things correctly?

Sean,
The reason that uvcvideo does not show up with lsmod is that the uvcvideo code is compiled into the kernel, rather than a separate module. My opinion is that DMA is highly desirable with streaming video, as the processor has enough to do elsewhere Unfortunately, as enabling DMA kills video streaming completely, then disabling it is the lesser of two evils. I am puzzled as to why other USB devices, such as memory dongles, appear to work fine with DMA enabled! HTH, Dave. On 04/13/2012 09:00 AM, proc_rock wrote:

Mass storage uses 'bulk' transfers and webcams 'iso' transfers. The 'iso' is the one that breaks all the time.

regards,

Koen

Koen,
     At last there appears to be a logical reason for my observations! I presume this issue is being worked on by someone at TI?

Regards,

Dave.

Someone has been working on fixing MUSB ISO for the past 5 years or so....

Hello,

I’ve tried: http://dominion.thruhere.net/koen/angstrom/beaglebone/Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.04-core-beaglebone-2012.04.13.img.xz and it installs ok, However, I’m getting a failure to capture image from webcam in OpenCV, using the function cvCaptureFromCAM(). This is a few layers removed from the raw webcam capture - can you suggest a command line test (I’m in a console setting) of the webcam so I can tell whether it is OpenCV or the raw capture that is giving me grief? e.g. something that will write to an jpeg or avi file?

Thank you

Check this blog post out:

http://www.twam.info/linux/v4l2grab-grabbing-jpegs-from-v4l2-devices

As it’s title says, it’s about getting image data from the V4L2 interface in Linux. It contains (a link to) code that when compiled will open the camera and create one jpeg of the first frame it sees.

You can modify the code to read image data from the webcam and pass it on to an OpenCV array. That’s what I did in a previous version of the distro, and that worked mostly fine apart from the DMA bug. I’ve yet to try that on the new release as I’ve just returned from a holiday, but I expect it should work fine.

(Incidentally, on that previous distro, I didn’t get cvCaptureFromCAM working either. But since I had code to access image data anyway, it wasn’t a problem).

With regard,
Mihai Pomarlan

Thanks Mihai,

I just downloaded and compiled it and it compiled without warnings. I got some really interesting results across 4 different cameras. Two gave me “select timeout” (logitech and microsoft, uvcvideo), one gave me “segmentation fault” (gspca) and another (Genius, uvcvideo) gave me an image (bad quality, but I think that might be because the gain maybe didn’t have enough time to adjust.

I wonder why all the differences. OpenCV still gives me errors when I use the webcam that works. I might need to go back to the beagleboard where things seem to work ok. I’m anxious to get this up and running on the beaglebone but maybe I need to give it some time.

I used a Venus USB 2.0 webcam (which apart from the occasional “select timeout”, which I hope is due to DMA, worked absolutely fine) and a Trust Spotlight (same “select timeout” issue, but also, a few images- 6 out of 100- were “shifted”, with what should have been upper left ending up down right, for example).

With regard,
Mihai Pomarlan

Update.

Tried the version linked to in this thread (http://dominion.thruhere.net/koen/angstrom/beaglebone/Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.04-core-beaglebone-2012.04.13.img.xz) with my two webcams (Trust Spotlight, Venus USB2.0). None works now, immediately I get the “select timeout” error.

The version of Angstrom I used and and which partially worked was the 14Feb2012 one, so I know the cameras are all right, and that the program I use to get images from them should be ok also. What’s different, and USB camera-related, between the 14Feb2012 release and the new one?

With regard, Mihai Pomarlan

If I recall correctly this is right about when some changes went into the video stuff. I don’t recall now exactly which changes, but shortly before this I had and OpenCV/kernel/Angstrom image that worked together and then went through a few weeks of everything broken.

I would either go back to an older version or update to a newer one (I think I started getting working images around the second week of March).

-Keith