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

2024-05-08 14:59:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用cv2调整一个图像的大小,这样图像就只有100x100那么大,然后用imshow显示它。你知道吗

发件人:

enter image description here

收件人:

enter image description here

cv2中是否有一个函数会遗漏部分图像?你知道吗


Tags: 函数图像cv2收件人imshow遗漏
1条回答
网友
1楼 · 发布于 2024-05-08 14:59:49

多亏了爱管闲事的人,我找到了答案:

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大小。你知道吗

相关问题 更多 >