July 2018
Beginner to intermediate
406 pages
9h 55m
English
The final example shows you how to mix NumPy operators with a tiny bit of filtering to get an interesting result. We start with a photo of a path in the forest:
im = mh.imread('forest')

To split the red, green, and blue channels, we use the following code. The NumPy transpose method changes the order of axes in a multi-dimensional array:
r,g,b = im.transpose(2,0,1)
Now, we filter the three channels separately and build a composite image out of it with mh.as_rgb. This function takes three two-dimensional arrays, performs contrast stretching to make each an 8-bit integer array, and then stacks them, returning a ...
Read now
Unlock full access