In order to manipulate images, we will use a package called
mahotas. This is an open source package (MIT license, so it can be used in any project) that was developed by one of the authors of the book you are reading. Fortunately, it is based on NumPy
. The NumPy knowledge you have acquired so far can be used for image processing. There are other image packages such as scikit-image (Skimage), the ndimage (n-dimensional image) module in
SciPy, and the Python
bindings for OpenCV. All of these work natively with NumPy, so you can even mix and match functionalities from different packages to get your result.
We start by importing
mahotas with the
mh abbreviation, which we will use throughout this chapter:
import mahotas ...