FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
opencv/modules/dnn/src/nms.cpp at master · pythonmjs/opencv · GitHub
pythonmjs
/
opencv
Public
forked from
opencv/opencv
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
opencv
/
modules
/
dnn
/
src
/
nms.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (48 loc) · 1.9 KB
Breadcrumbs
opencv
/
modules
/
dnn
/
src
/
nms.cpp
Copy path
File metadata and controls
56 lines (48 loc) · 1.9 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
This file is part of OpenCV project.
//
It is subject to the license terms in the LICENSE file found in the top-level directory
//
of this distribution and at http://opencv.org/license.html.
//
//
Copyright (C) 2017, Intel Corporation, all rights reserved.
//
Third party copyrights are property of their respective owners.
#
include
"
precomp.hpp
"
#
include
"
nms.inl.hpp
"
#
include
<
opencv2/imgproc.hpp
>
namespace
cv
{
namespace
dnn
{
CV__DNN_EXPERIMENTAL_NS_BEGIN
static
inline
float
rectOverlap
(
const
Rect& a,
const
Rect& b)
{
return
1
.
f
-
static_cast
<
float
>(
jaccardDistance
(a, b));
}
void
NMSBoxes
(
const
std::vector<Rect>& 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, rectOverlap);
}
static
inline
float
rotatedRectIOU
(
const
RotatedRect& a,
const
RotatedRect& b)
{
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
;
float
interArea =
contourArea
(inter);
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
Back
|
FazBrowse Home
|
New Git URL