NumPy is famous for its efficient arrays. This fame is partly due to the ease of indexing. We will demonstrate advanced indexing tricks using images. Before diving into indexing, we will install the necessary software—SciPy and PIL. If you feel it is required, review the Installing matplotlib recipe in Chapter 1, Winding Along with IPython.
In this chapter and in other chapters, we will use the following imports:
import numpy as np import matplotlib.pyplot as plt import scipy
We will also use the newest syntax for the print()
Python function as much as possible.
Note
Python 2 is a still popular major Python version, but it is not compatible with Python 3. Python 2 is officially supported until 2020. One of the main differences is the syntax for the print()
function. This book uses code that is as compatible with Python 2 and Python 3 as possible.
Some of the examples in this chapter involve manipulating images. In order to do that, we will require the Python Image Library (PIL),...