Total Pageviews

Thursday, August 13, 2026

3. Get number of pixel, dimension of image

 import cv2


img = cv2.imread('im1.jpg')


cv2.imshow("Cute Kitens", img)

print("Image Properties")

print("- Number of Pixels: " + str(img.size))

print("- Shape/Dimensions: " + str(img.shape))



OUTPUT:

Image Properties
- Number of Pixels: 489402
- Shape/Dimensions: (318, 513, 3)


No comments:

Post a Comment