Reading images in python

前端 未结 9 1986
北海茫月
北海茫月 2021-02-03 19:59

I am trying to read a png image in python. The imread function in scipy is being deprecated and they recommend using imageio

9条回答
  •  攒了一身酷
    2021-02-03 20:18

    I read all answers but I think one of the best method is using openCV library.

    import cv2
    
    img = cv2.imread('your_image.png',0)
    

    and for displaying the image, use the following code :

    from matplotlib import pyplot as plt
    plt.imshow(img, cmap = 'gray', interpolation = 'bicubic')
    plt.xticks([]), plt.yticks([])  # to hide tick values on X and Y axis
    plt.show()
    

提交回复
热议问题