Accessing the properties of an image:
img.shapereturns a tuple of numbers of rows, columns and channels,
img.sizereturns the total number of pixels, and
img.dtypegives the image datatype.
An image can be resized with:
img2 = cv2.resize(img, None, fx=0.5, fy=0.5, interpolation = cv2.INTER_AREA)
fy denote the factors by which the image is rescaled
in the x and y direction, i.e. in this example the image is shrunk by half.
interpolationdenotes the interpolation method used:
cv2.INTER_AREAis recommended for shrinking,
cv2.INTER_LINEARcan be used for zooming, the latter being significantly faster.