1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Return a convex hull from rotatedRectangleIntersection

This commit is contained in:
Dmitry Kurtaev
2018-04-30 21:51:33 +03:00
parent 8488f2e265
commit 07dc6d2b45
4 changed files with 196 additions and 320 deletions
+2 -3
View File
@@ -32,14 +32,13 @@ void NMSBoxes(const std::vector<Rect>& bboxes, const std::vector<float>& scores,
static inline float rotatedRectIOU(const RotatedRect& a, const RotatedRect& b)
{
std::vector<Point2f> inter, hull;
std::vector<Point2f> inter;
int res = rotatedRectangleIntersection(a, b, inter);
if (inter.empty() || res == INTERSECT_NONE)
return 0.0f;
if (res == INTERSECT_FULL)
return 1.0f;
convexHull(inter, hull);
float interArea = contourArea(hull);
float interArea = contourArea(inter);
return interArea / (a.size.area() + b.size.area() - interArea);
}