用cv模块无法识别深度图
import cv2
img_path='32.jpg'
img=cv2.imread(img_path)
print('img_shape',img.shape)
但是用matplotlib模块可以
import matplotlib.image as mpimg
img_path='32.jpg'
img=mpimg.imread(img_path)
print('img_shape',img.shape)
实现深度位判别后,利用Image模块可实现32位至24位的转换
import matplotlib.image as mpimg
from PIL import Image
img_path='32.jpg'
img=mpimg.imread(img_path)
print('img_shape',img.shape)
if img.shape[2]>3:
img = Image.open(img_path)
save_img = img.convert('RGB')
save_img.save('32to24.jpg')