Image size (Python, OpenCV)
问题 I would like to get the Image size in python,as I do it with c++. int w = src->width; printf("%d", 'w'); 回答1: Use the function GetSize from the module cv with your image as parameter. It returns width, height as a tuple with 2 elements: width, height = cv.GetSize(src) 回答2: Using openCV and numpy it is as easy as this: import cv2 img = cv2.imread('path/to/img',0) height, width = img.shape[:2] 回答3: I use numpy.size() to do the same: import numpy as np import cv2 image = cv2.imread('image.jpg')