(3)图像处理-图像属性shape,size,dtype

1、shape

图像形状,行数,列数,通道数

2、size

图像大小,行数 × \times ×列数 × \times ×通道数

3、dtype

图像数据类型,通常为uint8

4、例子说明

if __name__=='__main__':
    src = "./Image/Lenna.jpg"
    image = cv.imread(src)
    GrayImage = cv.cvtColor(image,cv.COLOR_BGR2GRAY)

    #图像形状-shape返回行数,列数,通道数(如果是灰度图像,最后的通道数为一且不显示)
    print(image.shape)
    print(GrayImage.shape)


    #图像大小-size返回图像的像素数目行数*列数*通道数
    print(image.size)
    print(GrayImage.size)

    #图像类型-dtype返回图像的的,通常返回uint8
    print(image.dtype)
    print(GrayImage.dtype)


猜你喜欢

转载自blog.csdn.net/xdg15294969271/article/details/121142853