Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi Computer Vision Programming. - Second Edition

You're reading from  Raspberry Pi Computer Vision Programming. - Second Edition

Product type Book
Published in Jun 2020
Publisher Packt
ISBN-13 9781800207219
Pages 306 pages
Edition 2nd Edition
Languages
Author (1):
Ashwin Pajankar Ashwin Pajankar
Profile icon Ashwin Pajankar

Table of Contents (15) Chapters

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

Multiplying images by a constant and one another

Just like normal matrices or NumPy ndarrays, images can be multiplied by a constant and with one another. We can multiply an image by a constant, as follows:

import cv2
img1 = cv2.imread('/home/pi/book/dataset/4.2.03.tiff', 1)
img2 = cv2.imread('/home/pi/book/dataset/4.2.05.tiff', 1)
cv2.imshow('Image1', img1 * 2)
cv2.waitKey(0)
cv2.destroyAllWindows()

In the preceding code, every element of the ndarray representing the image is multiplied by 2. Run the preceding program and see the output. We can also multiply images with one another, as follows:

cv2.imshow('Image1', img1 * 2)

The result is likely to look like noise.

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 $15.99/month. Cancel anytime}