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
4d8a070a
Commit
4d8a070a
authored
Aug 26, 2012
by
Davis King
Browse files
Added another overloaded operator() to the object_detector so that it is
easy to get full_object_detections out of it.
parent
a6b44e0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
dlib/image_processing/object_detector.h
dlib/image_processing/object_detector.h
+40
-0
dlib/image_processing/object_detector_abstract.h
dlib/image_processing/object_detector_abstract.h
+21
-0
No files found.
dlib/image_processing/object_detector.h
View file @
4d8a070a
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "../geometry.h"
#include "../geometry.h"
#include <vector>
#include <vector>
#include "box_overlap_testing.h"
#include "box_overlap_testing.h"
#include "full_object_detection.h"
namespace
dlib
namespace
dlib
{
{
...
@@ -64,6 +65,15 @@ namespace dlib
...
@@ -64,6 +65,15 @@ namespace dlib
double
adjust_threshold
=
0
double
adjust_threshold
=
0
);
);
template
<
typename
image_type
>
void
operator
()
(
const
image_type
&
img
,
std
::
vector
<
std
::
pair
<
double
,
full_object_detection
>
>&
final_dets
,
double
adjust_threshold
=
0
);
template
<
typename
T
,
typename
U
>
template
<
typename
T
,
typename
U
>
friend
void
serialize
(
friend
void
serialize
(
const
object_detector
<
T
,
U
>&
item
,
const
object_detector
<
T
,
U
>&
item
,
...
@@ -289,6 +299,36 @@ namespace dlib
...
@@ -289,6 +299,36 @@ namespace dlib
}
}
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
image_scanner_type
,
typename
overlap_tester_type
>
template
<
typename
image_type
>
void
object_detector
<
image_scanner_type
,
overlap_tester_type
>::
operator
()
(
const
image_type
&
img
,
std
::
vector
<
std
::
pair
<
double
,
full_object_detection
>
>&
final_dets
,
double
adjust_threshold
)
{
std
::
vector
<
std
::
pair
<
double
,
rectangle
>
>
temp_dets
;
(
*
this
)(
img
,
temp_dets
,
adjust_threshold
);
final_dets
.
clear
();
final_dets
.
reserve
(
temp_dets
.
size
());
// convert all the rectangle detections into full_object_detections.
for
(
unsigned
long
i
=
0
;
i
<
temp_dets
.
size
();
++
i
)
{
final_dets
.
push_back
(
std
::
make_pair
(
temp_dets
[
i
].
first
,
scanner
.
get_full_object_detection
(
temp_dets
[
i
].
second
,
w
)));
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
...
...
dlib/image_processing/object_detector_abstract.h
View file @
4d8a070a
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "../geometry.h"
#include "../geometry.h"
#include <vector>
#include <vector>
#include "box_overlap_testing_abstract.h"
#include "box_overlap_testing_abstract.h"
#include "full_object_detection_abstract.h"
namespace
dlib
namespace
dlib
{
{
...
@@ -167,6 +168,26 @@ namespace dlib
...
@@ -167,6 +168,26 @@ namespace dlib
objects harder while a negative one makes it easier.
objects harder while a negative one makes it easier.
!*/
!*/
template
<
typename
image_type
>
void
operator
()
(
const
image_type
&
img
,
std
::
vector
<
std
::
pair
<
double
,
full_object_detection
>
>&
final_dets
,
double
adjust_threshold
=
0
);
/*!
requires
- img == an object which can be accepted by image_scanner_type::load()
ensures
- This function is identical to the above operator() routine, except that
it outputs full_object_detections instead of rectangles. This means that
the output includes part locations. In particular, calling this function
is the same as calling the above operator() routine and then using
get_scanner().get_full_object_detection() to resolve all the rectangles
into full_object_detections. Therefore, this version of operator() is
simply a convenience function for performing this set of operations.
!*/
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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