python—— opcv cv2.reszie()

cv2.reszie(src, dsize[, dst[, fx[, fy[, interpolation]]]])
scr : 原图
dsize : resize的尺寸(h,w)
interpolation: 插值方法

    img = cv2.imread("/home/chenrui/hardware/tree2.png")
    print(img.shape)
    img_resize = cv2.resize(img, (256,256), interpolation=cv2.INTER_CUBIC)#双线性插值
    img_resize1 = cv2.resize(img, (256,256), interpolation=cv2.INTER_LINEAR)#
    img_resize2 = cv2.resize(img, (256,256), interpolation=cv2.INTER_NEAREST)#最近邻插值
    img_resize3 = cv2.resize(img, (256,256), interpolation=cv2.INTER_AREA)#最近邻插值
    print(img_resize.shape)
    cv2.imshow("img",img)
    cv2.imshow("img_resize",img_resize)
    cv2.imshow("img_resize1",img_resize1)
    cv2.imshow("img_resize2",img_resize2)
    cv2.imshow("img_resize3",img_resize3)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值