FREE E-BOOK The Ultimate Raspberry Pi eBook Bundle 4 books in 1

FREE E-BOOK The Ultimate Raspberry Pi eBook Bundle 4 books in 1



FREE E-BOOK The Ultimate Raspberry Pi eBook Bundle 4 books in 1
FREE E-BOOK The Ultimate Raspberry Pi eBook Bundle 4 books in 1

Table of Contents 



Chapter 1: Introduction to Computer Vision and Raspberry Pi 1

Computer vision 1
OpenCV 2
Single-board computers and the Raspberry Pi 4
Raspberry Pi 4
Operating systems 5
Raspbian 6
Setting up your Raspberry Pi B+ 7
Preparing your microSD card manually 9
Booting up your Raspberry Pi for the first time 11
Shutting down and rebooting your Pi safely 12
Preparing your Pi for computer vision 13
Testing OpenCV installation with Python 15
NumPy 16
Array creation 16
Basic operations on arrays 17
Linear algebra 17
Summary 18

Chapter 2: Working with Images, Webcams, and GUI 19

Running Python programs with Raspberry Pi 19
Working with images 22
Using matplotlib 24
Drawing geometric shapes 26
Working with trackbar and named window 28
Working with a webcam 30
Creating a timelapse sequence using fswebcam 32
Webcam video recording and playback 34
Working with a webcam using OpenCV 34
Saving a video and playback of a video using OpenCV 36
Working with the Pi camera module 37
Using raspistill and raspivid 37
Using picamera in Python with the Pi camera module 38
picamera and OpenCV 39
Summary 39

Chapter 3: Basic Image Processing 41

Retrieving image properties 41
Arithmetic operations on images 42
Blending and transitioning images 45
Splitting and merging image colour channels 47
Creating a negative of an image 48
Logical operations on images 50
Exercise 51
Summary 52

Chapter 4: Colorspaces, Transformations, and Thresholds 53

Colorspaces and conversions 53
Tracking in real time based on color 56
Image transformations 58
Scaling 58
Translation, rotation, and affine transformation 59
Perspective transformation 64
Thresholding image 66
Otsu's method 68
Exercise 69
Summary 70

Chapter 5: Let's Make Some Noise 71

Noise 71
Introducing noise to an image 72
Kernels 74
2D convolution filtering 74
Low-pass filtering 76
Exercise 79
Summary 79

Chapter 6: Edges, Circles, and Lines' Detection 81

High-pass filters 81
Canny Edge detector 85
Hough circle and line transforms 86
Exercise 90
Summary 90

Chapter 7: Image Restoration, Quantization, and Depth Map 91

Restoring images using inpainting 91
Image segmentation 93
Mean shift algorithm based segmentation 94
K-means clustering and image quantization 95
Comparison of mean shift and k-means 98
Disparity map and depth estimation 98
Summary 99
Chapter 8: Histograms, Contours, Morphological
Transformations, and Performance Measurement 101
Image histograms 101
Image contours 104
Morphological transformations on image 106
OpenCV performance measurement and improvement 107
Summary 108

Chapter 9: Real-life Computer Vision Applications 109

Barcode detection 109
Motion detection and tracking 117
Hand gesture recognition 121
Chroma key with green screen 126
Summary 132

Chapter 10: Introduction to SimpleCV 133

SimpleCV and its installation on Raspberry Pi 133
Getting started with the camera, display, and images 135
Binary thresholding and color distances 137
The blur effect on a live web camera feed 140
Histogram calculation 141
Greyscale conversion 142
Detecting corners and lines in an image 143
Blob detection in images 144
Sending Raspberry Pi on a boating vacation 145
Exercise 149
Summary 150
Index 151