Book Image

Raspberry Pi Computer Vision Programming

By : Ashwin Pajankar
Book Image

Raspberry Pi Computer Vision Programming

By: Ashwin Pajankar

Overview of this book

<p>This book will provide you with the skills you need to successfully design and implement your own Raspberry Pi and Python-based computer vision projects.</p> <p>From the beginning, this book will cover how to set up your Raspberry Pi for computer vision applications, exploring the basics of OpenCV, and how to design and implement real-life computer vision applications on your own. By sequentially working through the steps in each chapter, you will quickly be able to master the features of OpenCV. In the end of the book, you will also be introduced to SimpleCV, which is another powerful computer vision library for Python. Featuring plenty of coding examples and exercises, this book offers you an unparalleled learning experience.</p>
Table of Contents (17 chapters)
Raspberry Pi Computer Vision Programming
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
5
Let's Make Some Noise
Index

Preface

Raspberry Pi was developed as a low-cost single-board computer with the intention of promoting computer science education in schools. It also represents a welcome return to a simple and fun yet effective way to learn computer science and programming.

You can use Raspberry Pi to learn and implement concepts in computer vision.

With a $35 Raspberry Pi computer and a USB webcam, anyone can afford to become a pro in computer vision in no time and build a real-life computer vision application to impress friends and colleagues.

What this book covers

Chapter 1, Introduction to Computer Vision and Raspberry Pi, takes you through the introduction and initial setup of Raspberry Pi and computer vision.

Chapter 2, Working with Images, Webcams, and GUI, teaches you how to work with images, videos, and various cameras.

Chapter 3, Basic Image Processing, explores arithmetic and logical operations on images.

Chapter 4, Colorspaces, Transformations, and Thresholds, introduces you to colorspaces and conversions, which are then followed by a simple project. This chapter also explores geometric transformations and segmentation by thresholding.

Chapter 5, Let's Make Some Noise, teaches the basics of noise in digital images and low-pass filters. It also discussed their usage in the removal of noise from images.

Chapter 6, Edges, Circles, and Lines' Detection, explores high-pass filters and their applications. It also explores the detection of features like edges, circles, and lines.

Chapter 7, Image Restoration, Quantization, and Depth Map, explores image restoration by inpainting. It also teaches image segmentation, quantization, and depth maps.

Chapter 8, Histograms, Contours, Morphological Transformations, and Performance Measurement, introduces the readers to histograms and plotting. It explores the concepts of contours and morphological transformations on an image. It concludes with the basics of performance measurement and improvement.

Chapter 9, Real-life Computer Vision Applications, implements various real-life applications of computer vision using Raspberry Pi and a webcam.

Chapter 10, Introduction to SimpleCV, teaches the installation and usage of SimpleCV, a powerful yet simple computer vision library, and concludes with a few real-life projects.

What you need for this book

The following hardware is recommended for maximum enjoyment:

  • The Raspberry Pi computer (Model B, B+, or Pi 2)

  • SD card (8 GB minimum)

  • 5V 1A power supply

  • HDMI or VGA monitor

  • HDMI to VGA converter if a VGA monitor is used

  • Wired Internet connection

  • A keyboard and a mouse

  • A good quality webcam

  • A Pi Camera

  • A Windows computer/laptop with an embedded or external card reader

Who this book is for

This book is intended for novices as well as seasoned Raspberry Pi and Python enthusiasts who would like to explore the area of computer vision. Readers with very little programming or coding/scripting experience can create wonderful image processing and computer vision applications with relatively few lines of code in Python.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: " We are going to learn about the linspace() function now."

A block of code is set as follows:

import picamera
import time

with picamera.PiCamera() as cam:
  cam.resolution=(1024,768)
  cam.start_preview()
  time.sleep(5)
  cam.capture('/home/pi/book/output/still.jpg')

Any command-line input or output is written as follows:

>>> a**2
array([ 1,  9, 36, 81])

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Go to Enable Boot to Desktop/Scratch | Desktop."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.