Webcam working in Ubuntu

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
5 postsPage 1 of 1
5 postsPage 1 of 1

Webcam working in Ubuntu

Post by keukpa » Wed Feb 23, 2011 11:31 pm

Post by keukpa
Wed Feb 23, 2011 11:31 pm

Hi,

I hope someone can help here, I've got Ubuntu 9.04 running on my RoBoard and have got my USB webcam working with the uvcvideo driver, however, I get a REALLY slooooooow frame rate of just 0.3FPS

Surely this should run faster? I've got it in 640x480 resolution.

Any ideas how to speed this up?

Many thanks,

Keukpa
Hi,

I hope someone can help here, I've got Ubuntu 9.04 running on my RoBoard and have got my USB webcam working with the uvcvideo driver, however, I get a REALLY slooooooow frame rate of just 0.3FPS

Surely this should run faster? I've got it in 640x480 resolution.

Any ideas how to speed this up?

Many thanks,

Keukpa
keukpa offline
Robot Builder
Robot Builder
Posts: 15
Joined: Wed Feb 23, 2011 11:29 pm

Re: Webcam working in Ubuntu

Post by roboard » Fri Feb 25, 2011 5:54 am

Post by roboard
Fri Feb 25, 2011 5:54 am

Hi,

you may try to capture images in different resolutions or different color settings (e.g., RGB24, YUV, ...) to find an acceptable frame rate.

:)
Hi,

you may try to capture images in different resolutions or different color settings (e.g., RGB24, YUV, ...) to find an acceptable frame rate.

:)
roboard offline
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am

Post by veltrop » Sat Feb 26, 2011 12:04 pm

Post by veltrop
Sat Feb 26, 2011 12:04 pm

Maybe it's related to the shutter speed? Try turning off auto shutter or turning more lights on in the room.

I can capture 640x480 at 30fps on two USB cameras simultaneously using uvc, so something is wrong with your setup.
Maybe it's related to the shutter speed? Try turning off auto shutter or turning more lights on in the room.

I can capture 640x480 at 30fps on two USB cameras simultaneously using uvc, so something is wrong with your setup.
veltrop offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 59
Joined: Wed Jul 22, 2009 8:04 am
Location: Japan

Re: Webcam working in Ubuntu

Post by keukpa » Sun Feb 27, 2011 2:29 pm

Post by keukpa
Sun Feb 27, 2011 2:29 pm

veltrop wrote:Maybe it's related to the shutter speed? Try turning off auto shutter or turning more lights on in the room.

I can capture 640x480 at 30fps on two USB cameras simultaneously using uvc, so something is wrong with your setup.


Woah! 30fps!

Could you give me some more info on the type of setup and configuration you are using?

Do you get a similar FPS using Cheese also? Even with lots of lights on and a tourch pointing at the webcam ;) I still get a really bad FPS.

Any ideas what I could try??

Many thanks,

Keukpa
veltrop wrote:Maybe it's related to the shutter speed? Try turning off auto shutter or turning more lights on in the room.

I can capture 640x480 at 30fps on two USB cameras simultaneously using uvc, so something is wrong with your setup.


Woah! 30fps!

Could you give me some more info on the type of setup and configuration you are using?

Do you get a similar FPS using Cheese also? Even with lots of lights on and a tourch pointing at the webcam ;) I still get a really bad FPS.

Any ideas what I could try??

Many thanks,

Keukpa
keukpa offline
Robot Builder
Robot Builder
Posts: 15
Joined: Wed Feb 23, 2011 11:29 pm

Post by veltrop » Mon Feb 28, 2011 1:40 am

Post by veltrop
Mon Feb 28, 2011 1:40 am

I used v4l2 code in small C/C++ programs to achieve the high frame rate. Also, the Roboard was not running a GUI, the video capture was happening on a command line program. Note that I said I could capture at 30fps. Processing that is another matter all together. That is where roboard's advice is important. I do the capture in YUYV, and have to convert the data to RGB. The way that memory is copied during this conversion can greatly impact performance too, avoid copying the data extra times and use memcpy wherever possible.

Resources for programming the webcam:

    Use v4l2 directly. Theres sample code for this all over the web. Also, in the veltrobot_sensors package of my veltrop-ros-pkg ROS repository there is a bunch of code you could look at, but it has been customized for my needs.

    Gstreamer makes for easy use... but avoid gstreamer. It has poor performance. I believe it is what Cheese is based on btw.

    OpenCV wraps the v4l2 interface well and makes it very easy to use. It didn't suit my needs, but you should check it out.


Here's what you should do:

First, use the dmesg command and verify that your USB cam is connected with USB 2.0 (hispeed) and not 1.0 (fullspeed).

Next, write a small C program that will do the capture and measure the frames vs time it achieves. Leave any data conversion and data copying out for now. (Well, OpenCV will be doing that conversion automatically but that's ok)

Next, stop running the GUI on your Roboard. Doing any sort of performance measure thru the GUI on the Roboard is chasing your tail ;)
I recommend to hook the Roboard up to the network and use a remote computer to edit your files. Then use SSH and the command line to compile and launch programs. If you need a GUI sometimes, you could run a VNC server when needed. But bottom line is you should stop running XWindows on the Roboard, it consumes too many resources.
I used v4l2 code in small C/C++ programs to achieve the high frame rate. Also, the Roboard was not running a GUI, the video capture was happening on a command line program. Note that I said I could capture at 30fps. Processing that is another matter all together. That is where roboard's advice is important. I do the capture in YUYV, and have to convert the data to RGB. The way that memory is copied during this conversion can greatly impact performance too, avoid copying the data extra times and use memcpy wherever possible.

Resources for programming the webcam:

    Use v4l2 directly. Theres sample code for this all over the web. Also, in the veltrobot_sensors package of my veltrop-ros-pkg ROS repository there is a bunch of code you could look at, but it has been customized for my needs.

    Gstreamer makes for easy use... but avoid gstreamer. It has poor performance. I believe it is what Cheese is based on btw.

    OpenCV wraps the v4l2 interface well and makes it very easy to use. It didn't suit my needs, but you should check it out.


Here's what you should do:

First, use the dmesg command and verify that your USB cam is connected with USB 2.0 (hispeed) and not 1.0 (fullspeed).

Next, write a small C program that will do the capture and measure the frames vs time it achieves. Leave any data conversion and data copying out for now. (Well, OpenCV will be doing that conversion automatically but that's ok)

Next, stop running the GUI on your Roboard. Doing any sort of performance measure thru the GUI on the Roboard is chasing your tail ;)
I recommend to hook the Roboard up to the network and use a remote computer to edit your files. Then use SSH and the command line to compile and launch programs. If you need a GUI sometimes, you could run a VNC server when needed. But bottom line is you should stop running XWindows on the Roboard, it consumes too many resources.
veltrop offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 59
Joined: Wed Jul 22, 2009 8:04 am
Location: Japan


5 postsPage 1 of 1
5 postsPage 1 of 1
cron