openCV 相当于 PIL resize ANTIALIAS?

openCV equivalent of a PIL resize ANTIALIAS?

在 PIL 中,我所看到的最高质量调整大小似乎是:

img = img.resize((n1, n2), Image.ANTIALIAS)

对于 openCV,这似乎是实现它的方法:

small = cv2.resize(image, (0,0), fx=0.5, fy=0.5) 

所以我的问题是,是否需要额外的参数,或者这是否会在质量损失最小的情况下减小尺寸?

来自documentation

To shrink an image, it will generally look best with CV_INTER_AREA interpolation, whereas to enlarge an image, it will generally look best with CV_INTER_CUBIC (slow) or CV_INTER_LINEAR (faster but still looks OK).

调整大小的默认值是 CV_INTER_LINEAR。由于您希望缩小图像,因此将插值更改为 CV_INTER_AREA

small = cv2.resize(image, (0,0), fx=0.5, fy=0.5, interpolation = cv2.INTER_AREA)

您可能希望比较两种插值的结果,以目视验证您获得的是最佳质量。