by veltrop » Mon Feb 28, 2011 1:40 am
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.