1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

EAST: An Efficient and Accurate Scene Text Detector (https://arxiv.org/abs/1704.03155v2)

This commit is contained in:
Dmitry Kurtaev
2018-04-24 18:25:43 +03:00
parent d1d7408a20
commit 8488f2e265
8 changed files with 412 additions and 76 deletions
+24
View File
@@ -8,6 +8,8 @@
#include "precomp.hpp"
#include "nms.inl.hpp"
#include <opencv2/imgproc.hpp>
namespace cv
{
namespace dnn
@@ -28,6 +30,28 @@ void NMSBoxes(const std::vector<Rect>& bboxes, const std::vector<float>& scores,
NMSFast_(bboxes, scores, score_threshold, nms_threshold, eta, top_k, indices, rectOverlap);
}
static inline float rotatedRectIOU(const RotatedRect& a, const RotatedRect& b)
{
std::vector<Point2f> inter, hull;
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);
return interArea / (a.size.area() + b.size.area() - interArea);
}
void NMSBoxes(const std::vector<RotatedRect>& bboxes, const std::vector<float>& scores,
const float score_threshold, const float nms_threshold,
std::vector<int>& indices, const float eta, const int top_k)
{
CV_Assert(bboxes.size() == scores.size(), score_threshold >= 0,
nms_threshold >= 0, eta > 0);
NMSFast_(bboxes, scores, score_threshold, nms_threshold, eta, top_k, indices, rotatedRectIOU);
}
CV__DNN_EXPERIMENTAL_NS_END
}// dnn
}// cv