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.
网友评论