height width image opencv

import cv2

img = cv2.imread('path/to/img',0)
height, width = img.shape[:2]

Here is what the above code is Doing:
1. We’re reading the image into a variable called img.
2. We’re storing the height and width of the image in two variables called height and width.
3. We’re creating a variable called center that stores the coordinates of the center of the image.