Book Image

Raspberry Pi for Secret Agents - Second Edition

By : Stefan Sjogelid
Book Image

Raspberry Pi for Secret Agents - Second Edition

By: Stefan Sjogelid

Overview of this book

Table of Contents (12 chapters)
Raspberry Pi for Secret Agents Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Detecting an intruder and setting off an alarm


Let's dive right into the wonderful world of motion detection!

The basic idea of motion detection is pretty simple from a computer's point of view—the motion detection software processes a continuous stream of images and analyzes the positions of the pixels that make up the image. If a group of contiguous pixels above a certain threshold starts to change from one frame to the next, that must be something moving. The tricky part of motion detection is weeding out false positives triggered by naturally occurring changes in light and weather conditions. The steps to configure motion detection are as follows:

  1. We'll be working with a motion detection application called Motion. Install it using the usual command:

    pi@raspberrypi ~ $ sudo apt-get install motion
    

    With Motion installed, the next step is to create a configuration file for our camera. The Motion installation puts a sample configuration file inside the /etc/motion directory. We will use this...