Unverified Commit c7062aa3 authored by Juha Reunanen's avatar Juha Reunanen Committed by GitHub
Browse files

Minor optimization: add shortcut to in-place image resize if size_scale is 1 (#2076)

parent 64ba66e1
...@@ -1062,7 +1062,7 @@ namespace dlib ...@@ -1062,7 +1062,7 @@ namespace dlib
<< "\n\t Invalid inputs were given to this function." << "\n\t Invalid inputs were given to this function."
<< "\n\t size_scale: " << size_scale << "\n\t size_scale: " << size_scale
); );
if (size_scale == 1.0) return; // no need to do anything at all
image_type temp; image_type temp;
set_image_size(temp, std::round(size_scale*num_rows(img)), std::round(size_scale*num_columns(img))); set_image_size(temp, std::round(size_scale*num_rows(img)), std::round(size_scale*num_columns(img)));
resize_image(img, temp); resize_image(img, temp);
......
...@@ -435,6 +435,7 @@ namespace dlib ...@@ -435,6 +435,7 @@ namespace dlib
- #img.nr() == std::round(size_scale*img.nr()) - #img.nr() == std::round(size_scale*img.nr())
- #img.nc() == std::round(size_scale*img.nc()) - #img.nc() == std::round(size_scale*img.nc())
- #img == a bilinearly interpolated copy of the input image. - #img == a bilinearly interpolated copy of the input image.
- Returns immediately, if size_scale == 1.0
!*/ !*/
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment