cv::rotatedRectangleIntersection assertion failed.
Hi,
I'm working on finding the intersections between two rotatedRectangle.
RotatedRect r1 = RotatedRect(Point2f(1174.85852, 730.577332), Size2f(1318.08118, 400.503601), -2.31209111);
RotatedRect r2 = RotatedRect(Point2f(1172.80396, 728.535950), Size2f(1318.74963, 389.407377), -2.97718263);
vector<cv::Point2f> vertices;
int intersectionType = cv::rotatedRectangleIntersection(r1, r2, vertices);
then it throws this: OpenCV Error: Assertion failed (intersection.size() <= 8) in cv::rotatedRectangleIntersection, file ......, line 245 even if the verticies.size() is 6.
Strange thing is, it works fine in Debug mode, but it doesn't in Release mode... Can anyone help me?
Thanks in advance.
os / bits / compiler / opencv version ?
(can't reproduce your problem)
Same problem ("error: (-215) intersection.size() <= 8 in function rotatedRectangleIntersection"). It seems rotatedRectangleIntersection fails when the two rectangles are very similar
Code:
Replicated a couple dozen times (vs ~600k times where there was no problem). The intersection of 2 rectangles can be a point, line, or polygon with 3-8 sides. I suspect that given the "<=8" and the very similar rectangles, I would guess they are asserting the result has <=8 sides but they have a bug in an edge condition that erroneously is trying to return a ~9-sided polygon. every instance (so far) the problem does away if the vertices are rounded to 1 decimal place.