Book Image

Raspberry Pi Essentials

By : Jack Creasey
Book Image

Raspberry Pi Essentials

By: Jack Creasey

Overview of this book

Table of Contents (15 chapters)
Raspberry Pi Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Project 1b – Creating a movement detector with a USB camera


For our security system to record video only when there is action, we need to detect movement. One application that does this very reliably is an application called motion.

There is a version of motion that will work with a PiCam camera, but if we use PiCam to acquire high-resolution images at high frame rates, the CPU resources required by motion will increase significantly. Instead, we will reduce the CPU usage as much as possible by detecting movement at very slow frame rates (2 fps is normally quite adequate) and use a USB webcam to do this. By separating the high-quality, high frame-rate video acquisition task from the movement detection task, we can achieve both reliable operation and low overall CPU usage.

First, let's install the motion application on the computer:

Using File Manager, browse to /home/pi/camera and then enter F4 (a shortcut to open a Terminal session with this folder as the working directory).

  1. At the command...