how can i get the size of cv2.imread(image_path)
时间: 2024-05-01 18:17:37 浏览: 153
你可以使用以下代码获取cv2.imread(image_path)返回的图像大小:
```
import cv2
image = cv2.imread(image_path)
height, width, channels = image.shape
print("Image height:", height)
print("Image width:", width)
print("Number of color channels:", channels)
```
注意,cv2.imread()返回的图像大小是以像素为单位的。如果图像不存在或路径不正确,cv2.imread()将返回NoneType。
阅读全文