【问题标题】:How to convert YOLO format annotations to x1, y1, x2, y2 coordinates in Python?Python中如何将YOLO格式注解转换为x1,y1,x2,y2坐标?
【发布时间】: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


    【解决方案1】:

    如果我没记错的话:

    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
    

    【讨论】:

      【解决方案2】:

      鉴于图像的左上角为 [0,0]:对于左上角,您必须执行 [x,y] = [center_X, center_Y] - 1/2 * [width, height] 。对于右下角[x,y] = [center_X, center_Y] + 1/2 * [width, height]

      【讨论】:

        猜你喜欢
        • 2019-09-30
        • 1970-01-01
        • 1970-01-01
        • 2016-09-02
        • 1970-01-01
        • 2020-09-26
        • 2015-09-12
        • 1970-01-01
        • 2017-11-18
        相关资源
        最近更新 更多