- 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_CUBIC – a bicubic interpolation over 4×4 pixel neighborhood
- INTER_LANCZOS4 – a Lanczos interpolation over 8×8 pixel neighborhood
from the official docs.
I use this often when using
cv2.resize method. For example,
import cv2 img = cv2.imread("testimage.png") resized = cv2.resize(img, (100,100), interpolation=cv2.INTER_LINEAR)
reducing resize results
here is the default image.(50×50)
and here are the results of reducing it to 15×15 with various interpolation methods.
enlarge resize results
with the same default image used above, here are the results when it is enlarged to 100×100