DetectionTeamUCAS / RRPN_Faster-RCNN_Tensorflow

A tensorflow re-implementation of RRPN: Arbitrary-Oriented Scene Text Detection via Rotation Proposals.
254 stars 89 forks source link

remove cv2.convexHull get the same iou. #48

Open York1996OutLook opened 4 years ago

York1996OutLook commented 4 years ago

def intersection_area(rect1,rect2): r1 = cv2.rotatedRectangleIntersection(rect1, rect2) if r1[1] is None: return 0

order_points=cv2.convexHull(r1[1],returnPoints=True)

area = cv2.contourArea(r1[1])
return area

def intersection_area_convex(rect1,rect2): r1 = cv2.rotatedRectangleIntersection(rect1, rect2) if r1[1] is None: return 0 order_points=cv2.convexHull(r1[1],returnPoints=True) area = cv2.contourArea(order_points) return area

and

for i in range(100):
    x1,y1,w1,h1,angle1,x2,y2,w2,h2,angle2=np.random.randint(1,300,10)

    result1=intersection_area( ((x1,y1),(w1,h1),angle1),((x2,y2),(w2,h2),angle2) )
    result2=intersection_area_convex( ((x1,y1),(w1,h1),angle1),((x2,y2),(w2,h2),angle2) )
    print(result1==result2)

always output true