Monday, March 18, 2013

Using a webcam with the Raspberry Pi

There is a lot of recent motivation to do image processing and computer vision tasks on the Raspberry Pi.
Luckily OpenCv is already built on Raspbian and Wheezy.

To install it, all you have to do is use apt-get like below:
sudo apt-get install libcv-dev libopencv-dev libcv2.3 opencv-doc

You may also want to install python opencv
sudo apt-get install python-opencv

To see all available opencv packages, type:
sudo apt-cache search opencv

You can test your opencv installation and webcam by downloading and running the script below:

You may have to make this program executable by running:
chmod +x test

The source code and makefile can be found here:

If everything works, you should get a result like the one below (Apologies for the terrible quality, its a really old webcam):

I used scrot to take the screenshot
sudo apt-get install scrot

Thanks to Ethan Miklancic for hiding behind my laptop in the picture. I recommend using C or C++ rather than python because it makes a HUGE difference in speed.

Good Luck! 

Consider donating to further my tinkering.

Places you can find me

No comments:

Post a Comment