
이미지 또는 신호를 resampling 할 때 사용하는 보간 알고리즘
sinc 함수를 짧은 길이의 window로 자른 필터 사용
윈도우 크기만큼의 주변 픽셀을 참고해서 resampling 함
mnist (28*28) 을 mnist(16*16) 으로의 변환이 필요했어서 예제는 16*16 resize 로 써둠
PIL, torch, cv 에서 사용할 수 있는 3가지 예제 코드임
from PIL import Image
img = Image.open("image.png")
img16 = img.resize((16, 16), resample=Image.LANCZOS)
from torchvision.transforms import Resize, InterpolationMode
resize_16 = Resize((16, 16), interpolation=InterpolationMode.LANCZOS)
import cv2
img = cv2.imread("image.png")
img16 = cv2.resize(img, (16,16), interpolation=cv2.INTER_LANCZOS4)

sinc 기반이라 ringing 발생가능성이 있음
이미지 작을수록 심함
타 interpolation 보다 계산량 많음