I\'m using skimage to crop a rectangle in a given image, now I have (x1,y1,x2,y2) as the rectangle coordinates, then I had loaded the image
image = skimage.io.
You can crop image using skimage just by slicing the image array like below:
image = image_name[y1:y2, x1:x2]
Example Code :
from skimage import io import matplotlib.pyplot as plt image = io.imread(image_path) cropped_image = image[y1:y2, x1:x2] plt.imshow(cropped_image)