目标检测标签格式转换(kitti数据集格式转四坐标)

ef rotatePoint(xc, yc, xp, yp, theta):
    xoff = xp - xc

    yoff = yp - yc

    cosTheta = math.cos(theta)

    sinTheta = math.sin(theta)

    pResx = cosTheta * xoff + sinTheta * yoff

    pResy = - sinTheta * xoff + cosTheta * yoff

    return xc + pResx, yc + pResy


def addRotatedShape(cx, cy, w, h, angle):
    p0x, p0y = rotatePoint(cx, cy, cx - w / 2, cy - h / 2, -angle)

    p1x, p1y = rotatePoint(cx, cy, cx + w / 2, cy - h / 2, -angle)

    p2x, p2y = rotatePoint(cx, cy, cx + w / 2, cy + h / 2, -angle)

    p3x, p3y = rotatePoint(cx, cy, cx - w / 2, cy + h / 2, -angle)

    return p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y

样例数据:
转换前:

2 284.755840 55.945635 17.589079 125.675577 -5.620411

转换后:

316.4876871422387, 1.0000121940895426, 330.3529509009749, 11.82268104095521, 253.02399285776124, 110.89125780591047, 239.15872909902504, 100.06858895904477

可视化:
在这里插入图片描述
旋转框标注工具:
https://github.com/zexihan/labelImg-kitti

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

点PY

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值