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
d53a37e7
Commit
d53a37e7
authored
Dec 22, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added another member function which enables you to get the detection
strengths from the object_detector.
parent
ca6bd2ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
0 deletions
+79
-0
object_detector.h
dlib/image_processing/object_detector.h
+56
-0
object_detector_abstract.h
dlib/image_processing/object_detector_abstract.h
+23
-0
No files found.
dlib/image_processing/object_detector.h
View file @
d53a37e7
...
@@ -45,6 +45,14 @@ namespace dlib
...
@@ -45,6 +45,14 @@ namespace dlib
const
image_type
&
img
const
image_type
&
img
)
const
;
)
const
;
template
<
typename
image_type
>
void
operator
()
(
const
image_type
&
img
,
std
::
vector
<
std
::
pair
<
double
,
rectangle
>
>&
final_dets
)
const
;
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
,
...
@@ -72,6 +80,19 @@ namespace dlib
...
@@ -72,6 +80,19 @@ namespace dlib
return
false
;
return
false
;
}
}
bool
overlaps_any_box
(
const
std
::
vector
<
std
::
pair
<
double
,
rectangle
>
>&
rects
,
const
dlib
::
rectangle
&
rect
)
const
{
for
(
unsigned
long
i
=
0
;
i
<
rects
.
size
();
++
i
)
{
if
(
boxes_overlap
(
rects
[
i
].
second
,
rect
))
return
true
;
}
return
false
;
}
overlap_tester_type
boxes_overlap
;
overlap_tester_type
boxes_overlap
;
matrix
<
double
,
0
,
1
>
w
;
matrix
<
double
,
0
,
1
>
w
;
mutable
image_scanner_type
scanner
;
mutable
image_scanner_type
scanner
;
...
@@ -221,6 +242,41 @@ namespace dlib
...
@@ -221,6 +242,41 @@ namespace dlib
return
final_dets
;
return
final_dets
;
}
}
// ----------------------------------------------------------------------------------------
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
,
rectangle
>
>&
final_dets
)
const
{
final_dets
.
clear
();
if
(
w
.
size
()
!=
0
)
{
std
::
vector
<
std
::
pair
<
double
,
rectangle
>
>
dets
;
const
double
thresh
=
w
(
scanner
.
get_num_dimensions
());
scanner
.
load
(
img
);
scanner
.
detect
(
w
,
dets
,
thresh
);
for
(
unsigned
long
i
=
0
;
i
<
dets
.
size
();
++
i
)
{
if
(
overlaps_any_box
(
final_dets
,
dets
[
i
].
second
))
continue
;
dets
[
i
].
first
-=
thresh
;
final_dets
.
push_back
(
dets
[
i
]);
}
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
dlib/image_processing/object_detector_abstract.h
View file @
d53a37e7
...
@@ -99,6 +99,29 @@ namespace dlib
...
@@ -99,6 +99,29 @@ namespace dlib
element 1 the next best, and so on.
element 1 the next best, and so on.
!*/
!*/
template
<
typename
image_type
>
void
operator
()
(
const
image_type
&
img
,
std
::
vector
<
std
::
pair
<
double
,
rectangle
>
>&
dets
)
const
;
/*!
requires
- img == an object which can be accepted by image_scanner_type::load()
ensures
- performs object detection on the given image and stores the
detected objects into #dets. In particular, we will have that:
- #dets is sorted such that the highest confidence detections
come first. E.g. element 0 is the best detection, element 1
the next best, and so on.
- #dets.size() == the number of detected objects.
- #dets[i].first gives the "detection confidence", of the i-th
detection. This is the detection value output by the scanner
minus the threshold, therefore this is a value > 0.
- #dets[i].second == the bounding box for the i-th detection.
!*/
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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