check image's info (PIL, skimage, opencv)

Code:

from PIL import Image
import numpy as np
from skimage import io
import cv2

png_file = './Screenshot.png'

# PIL
print('==========PIL==========')
img = Image.open(png_file)
print(img)
arr = np.array(img)
print(arr)

# from skimage import io
print('\n')
print('==========skimage==========')
img = io.imread(png_file)
print(img)


#import cv2
print('\n')
print('==========cv2==========')
img = cv2.imread(png_file)
print(img)
print(img.shape)
print(img.size)
print(img.dtype)

#

if __name__ == '__main__':
   print('finishing to check the image\'s info')

  

posted on 2019-01-09 16:25  cdekelon  阅读(119)  评论(0)    收藏  举报

导航