Skip to Content
OpenCV 4 with Python Blueprints - Second Edition
book

OpenCV 4 with Python Blueprints - Second Edition

by Dr. Menua Gevorgyan, Michael Beyeler (USD), Arsen Mamikonyan, Michael Beyeler
March 2020
Intermediate to advanced
366 pages
9h 8m
English
Packt Publishing
Content preview from OpenCV 4 with Python Blueprints - Second Edition

Learning about grayscale features

The easiest feature to extract is probably the grayscale value of each pixel. Usually, grayscale values are not very indicative of the data they describe, but we will include them here for illustrative purposes (that is, to achieve baseline performance).

For each image in the input set, we are going to perform the following steps:

  1. Resize all images to have the same (usually smaller) size. We use scale_size=(32, 32) to make sure we don't make the images too small. At the same time, we want our data to be small enough to work on our personal computer. We can do this with the following code:
resized_images = (cv2.resize(x, scale_size) for x in data)
  1. Convert the image to grayscale (values are still in 0-255 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

OpenCV with Python Blueprints

OpenCV with Python Blueprints

Michael Beyeler, Michael Beyeler (USD)
OpenCV 3 Computer Vision with Python Cookbook

OpenCV 3 Computer Vision with Python Cookbook

Aleksei Spizhevoi, Aleksandr Rybnikov
Mastering OpenCV 4 with Python

Mastering OpenCV 4 with Python

Alberto Fernández Villán

Publisher Resources

ISBN: 9781789801811Supplemental Content