总结:常用的Python图像处理库(PIL/Pillow、Matplotlib、OpenCV和scikit-image)在打开图像时默认使用先宽度和高度,然后是通道数的维度顺序。即 `(height, width, channels)`
python
from PIL import Image
import matplotlib.pyplot as plt
import cv2
from skimage import io
import numpy as np
image_path = r"chase/train/image/Image_01L.tif"
# PIL(Pillow)库
image = np.array(Image.open(image_path).convert("RGB")) # (height, width, channels)
print(image.shape)
image1 = Image.open(image_path)
image1 = np.asarray(image1) # (height, width, channels)
print(image1.shape)
# Matplotlib库
image2 = plt.imread(image_path) # (height, width, channels)
print(image2.shape)
# OpenCV库
image3 = cv2.imread(image_path) # (height, width, channels)
print(image3.shape)
# scikit-image库(skimage)
image4 = io.imread(image_path) # (height, width, channels)
print(image4.shape)