【发布时间】:2021-03-25 14:24:21
【问题描述】:
我想知道如何将 YOLO 格式的注解(例如 center_X、center_y、width、height = 0.069824、0.123535、0.104492、0.120117)转换为 x1、y1、x2、y2 坐标?
【问题讨论】:
标签: python computer-vision yolo
我想知道如何将 YOLO 格式的注解(例如 center_X、center_y、width、height = 0.069824、0.123535、0.104492、0.120117)转换为 x1、y1、x2、y2 坐标?
【问题讨论】:
标签: python computer-vision yolo
如果我没记错的话:
x1 = (center_X-width/2)*image_width
x2 = (center_X+width/2)*image_width
y1 = (center_y-height/2)*image_height
y2 = (center_y+height/2)*image_height
【讨论】:
鉴于图像的左上角为 [0,0]:对于左上角,您必须执行 [x,y] = [center_X, center_Y] - 1/2 * [width, height] 。对于右下角[x,y] = [center_X, center_Y] + 1/2 * [width, height] 。
【讨论】: