调整图片大小,仅在中心周围显示100x100像素

时间:2019-03-09 21:28:23

标签: python opencv image-processing

我想使用cv2调整图像的大小,以使图像仅大至100x100,并使用imshow显示它。

发件人:

enter image description here

收件人:

enter image description here

cv2中是否有一个功能可以省去部分图像?

1 个答案:

答案 0 :(得分:2)

感谢busybyte我找到了答案:

img = cv.imread("PATH")
centerx, centery = [int(img.shape[0] / 2) - 50, int(img.shape[1] / 2) - 50]
img = img[centerx:centerx + 100, centery:centery + 100]

从中心将图像缩小到所需的100x100尺寸。

相关问题