10. Geometrical transformations of images
10.1. Cropping, resizing and rescaling images
Images being NumPy arrays (as described in the A crash course on NumPy for images section), cropping an image can be done with simple slicing operations. Below we crop a 100x100 square corresponding to the top-left corner of the astronaut image. Note that this operation is done for all color channels (the color dimension is the last, third dimension):
>>> import skimage as ski
>>> img = ski.data.astronaut()