Python中五种不同读取图片的方式

imgpath = '2968538221504814A.jpg'

1 matplotlib

import matplotlib.pyplot as plt # 导入matplotlib库

img = plt.imread(imgpath)

2 PIL(pillow)

from PIL import Image # 导入PIL库

img = Image.open(imgpath)

3 cv2

import cv2 # 导入OpenCV库

img = cv2.imread(imgpath)

4 skimage

from skimage import io #导入skimage库

img = io.imread(imgpath)

5 imageio

import imageio #导入imageio库

img = imageio.imread(imgpath)

你可能感兴趣的:(Python,Code)