Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
b56f73ce
Commit
b56f73ce
authored
Sep 02, 2017
by
Davis King
Browse files
Added box_percent_covered()
parent
ac5206eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
dlib/image_processing/box_overlap_testing.h
dlib/image_processing/box_overlap_testing.h
+23
-0
dlib/image_processing/box_overlap_testing_abstract.h
dlib/image_processing/box_overlap_testing_abstract.h
+28
-0
No files found.
dlib/image_processing/box_overlap_testing.h
View file @
b56f73ce
...
...
@@ -34,6 +34,29 @@ namespace dlib
return
box_intersection_over_union
(
drectangle
(
a
),
drectangle
(
b
));
}
// ----------------------------------------------------------------------------------------
inline
double
box_percent_covered
(
const
drectangle
&
a
,
const
drectangle
&
b
)
{
const
double
inner
=
a
.
intersect
(
b
).
area
();
if
(
inner
==
0
)
return
0
;
return
std
::
max
(
inner
/
a
.
area
(),
inner
/
b
.
area
());
}
// ----------------------------------------------------------------------------------------
inline
double
box_percent_covered
(
const
rectangle
&
a
,
const
rectangle
&
b
)
{
return
box_percent_covered
(
drectangle
(
a
),
drectangle
(
b
));
}
// ----------------------------------------------------------------------------------------
class
test_box_overlap
...
...
dlib/image_processing/box_overlap_testing_abstract.h
View file @
b56f73ce
...
...
@@ -32,6 +32,34 @@ namespace dlib
boxes are empty then returns 0.
!*/
// ----------------------------------------------------------------------------------------
inline
double
box_percent_covered
(
const
drectangle
&
a
,
const
drectangle
&
b
);
/*!
ensures
- let OVERLAP = a.intersect(b).area()
- This function returns max(OVERLAP/a.area(), OVERLAP/b.area())
e.g. If one box entirely contains another then this function returns 1, if
they don't overlap at all it returns 0.
!*/
// ----------------------------------------------------------------------------------------
inline
double
box_percent_covered
(
const
rectangle
&
a
,
const
rectangle
&
b
);
/*!
ensures
- let OVERLAP = a.intersect(b).area()
- This function returns max(OVERLAP/a.area(), OVERLAP/b.area())
e.g. If one box entirely contains another then this function returns 1, if
they don't overlap at all it returns 0.
!*/
// ----------------------------------------------------------------------------------------
class
test_box_overlap
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment