Tudhalyas
Posts: 2
Joined: Mon Feb 25, 2013 12:59 pm

Webcam + LibAV

Mon Feb 25, 2013 1:22 pm

Hello everyone!

I'm working on a robotics project which aims to use the Raspberry for computing visual SLAM calculations, and now I'm trying to get my webcam (a Logitech C270) to work -- and before you ask, yes, it is plugged into a powered USB hub. ;)
I've also stumbled in the issues described in this thread, so I'm looking for alternate ways to receive a stream from the camera.

After loading the uvcvideo module with the "nodrop=1" option, avplay gives me a solid 432x240@15 FPS output with this command:

Code: Select all

avplay -f video4linux2 -video_size=432x240 /dev/video0
Also, trying fswebcam, I get good quality images, even at higher resolutions:

Code: Select all

fswebcam -r 800x600 testfs.jpg
So, since OpenCV's camera does not work properly, I tried to write a C++ class which uses the libav* libraries to get a frame from the camera stream, and convert it to a jpeg image. This class works perfectly if tested on my development machine (a laptop with Xubuntu 12.10 64 bit) using the same camera, but it returns garbled green frames if used on the RasPi, stuff like this:

Image Image

What do you think is wrong?

Cloudcentric
Posts: 982
Joined: Fri Sep 14, 2012 9:13 am

Re: Webcam + LibAV

Mon Feb 25, 2013 5:09 pm

I have no answer for your post as not yet a programmer, still learning Linux, but there is some software already available for Linux which may be of interest and I would presume all is open source !

http://www.tanzilli.com/video_streaming

http://www.ideasonboard.org/uvc/
I know everything about nothing"

Tudhalyas
Posts: 2
Joined: Mon Feb 25, 2013 12:59 pm

Re: Webcam + LibAV

Mon Feb 25, 2013 6:47 pm

Thank you for your reply Cloud, but I knew UVC already. It's actually the drivers I am using to access to the camera. The other piece of software is an HTTP streamer for the camera, but what I want to do is just getting a stream of pictures, convert them in OpenCV format, and then operate on them... so unfortunately it's of no use to me. :(

Return to “Automation, sensing and robotics”