使用json文件中给出的坐标在python中裁剪图像

问题描述 投票:-2回答:1

我下面有带边框的图像,它们的json文件包含这样的坐标:

[{“ label”:“ Other”,“ confidence”:0.87,“ topleft”:{“ x”:227,“ y”:89},“ bottomright”:{“ x”:792,“ y”:274}},{“ label”:“ Other”,“ confidence”:0.74,“ topleft”:{“ x”:4,“ y”:173},“ bottomright”:{“ x”:208,“ y”:406}}},{“ label”:“ Other”,“ confidence”:0.96,“ topleft”:{“ x”:306,“ y”:238},“ bottomright”:{“ x”:511,“ y”:482}}]]

我已经对它们进行了对象检测。得到了带有正确标签的图像,但是现在我正尝试分别提取图像。我有一个文件夹,其中包含检测到的图像及其各自的json文件。我是python的新手,我想使用json文件信息从主文件中裁剪图像。

“边框图像”

我正在根据以下内容进行操作:Automated Cropping of images using Python

无法获取裁剪的图像。

python json image-processing coordinates crop
1个回答
0
投票

我建议您阅读this article,它将帮助您解码json文件,然后根据需要使用this library裁剪图像。

© www.soinside.com 2019 - 2024. All rights reserved.