Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove cv2.convexHull get the same iou. #48

Open
York1996OutLook opened this issue Dec 5, 2019 · 0 comments
Open

remove cv2.convexHull get the same iou. #48

York1996OutLook opened this issue Dec 5, 2019 · 0 comments

Comments

@York1996OutLook
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant