-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
rotatedRectangleIntersection does not work when one rectangle has zero size #18520
Copy link
Copy link
Closed
Labels
Milestone
Description
System information (version)
- OpenCV => 4.4.0
- Operating System / Platform => Ubuntu 18.04
Detailed description
I encountered this bug after trying to do collision checking on rectangles generated by minAreaRect. Some rectangles that were clearly not touching where marked as being in collision. I found out that some of mine rotated rectangles are actually more points but still i would expect the rotatedRectangleIntersection to work correctly.
Steps to reproduce
This is in python, but C++ has the same behaviour.
import cv2
r1 = ((2, 2), (0, 0), 0)
r2 = ((50, 50) , (4, 4), 0)
res = cv2.rotatedRectangleIntersection(r1, r2)
print(res)output:
(2, array([[[48., 52.]],
[[48., 48.]],
[[52., 48.]],
[[52., 52.]]], dtype=float32))
expected output:
(0, None)
In the case of a non zero sized rectacle it works
import cv2
r1 = ((2, 2), (0.1, 0), 0)
r2 = ((50, 50) , (4, 4), 0)
res = cv2.rotatedRectangleIntersection(r1, r2)
print(res)ouput
(0, None)
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues,
answers.opencv.org, Stack Overflow, etc and have not found solution - I updated to latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc
Reactions are currently unavailable