It also helps in enlarging images. In many cases, we need to resize the image, i.e. Either skew it or enlarge it to fit the size requirements. OpenCV provides us with several interpolation methods for resizing an image.
Choosing an interpolation method for resizing —
cv2. INTER_AREA: This is used when we need to shrink the image.
cv2.INTER_CUBIC: This is slower but more efficient.
cv2.INTER_LINEAR: This is mainly used when enlargement is required. This is the default interpolation method in OenCV.
Below is the code to resize.
Note. When using
cv2.resize () that the tuple passed to determine the size of the new image (in this case (1050, 1610)) follows the order (width, height ) in excellent from the expected. (height width).