In this article we will see how we can crop the image in mahotas. Cropping is easily done simply by slicing the correct part out of the array, here array is the image object which is numpy.ndarray.
In this tutorial we will use “luispedro” image, below is the command to load it.
Below is the luispedro image
In order to do this we will take the image object which is numpy.ndarray and filter it with the help of indexing, below is the command to do this
image = image[i1:i2, j1:j2]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course