from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import cv2
img = ‘./control23.tif’
img = Image.open(img)
img = np.array(img)
print(img.shape)
img=np.stack((img,)*3,axis=-1)
print(img.shape)
plt.imshow(img)
灰度图像img.shape、(height, width)转为(height, width, channels)
最新推荐文章于 2025-03-08 02:14:08 发布