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
0433da57
Commit
0433da57
authored
Jan 07, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some member functions to allow the user to set the minimum size
of an image pyramid layer.
parent
68d4dd75
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
6 deletions
+111
-6
scan_image_pyramid.h
dlib/image_processing/scan_image_pyramid.h
+76
-6
scan_image_pyramid_abstract.h
dlib/image_processing/scan_image_pyramid_abstract.h
+35
-0
No files found.
dlib/image_processing/scan_image_pyramid.h
View file @
0433da57
...
...
@@ -74,6 +74,17 @@ namespace dlib
inline
unsigned
long
get_max_detections_per_template
(
)
const
;
void
set_min_pyramid_layer_size
(
unsigned
long
width
,
unsigned
long
height
);
inline
unsigned
long
get_min_pyramid_layer_width
(
)
const
;
inline
unsigned
long
get_min_pyramid_layer_height
(
)
const
;
void
set_max_detections_per_template
(
unsigned
long
max_dets
);
...
...
@@ -180,6 +191,8 @@ namespace dlib
std
::
vector
<
detection_template
>
det_templates
;
unsigned
long
max_dets_per_template
;
unsigned
long
max_pyramid_levels
;
unsigned
long
min_pyramid_layer_width
;
unsigned
long
min_pyramid_layer_height
;
};
...
...
@@ -196,6 +209,8 @@ namespace dlib
serialize
(
item
.
det_templates
,
out
);
serialize
(
item
.
max_dets_per_template
,
out
);
serialize
(
item
.
max_pyramid_levels
,
out
);
serialize
(
item
.
min_pyramid_layer_width
,
out
);
serialize
(
item
.
min_pyramid_layer_height
,
out
);
}
// ----------------------------------------------------------------------------------------
...
...
@@ -211,6 +226,8 @@ namespace dlib
deserialize
(
item
.
det_templates
,
in
);
deserialize
(
item
.
max_dets_per_template
,
in
);
deserialize
(
item
.
max_pyramid_levels
,
in
);
deserialize
(
item
.
min_pyramid_layer_width
,
in
);
deserialize
(
item
.
min_pyramid_layer_height
,
in
);
}
// ----------------------------------------------------------------------------------------
...
...
@@ -227,7 +244,9 @@ namespace dlib
scan_image_pyramid
(
)
:
max_dets_per_template
(
10000
),
max_pyramid_levels
(
1000
)
max_pyramid_levels
(
1000
),
min_pyramid_layer_width
(
20
),
min_pyramid_layer_height
(
20
)
{
}
...
...
@@ -250,14 +269,12 @@ namespace dlib
// figure out how many pyramid levels we should be using based on the image size
pyramid_type
pyr
;
while
(
rect
.
width
()
>
20
&&
rect
.
height
()
>
20
)
do
{
rect
=
pyr
.
rect_down
(
rect
);
++
levels
;
if
(
levels
>=
max_pyramid_levels
)
break
;
}
}
while
(
rect
.
width
()
>=
min_pyramid_layer_width
&&
rect
.
height
()
>=
min_pyramid_layer_height
&&
levels
<
max_pyramid_levels
);
if
(
feats
.
max_size
()
<
levels
)
feats
.
set_max_size
(
levels
);
...
...
@@ -364,6 +381,8 @@ namespace dlib
det_templates
=
item
.
det_templates
;
max_dets_per_template
=
item
.
max_dets_per_template
;
max_pyramid_levels
=
item
.
max_pyramid_levels
;
min_pyramid_layer_width
=
item
.
min_pyramid_layer_width
;
min_pyramid_layer_height
=
item
.
min_pyramid_layer_height
;
}
// ----------------------------------------------------------------------------------------
...
...
@@ -723,6 +742,57 @@ namespace dlib
}
// ----------------------------------------------------------------------------------------
template
<
typename
Pyramid_type
,
typename
Feature_extractor_type
>
void
scan_image_pyramid
<
Pyramid_type
,
Feature_extractor_type
>::
set_min_pyramid_layer_size
(
unsigned
long
width
,
unsigned
long
height
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
width
>
0
&&
height
>
0
,
"
\t
void scan_image_pyramid::set_min_pyramid_layer_size()"
<<
"
\n\t
These sizes can't be zero. "
<<
"
\n\t
width: "
<<
width
<<
"
\n\t
height: "
<<
height
<<
"
\n\t
this: "
<<
this
);
min_pyramid_layer_width
=
width
;
min_pyramid_layer_height
=
height
;
}
// ----------------------------------------------------------------------------------------
template
<
typename
Pyramid_type
,
typename
Feature_extractor_type
>
unsigned
long
scan_image_pyramid
<
Pyramid_type
,
Feature_extractor_type
>::
get_min_pyramid_layer_width
(
)
const
{
return
min_pyramid_layer_width
;
}
// ----------------------------------------------------------------------------------------
template
<
typename
Pyramid_type
,
typename
Feature_extractor_type
>
unsigned
long
scan_image_pyramid
<
Pyramid_type
,
Feature_extractor_type
>::
get_min_pyramid_layer_height
(
)
const
{
return
min_pyramid_layer_height
;
}
// ----------------------------------------------------------------------------------------
}
...
...
dlib/image_processing/scan_image_pyramid_abstract.h
View file @
0433da57
...
...
@@ -37,6 +37,8 @@ namespace dlib
- is_loaded_with_image() == false
- get_max_detections_per_template() == 10000
- get_max_pyramid_levels() == 1000
- get_min_pyramid_layer_width() == 20
- get_min_pyramid_layer_height() == 20
WHAT THIS OBJECT REPRESENTS
This object is a tool for running a sliding window classifier over
...
...
@@ -238,6 +240,39 @@ namespace dlib
- #get_max_pyramid_levels() == max_levels
!*/
void
set_min_pyramid_layer_size
(
unsigned
long
width
,
unsigned
long
height
);
/*!
requires
- width > 0
- height > 0
ensures
- #get_min_pyramid_layer_width() == width
- #get_min_pyramid_layer_height() == height
!*/
inline
unsigned
long
get_min_pyramid_layer_width
(
)
const
;
/*!
ensures
- returns the smallest allowable width of an image in the image pyramid.
All pyramids will always include the original input image, however, no
pyramid levels will be created which have a width smaller than the
value returned by this function.
!*/
inline
unsigned
long
get_min_pyramid_layer_height
(
)
const
;
/*!
ensures
- returns the smallest allowable height of an image in the image pyramid.
All pyramids will always include the original input image, however, no
pyramid levels will be created which have a height smaller than the
value returned by this function.
!*/
unsigned
long
get_max_detections_per_template
(
)
const
;
/*!
...
...
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