Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi for Secret Agents - Third Edition

You're reading from  Raspberry Pi for Secret Agents - Third Edition

Product type Book
Published in Jul 2016
Publisher
ISBN-13 9781786463548
Pages 316 pages
Edition 3rd Edition
Languages

Table of Contents (7) Chapters

Preface 1. Getting up to No Good 2. Audio Antics 3. Webcam and Video Wizardry 4. Wi-Fi Pranks – Exploring Your Network 5. Taking Your Pi Off-Road 6. Detecting and Protecting Against Your Enemies

Chapter 3. Webcam and Video Wizardry

Aha, good! Still with us, our sly grasshopper is! For our second day of spy class, we'll switch our gear of perception from sound to sight.

You're going to learn how to get the most out of your USB webcam or official Raspberry Pi camera module, secure your perimeter, and then end it on a high note with some mindless mischief. Specifically, we will:

  • Take a look at the official Raspberry Pi Camera Module and how to connect it
  • Use the camera module to take video and still images
  • Connect webcams to the USB port, and capture video and still images
  • Build a video surveillance and capture system with built-in motion detection
  • Expand the video surveillance to support multiple cameras and remotely monitor it over the Internet
  • Build a wearable covert video recording device using the Pi Zero
  • Switch your TV on and off with scripts using the HDMI connection

Meet the USB Video Class drivers and Video4Linux

Just as the ALSA system provides kernel drivers and a programming framework for your audio gadgets, there are two important components involved in getting your cameras to work under Linux:

  • The Linux USB Video Class (UVC) drivers provide the low-level functions for your USB webcam, which are in accordance with a specification followed by most webcams produced today.
  • Video4Linux (V4L) is a video capture framework used by applications that record video from cameras, TV tuners, and other video producing devices. There's an updated version of V4L called V4L2, which we'll want to use whenever possible.

Raspberry Pi Camera Module

The Raspberry Pi Camera Module is an official Raspberry Pi accessory that works with all models of the Pi, and can be used to take high-definition still and video images. It connects directly to the Pi board's CSI (Camera Serial Interface) port, dedicated for these modules to enable high-speed operation.

The first release of the Raspberry Pi Zero didn't have a dedicated CSI port for the camera, but the latest v1.3 of the Pi Zero board now features this connector, opening all sorts of possibilities by connecting the official camera module. Note that the connector is actually smaller than the one on the standard-sized Pi boards, so you will need a different flat cable to connect to your camera. You can get these from your usual Pi-friendly online stores, such as pimoroni.com.

The latest version 2 of the camera itself is an 8-megapixel fixed-focus sensor supporting 1080p, 720p, and VGA video modes and still captures. The original version was 5 mega...

Make a covert wearable recorder with Pi Zero

In the same way that we used the Pi Zero in Chapter 2, Audio Antics, to create a covert audio record with a small battery pack and some low-profile USB adapters, we can do exactly the same with a small USB camera. In the following image, you can see that I have replaced the audio adapter and microphone with my USB webcam, again protected in a little bag:

Make a covert wearable recorder with Pi Zero
Our wearable Pi Zero with camera connected

Note

The Pi Zero with the battery pack shown should have enough current to power a small webcam as well as the Pi board. However, if you ever need to have the maximum power available from the USB port, you can add the following entry to the /boot/config.txt file: max_usb_current=1.

Again, our little low-profile micro-USB adapter helps us to keep our bag of tricks nice and compact.

Meet the USB Video Class drivers and Video4Linux


Just as the ALSA system provides kernel drivers and a programming framework for your audio gadgets, there are two important components involved in getting your cameras to work under Linux:

  • The Linux USB Video Class (UVC) drivers provide the low-level functions for your USB webcam, which are in accordance with a specification followed by most webcams produced today.

  • Video4Linux (V4L) is a video capture framework used by applications that record video from cameras, TV tuners, and other video producing devices. There's an updated version of V4L called V4L2, which we'll want to use whenever possible.

Raspberry Pi Camera Module


The Raspberry Pi Camera Module is an official Raspberry Pi accessory that works with all models of the Pi, and can be used to take high-definition still and video images. It connects directly to the Pi board's CSI (Camera Serial Interface) port, dedicated for these modules to enable high-speed operation.

The first release of the Raspberry Pi Zero didn't have a dedicated CSI port for the camera, but the latest v1.3 of the Pi Zero board now features this connector, opening all sorts of possibilities by connecting the official camera module. Note that the connector is actually smaller than the one on the standard-sized Pi boards, so you will need a different flat cable to connect to your camera. You can get these from your usual Pi-friendly online stores, such as pimoroni.com.

The latest version 2 of the camera itself is an 8-megapixel fixed-focus sensor supporting 1080p, 720p, and VGA video modes and still captures. The original version was 5 mega-pixels and even that...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Raspberry Pi for Secret Agents - Third Edition
Published in: Jul 2016 Publisher: ISBN-13: 9781786463548
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}