Chapter 16

Take Photos with a Webcam

Wouldn’t it be cool to turn your Pi into a camera? It’s not hard, and you can use a cheap webcam as your camera.

image

Understand Webcams

Why can’t you make a streaming video cam? Streaming webcams look simple, but they aren’t. The technology and the code used to make them work are complicated. The basic problems are

  • The technology is flaky. Some webcams can do it. Others can’t. You can’t be sure whether your webcam works until you try it.
  • It’s complicated. You have to do a lot of installing and setting up, and a lot can go wrong.
  • It’s nonstandard. There are different solutions for the official Pi camera add-on and for other webcams.

Understand Photo Cams

Instead of making a streaming video cam, you can make a photo camera in this chapter and put it on a web page in Chapter 17.

A photo camera isn’t as clever as streaming video to the web, but it solves all three problems:

  • The technology is more reliable. It works with almost all webcams. The only webcams that don’t work are very old, very cheap, or both.
  • It’s simple. It uses Python and PHP, so you don’t need to install any new or special software.
  • It’s standard. You have to type an extra one-line command to get the official add-on Pi camera to work with it. Otherwise, all cameras work with the same code.

Choose a Webcam

Many people have a spare webcam. Perhaps it’s used for Skype ...

Get Raspberry Pi For Kids For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.