5、openCV 图像尺寸调整

# -*- coding: utf-8 -*-
import cv2, matplotlib
import numpy as np
import matplotlib.pyplot as plt
image = cv2.imread('1.jpg')
width = image.shape[0]
height = image.shape[1]
resizeImg = cv2.resize(image,(height/2,width/2))
#Python: cv2.resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) → dst¶
cv2.imshow('original',image )
cv2.imshow('resize',resizeImg)
cv2.imwrite('resize.png',resizeImg)
cv2.waitKey(0)

cv.resize:https://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html?highlight=resize#cv2.resize

手册其实很清楚

5、openCV 图像尺寸调整_第1张图片

你可能感兴趣的:(OpenCV)