一、输入方式不同
import cv2 as cv
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
im = np.array(plt.imread('./cat.jpg'))
im1 = cv.imread('./cat.jpg')
im2 = Image.open('./cat.jpg')
二、读取的格式不同
- plt.imread
numpy只读格式(不能对图像中的像素进行修改),读取为RGB
想要对图像中像素进行修改,加上im = np.array(im) - cv.imread
numpy可写模式(可以对图像中的像素进行修改),读取为BGR - mage.open
PLI格式,无法读写,需转换为numpy再进行处理,读取为RGB
转换为numpy格式 im2 = np.array(im2)