获取图像属性

1.形状:行、列、通道数
shape
2.像素数目
size
3.图像的数据类型
dtype


import cv2
a=cv2.imread('image\lena.bmp',cv2.IMREAD_UNCHANGED)  #RGB image
b=cv2.imread('image\lena.bmp',cv2.IMREAD_GRAYSCALE)  #gray image
print(a.shape)           #形状
print(b.shape)
print(a.size)            #像素数目
print(b.size)
print(a.dtype)           #数据类型
print(b.dtype)

猜你喜欢

转载自blog.csdn.net/sundanping_123/article/details/86160209