Jittor / JDet

JDet is an object detection benchmark based on Jittor. Mainly focus on aerial image object detection (oriented object detection).
Apache License 2.0
191 stars 34 forks source link

为何 poly2obb 函数中要对 cv2.minAreaRect 返回的角度取负号? #63

Open YimianDai opened 2 years ago

YimianDai commented 2 years ago

请问一下,为何 JDet 的 poly2obb 函数会对 cv2.minAreaRect 返回的角度取负号(angle = -angleangle = -90 - angle)?

    for poly in polys_np:
        (x, y), (w, h), angle = cv2.minAreaRect(poly)
        if w >= h:
            angle = -angle
        else:
            w, h = h, w
            angle = -90 - angle

自己推理了一下,感觉没必要取负号。作为佐证,贴一段 MMRotate 的 poly2obb_np_le90 函数,相同功能,但没有取负号。

    rbbox = cv2.minAreaRect(bboxps)
    x, y, w, h, a = rbbox[0][0], rbbox[0][1], rbbox[1][0], rbbox[1][1], rbbox[2]
    if w < h:
        w, h = h, w
        a += np.pi / 2

请大佬不吝赐教~