crop image in skimage?

前端 未结 4 1757
小蘑菇
小蘑菇 2021-02-09 04:30

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.         


        
4条回答
  •  别跟我提以往
    2021-02-09 04:57

    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)
    

提交回复
热议问题