opencv改变图片大小,cv2.resize方法详解
cv2.resize可以改变图片的尺寸,方法如下
def resize(src, dsize, dst=None, fx=None, fy=None, interpolation=None)
-
src:输入图像 dsize:变化后的尺寸 dst:输出图像 fx,fy:沿x轴,y轴方向的缩放比例 interpolation:中文意思是插值,表示使用什么算法来对图像进行改变
interpolation有几个可选项,如下
官方对于 interpolation的说明
To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR (faster but still looks OK).
翻译:要缩小图像,通常使用 INTER_AREA 插值看起来效果最好,而使用 .放大图像,通常使用 INTER_CUBIC(慢)或 INTER_LINEAR 效果最好。 (更快,但看起来还可以)。
上一篇:
通过多线程提高代码的执行效率例子