Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Raspberry Pi Computer Vision Programming

You're reading from   Raspberry Pi Computer Vision Programming Design and implement computer vision applications with Raspberry Pi, OpenCV, and Python 3

Arrow left icon
Product type Paperback
Published in Jun 2020
Publisher Packt
ISBN-13 9781800207219
Length 306 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ashwin Pajankar Ashwin Pajankar
Author Profile Icon Ashwin Pajankar
Ashwin Pajankar
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Chapter 1: Introduction to Computer Vision and the Raspberry Pi 2. Chapter 2: Preparing the Raspberry Pi for Computer Vision FREE CHAPTER 3. Chapter 3: Introduction to Python Programming 4. Chapter 4: Getting Started with Computer Vision 5. Chapter 5: Basics of Image Processing 6. Chapter 6: Colorspaces, Transformations, and Thresholding 7. Chapter 7: Let's Make Some Noise 8. Chapter 8: High-Pass Filters and Feature Detection 9. Chapter 9: Image Restoration, Segmentation, and Depth Maps 10. Chapter 10: Histograms, Contours, and Morphological Transformations 11. Chapter 11: Real-Life Applications of Computer Vision 12. Chapter 12: Working with Mahotas and Jupyter 13. Chapter 13: Appendix 14. Other Books You May Enjoy

Basic operations on images

Let's perform a few basic operations, such as splitting and combining the channels of a color image and adding a border to an image. We will continue this demonstration in interactive mode. Let's import OpenCV and read a color image, as follows:

>>> import cv2
>>> img = cv2.imread('/home/pi/book/dataset/4.1.01.tiff', 1)

For any image, the origin—the (0, 0) pixel—is the pixel at the upper-left corner. We can retrieve the intensity values for all the channels by running the following statement:

>>> print(img[10, 10])
[34 38 44]

These are the intensity values of the blue, green, and red channels, respectively, for pixel (10, 10). If you only want to access an individual channel for a pixel, then run the following statement:

>>> print(img[10, 10, 0])
34

The preceding output, 34, is the intensity of the blue channel. Similarly, we can access the green and red channels with...

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime