Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
d607a8e5
Commit
d607a8e5
authored
Sep 08, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a functor for testing if two rectangles overlap.
parent
a57744ac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
0 deletions
+140
-0
image_processing.h
dlib/image_processing.h
+1
-0
box_overlap_testing.h
dlib/image_processing/box_overlap_testing.h
+73
-0
box_overlap_testing_abstract.h
dlib/image_processing/box_overlap_testing_abstract.h
+66
-0
No files found.
dlib/image_processing.h
View file @
d607a8e5
...
...
@@ -7,6 +7,7 @@
#include "image_processing/scan_image_pyramid.h"
#include "image_processing/detection_template_tools.h"
#include "image_processing/object_detector.h"
#include "image_processing/box_overlap_testing.h"
#endif // DLIB_IMAGE_PROCESSInG_H___
...
...
dlib/image_processing/box_overlap_testing.h
0 → 100644
View file @
d607a8e5
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_BOX_OVERlAP_TESTING_H__
#define DLIB_BOX_OVERlAP_TESTING_H__
#include "box_overlap_testing_abstract.h"
#include "../geometry.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
class
test_box_overlap
{
public
:
test_box_overlap
(
)
:
overlap_thresh
(
0
.
5
)
{}
test_box_overlap
(
double
overlap_thresh_
)
:
overlap_thresh
(
overlap_thresh_
)
{}
bool
operator
()
(
const
dlib
::
rectangle
&
a
,
const
dlib
::
rectangle
&
b
)
const
{
const
double
inner
=
a
.
intersect
(
b
).
area
();
const
double
outer
=
(
a
+
b
).
area
();
if
(
inner
/
outer
>
overlap_thresh
)
return
true
;
else
return
false
;
}
double
get_overlap_thresh
(
)
const
{
return
overlap_thresh
;
}
private
:
double
overlap_thresh
;
};
// ----------------------------------------------------------------------------------------
inline
void
serialize
(
const
test_box_overlap
&
item
,
std
::
ostream
&
out
)
{
serialize
(
item
.
get_overlap_thresh
(),
out
);
}
inline
void
deserialize
(
test_box_overlap
&
item
,
std
::
istream
&
in
)
{
double
overlap_thresh
;
deserialize
(
overlap_thresh
,
in
);
item
=
test_box_overlap
(
overlap_thresh
);
}
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_BOX_OVERlAP_TESTING_H__
dlib/image_processing/box_overlap_testing_abstract.h
0 → 100644
View file @
d607a8e5
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_BOX_OVERlAP_TESTING_ABSTRACT_H__
#ifdef DLIB_BOX_OVERlAP_TESTING_ABSTRACT_H__
#include "../geometry.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
class
test_box_overlap
{
public
:
test_box_overlap
(
)
:
overlap_thresh
(
0
.
5
)
{}
test_box_overlap
(
double
overlap_thresh_
)
:
overlap_thresh
(
overlap_thresh_
)
{}
bool
operator
()
(
const
dlib
::
rectangle
&
a
,
const
dlib
::
rectangle
&
b
)
const
{
const
double
inner
=
a
.
intersect
(
b
).
area
();
const
double
outer
=
(
a
+
b
).
area
();
if
(
inner
/
outer
>
overlap_thresh
)
return
true
;
else
return
false
;
}
double
get_overlap_thresh
(
)
const
;
};
// ----------------------------------------------------------------------------------------
void
serialize
(
const
test_box_overlap
&
item
,
std
::
ostream
&
out
);
/*!
provides serialization support
!*/
void
deserialize
(
test_box_overlap
&
item
,
std
::
istream
&
in
);
/*!
provides deserialization support
!*/
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_BOX_OVERlAP_TESTING_ABSTRACT_H__
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