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
cf77875d
Commit
cf77875d
authored
Aug 26, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gave create_tiled_pyramid() the ability to include padding around the outsides
of the pyramid image.
parent
02cf246d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
image_pyramid.h
dlib/image_transforms/image_pyramid.h
+8
-6
image_pyramid_abstract.h
dlib/image_transforms/image_pyramid_abstract.h
+4
-2
No files found.
dlib/image_transforms/image_pyramid.h
View file @
cf77875d
...
...
@@ -988,7 +988,8 @@ namespace dlib
const
image_type1
&
img
,
image_type2
&
out_img
,
std
::
vector
<
rectangle
>&
rects
,
const
unsigned
long
padding
=
10
const
unsigned
long
padding
=
10
,
const
unsigned
long
outer_padding
=
0
)
{
DLIB_ASSERT
(
!
is_same_object
(
img
,
out_img
));
...
...
@@ -1038,14 +1039,15 @@ namespace dlib
}
height
-=
padding
;
// don't add unnecessary padding to the very right side.
set_image_size
(
out_img
,
height
,
img
.
nc
());
const
long
width
=
img
.
nc
();
set_image_size
(
out_img
,
height
+
outer_padding
*
2
,
width
+
outer_padding
*
2
);
assign_all_pixels
(
out_img
,
0
);
long
y
=
0
;
long
y
=
outer_padding
;
size_t
i
=
0
;
while
(
y
<
height
)
while
(
y
<
height
+
outer_padding
)
{
rectangle
rect
=
translate_rect
(
get_rect
(
pyramid
[
i
]),
point
(
0
,
y
));
rectangle
rect
=
translate_rect
(
get_rect
(
pyramid
[
i
]),
point
(
outer_padding
,
y
));
DLIB_ASSERT
(
get_rect
(
out_img
).
contains
(
rect
));
rects
.
push_back
(
rect
);
auto
si
=
sub_image
(
out_img
,
rect
);
...
...
@@ -1056,7 +1058,7 @@ namespace dlib
y
-=
padding
;
while
(
i
<
pyramid
.
size
())
{
point
p1
(
img
.
nc
()
-
1
,
y
-
1
);
point
p1
(
outer_padding
+
width
-
1
,
y
-
1
);
point
p2
=
p1
-
get_rect
(
pyramid
[
i
]).
br_corner
();
rectangle
rect
(
p1
,
p2
);
DLIB_ASSERT
(
get_rect
(
out_img
).
contains
(
rect
));
...
...
dlib/image_transforms/image_pyramid_abstract.h
View file @
cf77875d
...
...
@@ -219,7 +219,8 @@ namespace dlib
const
image_type1
&
img
,
image_type2
&
out_img
,
std
::
vector
<
rectangle
>&
rects
,
const
unsigned
long
padding
=
10
const
unsigned
long
padding
=
10
,
const
unsigned
long
outer_padding
=
0
);
/*!
requires
...
...
@@ -237,7 +238,8 @@ namespace dlib
pyramid levels are generated from pyramid_type's downsampling. The entire
resulting pyramid is packed into a single image and stored in out_img.
- When packing pyramid levels into out_img, there will be padding pixels of
space between each sub-image.
space between each sub-image. There will also be outer_padding pixels of
padding around the edge of the image. All padding pixels have a value of 0.
- The resulting pyramid will be composed of #rects.size() images packed into
out_img. Moreover, #rects[i] is the location inside out_img of the i-th
pyramid level.
...
...
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