Building Machine Learning Systems with Python - Third Edition
by Luis Pedro Coelho, Willi Richert, Matthieu Brucher
Thresholding
We start this chapter with some simple image processing manipulations. These will not use machine learning, but the goal is to demonstrate that images can be manipulated as arrays. This will later be useful when we introduce new features.
Thresholding is a very simple operation: we transform all pixel values above a certain threshold to 1 and all those below it to 0 (or by using Booleans, transform them to True and False). The important question in thresholding is to select a good value to use as the threshold limit. Mahotas implements a few methods for choosing a threshold value from the image. We will use a method called Otsu after its inventor. The first necessary step is to convert the image to grayscale, with rgb2gray in ...
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.
Read now
Unlock full access