Ask Your Question

Revision history [back]

There are some interpolation algorithms in OpenCV and You can find all the examples here: How to resize images in OpenCV python

Code:

image_scaled=cv2.resize(image,None,fx=.75,fy=.75,interpolation = cv2.INTER_LINEAR)
img_double=cv2.resize(image,None,fx=2,fy=2,interpolation=cv2.INTER_CUBIC)
image_resize=cv2.resize(image,(200,300),interpolation=cv2.INTER_AREA)
image_resize=cv2.resize(image,(500,400),interpolation=cv2.INTER_LANCZOS4)
  • INTER_NEAREST – a nearest-neighbor interpolation
  • INTER_LINEAR – a bilinear interpolation (used by default)

  • INTER_AREA – resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method. I

  • NTER_CUBIC – a bicubic interpolation over 4×4 pixel
    neighborhood

  • INTER_LANCZOS4 – a Lanczos interpolation over 8×8 pixel
    neighborhood