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()