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
3f203cbc
Commit
3f203cbc
authored
Dec 29, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the requirement that an image be loaded before
calling get_best_matching_rect().
parent
04626317
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
scan_image_pyramid.h
dlib/image_processing/scan_image_pyramid.h
+13
-14
scan_image_pyramid_abstract.h
dlib/image_processing/scan_image_pyramid_abstract.h
+0
-1
No files found.
dlib/image_processing/scan_image_pyramid.h
View file @
3f203cbc
...
...
@@ -549,12 +549,10 @@ namespace dlib
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
get_num_detection_templates
()
>
0
&&
is_loaded_with_image
(),
DLIB_ASSERT
(
get_num_detection_templates
()
>
0
,
"
\t
const rectangle scan_image_pyramid::get_best_matching_rect()"
<<
"
\n\t
Invalid inputs were given to this function "
<<
"
\n\t
get_num_detection_templates(): "
<<
get_num_detection_templates
()
<<
"
\n\t
is_loaded_with_image(): "
<<
is_loaded_with_image
()
<<
"
\n\t
this: "
<<
this
);
...
...
@@ -588,12 +586,15 @@ namespace dlib
const
dlib
::
vector
<
double
,
2
>
p
(
rect
.
width
(),
rect
.
height
());
// for all the levels
for
(
unsigned
long
l
=
0
;
l
<
feats
.
size
()
;
++
l
)
for
(
unsigned
long
l
=
0
;
l
<
max_pyramid_levels
;
++
l
)
{
// Run the center point through the feature/image space transformation just to make
// sure we exactly replicate the procedure for shifting an object_box used elsewhere
// in this file.
const
point
origin
=
feats
[
l
].
feat_to_image_space
(
feats
[
l
].
image_to_feat_space
(
center
(
pyr
.
rect_down
(
rect
,
l
))));
const
rectangle
temp
=
pyr
.
rect_down
(
rect
,
l
);
if
(
temp
.
area
()
<=
1
)
break
;
const
point
origin
=
feats_config
.
feat_to_image_space
(
feats_config
.
image_to_feat_space
(
center
(
temp
)));
for
(
unsigned
long
t
=
0
;
t
<
det_templates
.
size
();
++
t
)
{
...
...
@@ -617,24 +618,22 @@ namespace dlib
}
// Now get the features out of feats[best_level]. But first translate best_template
// into the right spot (it should be centered at the location determined by rect)
// and convert it into the feature image coordinate system.
// Now we translate best_template into the right spot (it should be centered at the location
// determined by rect) and convert it into the feature image coordinate system.
rect
=
pyr
.
rect_down
(
rect
,
best_level
);
const
point
offset
=
-
feats
[
best_level
]
.
image_to_feat_space
(
point
(
0
,
0
));
const
point
origin
=
feats
[
best_level
]
.
image_to_feat_space
(
center
(
rect
))
+
offset
;
const
point
offset
=
-
feats
_config
.
image_to_feat_space
(
point
(
0
,
0
));
const
point
origin
=
feats
_config
.
image_to_feat_space
(
center
(
rect
))
+
offset
;
for
(
unsigned
long
k
=
0
;
k
<
best_template
.
rects
.
size
();
++
k
)
{
rectangle
temp
=
best_template
.
rects
[
k
];
temp
=
feats
[
best_level
]
.
image_to_feat_space
(
temp
);
temp
=
feats
_config
.
image_to_feat_space
(
temp
);
temp
=
translate_rect
(
temp
,
origin
);
temp
=
get_rect
(
feats
[
best_level
]).
intersect
(
temp
);
best_template
.
rects
[
k
]
=
temp
;
}
// The input rectangle was mapped to one of the detection templates. Reverse the process
// to figure out what the mapped rectangle is in the original input space.
mapped_rect
=
translate_rect
(
best_template
.
object_box
,
feats
[
best_level
]
.
feat_to_image_space
(
origin
-
offset
));
mapped_rect
=
translate_rect
(
best_template
.
object_box
,
feats
_config
.
feat_to_image_space
(
origin
-
offset
));
mapped_rect
=
pyr
.
rect_up
(
mapped_rect
,
best_level
);
}
...
...
@@ -671,7 +670,7 @@ namespace dlib
for
(
unsigned
long
j
=
0
;
j
<
best_template
.
rects
.
size
();
++
j
)
{
const
rectangle
rect
=
best_template
.
rects
[
j
];
const
rectangle
rect
=
best_template
.
rects
[
j
]
.
intersect
(
get_rect
(
feats
[
best_level
]))
;
const
unsigned
long
template_region_id
=
j
;
const
unsigned
long
offset
=
feats_config
.
get_num_dimensions
()
*
template_region_id
;
for
(
long
r
=
rect
.
top
();
r
<=
rect
.
bottom
();
++
r
)
...
...
dlib/image_processing/scan_image_pyramid_abstract.h
View file @
3f203cbc
...
...
@@ -294,7 +294,6 @@ namespace dlib
)
const
;
/*!
requires
- is_loaded_with_image() == true
- get_num_detection_templates() > 0
ensures
- Since scan_image_pyramid is a sliding window classifier system, not all possible rectangles
...
...
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