You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
always output true
The text was updated successfully, but these errors were encountered: