Book Image

Raspberry Pi Computer Vision Programming - Second Edition

By : Ashwin Pajankar
5 (1)
Book Image

Raspberry Pi Computer Vision Programming - Second Edition

5 (1)
By: Ashwin Pajankar

Overview of this book

Raspberry Pi is one of the popular single-board computers of our generation. All the major image processing and computer vision algorithms and operations can be implemented easily with OpenCV on Raspberry Pi. This updated second edition is packed with cutting-edge examples and new topics, and covers the latest versions of key technologies such as Python 3, Raspberry Pi, and OpenCV. This book will equip you with the skills required to successfully design and implement your own OpenCV, Raspberry Pi, and Python-based computer vision projects. At the start, you'll learn the basics of Python 3, and the fundamentals of single-board computers and NumPy. Next, you'll discover how to install OpenCV 4 for Python 3 on Raspberry Pi, before covering major techniques and algorithms in image processing, manipulation, and computer vision. By working through the steps in each chapter, you'll understand essential OpenCV features. Later sections will take you through creating graphical user interface (GUI) apps with GPIO and OpenCV. You'll also learn to use the new computer vision library, Mahotas, to perform various image processing operations. Finally, you'll explore the Jupyter Notebook and how to set up a Windows computer and Ubuntu for computer vision. By the end of this book, you'll be able to confidently build and deploy computer vision apps.
Table of Contents (15 chapters)

Raspberry Pi

Raspberry Pi is a series of low-cost and credit card-sized SBCs developed by the Raspberry Pi Foundation in the United Kingdom. The purpose of developing Raspberry Pi was to promote the teaching of basic computer skills and programming in schools, in which it has served very well. Raspberry Pi has expanded its footprint well beyond its intended purpose by gaining prominence in the embedded systems market and computer science research in academia and industrial applications.

The Raspberry Pi Foundation offers downloads for many popular OS distributions. We can use a variety of programming languages such as Python, C, C++, and Java with Raspberry Pi. You can find more information on the Raspberry Pi Foundation website (https://www.raspberrypi.org/).

Raspberry Pi models

The Raspberry Pi board comes in many models. Additionally, there are a lot of associated accessories with these models. You can find the current list of models under production on the products page of the Raspberry Pi Foundation (https://www.raspberrypi.org/products/). Unfortunately, the page does not have any information on the discontinued product boards of the Raspberry Pi family.

Additionally, Raspberry Pi is also available in a more flexible form that is intended for industrial and embedded applications. This is known as a compute module. The compute module also has many iterations. A compute module prototyping kit is also made available by the foundation. You can find out more about compute modules and the prototyping kit on the same Raspberry Pi products page we discussed earlier.

As we have discussed, there are many models of Raspberry Pi boards available. And while it is tempting to discuss the technical specifications in detail for all of those boards, it is difficult to achieve that in brief. In the first edition of the book, I discussed the specifications of all the available Raspberry Pi board models in detail, since the number of models was far lower and we could count them on our fingers. Since writing the second edition of this book, there are over a dozen Raspberry Pi models. Therefore, we will discuss the technical specifications of only a couple of board models of Raspberry Pi.

We will use the Raspberry Pi 4B 4 GB and Raspberry Pi Zero W with header models for our computer vision examples. However, these examples can also be run on the other board models of Raspberry Pi. This is because all the software that we use (the OS, the programming language, and the OpenCV library) is fully backward compatible.

Raspberry Pi model 4B

You can find the product specifications of the Raspberry Pi 4B at https://www.raspberrypi.org/products/raspberry-pi-4-model-b/specifications/.

The following table explains the product specifications in detail:

Figure 5: Product specification list of the Raspberry Pi model 4B

Figure 1.5 – Product specification list of the Raspberry Pi model 4B

The following diagram shows all of the important connectors and components on a Raspberry Pi board:

Figure 6: Raspberry Pi 4B top view

Figure 1.6 – Raspberry Pi 4B top view

The following photograph shows the top view of the Raspberry Pi model 4B:

Figure 7: The top view of Raspberry Pi 4B

Figure 1.7 – The top view of the Raspberry Pi 4B

Here is a photograph of the model at an angle:

Figure 8: Raspberry Pi 4B at an angle

Figure 1.8 – Raspberry Pi 4B at an angle

We are going to use the 4GB variant of this model.

Raspberry Pi Zero W

You can find the specifications of the Raspberry Pi Zero W at https://www.raspberrypi.org/products/raspberry-pi-zero-w/.

The following table explains the specifications of this model in more detail:

Figure 9: Product specification list of the Raspberry Pi Zero W

Figure 1.9 – Product specification list of the Raspberry Pi Zero W

Where can you buy these models?

You can discover where to buy Raspberry Pi boards and their accessories on the products page of the RPi website. Here's a screenshot:

Figure 10: Buying a Raspberry Pi

Figure 1.10 – Buying a Raspberry Pi

You can also find Raspberry Pi boards and their accessories on Amazon. If you live in a big city, then you can find a lot of hobby electronics stores that sell Raspberry Pi boards and related items.