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
0a7a75a2
Commit
0a7a75a2
authored
Aug 26, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a version of resize_image() that works inplace.
parent
ce3ed659
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
interpolation.h
dlib/image_transforms/interpolation.h
+23
-0
interpolation_abstract.h
dlib/image_transforms/interpolation_abstract.h
+22
-0
No files found.
dlib/image_transforms/interpolation.h
View file @
0a7a75a2
...
...
@@ -1007,6 +1007,29 @@ namespace dlib
resize_image
(
in_img
,
out_img
,
interpolate_bilinear
());
}
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
>
void
resize_image
(
double
size_scale
,
image_type
&
img
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
size_scale
>
0
,
"
\t
void resize_image()"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
size_scale: "
<<
size_scale
);
image_type
temp
;
set_image_size
(
temp
,
std
::
round
(
size_scale
*
num_rows
(
img
)),
std
::
round
(
size_scale
*
num_columns
(
img
)));
resize_image
(
img
,
temp
);
swap
(
img
,
temp
);
}
// ----------------------------------------------------------------------------------------
template
<
...
...
dlib/image_transforms/interpolation_abstract.h
View file @
0a7a75a2
...
...
@@ -414,6 +414,28 @@ namespace dlib
- Uses the bilinear interpolation to perform the necessary pixel interpolation.
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
>
void
resize_image
(
double
size_scale
,
image_type
&
img
);
/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
- pixel_traits<typename image_traits<image_type>::pixel_type>::has_alpha == false
ensures
- Resizes img so that each of it's dimensions are size_scale times larger than img.
In particular, we will have:
- #img.nr() == std::round(size_scale*img.nr())
- #img.nc() == std::round(size_scale*img.nc())
- #img == a bilinearly interpolated copy of the input image.
!*/
// ----------------------------------------------------------------------------------------
template
<
...
...
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