3. Get image info

作者: JaedenKil | 来源:发表于2020-01-13 17:45 被阅读0次
    import cv2 as cv2
    
    
    img = cv2.imread('C:\\Users\\zzheng\\Pictures\\tiger.png', cv2.IMREAD_UNCHANGED)
    dimensions = img.shape
    height = dimensions[0]
    width = dimensions[1]
    channels = dimensions[2]
    print("Image Dimension: ", dimensions)
    print("Image height: ", height)
    print("Image width: ", width)
    print("Image channels: ", channels)
    
    Image Dimension:  (1025, 1921, 3)
    Image height:  1025
    Image width:  1921
    Image channels:  3
    

    Height represents the number of pixel rows in the image or the number of pixels in each column of the image array.
    Width represents the number of pixel columns in the image or the number of pixels in each row of the image array.
    Number of Channels represents the number of components used to represent each pixel.
    Number of Channels = 4 represent Alpha, Red, Green and Blue channels.

    相关文章

      网友评论

        本文标题:3. Get image info

        本文链接:https://www.haomeiwen.com/subject/cednactx.html