cv2.resize与PIL中resize的区别

PIL.Image.resize

Image.resize(size, resample=0)[source]
'''
Returns a resized copy of this image.
参数:	
size – The requested size in pixels, as a 2-tuple: (width, height).
resample – An optional resampling filter. This can be one of PIL.Image.NEAREST (use nearest neighbour), PIL.Image.BILINEAR (linear interpolation in a 2x2 environment), PIL.Image.BICUBIC (cubic spline interpolation in a 4x4 environment), or PIL.Image.ANTIALIAS (a high-quality downsampling filter). If omitted, or if the image has mode “1” or “P”, it is set PIL.Image.NEAREST.
返回:	
An Image object.
'''

其默认的插值方式为最近邻

cv2.resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) → dst
'''
Parameters:	
src – Source image.
dst – Destination image. It has the size dsize (when it is non-zero) or the size computed from src.size() , fx , and fy . The type of dst is the same as of src .
dsize –
Destination image size. If it is zero, it is computed as:

\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}

Either dsize or both fx and fy must be non-zero.

fx –
Scale factor along the horizontal axis. When it is 0, it is computed as

\texttt{(double)dsize.width/src.cols}

fy –
Scale factor along the vertical axis. When it is 0, it is computed as

\texttt{(double)dsize.height/src.rows}

interpolation –
Interpolation method:

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.
INTER_CUBIC - a bicubic interpolation over 4x4 pixel neighborhood
INTER_LANCZOS4 - a Lanczos interpolation over 8x8 pixel neighborhood
'''

其默认的插值方式为双线性插值

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值