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

This commit is contained in:
Juha Reunanen 2020-05-05 04:10:31 +03:00 committed by GitHub
parent 64ba66e1c7
commit c7062aa363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -1062,7 +1062,7 @@ namespace dlib
<< "\n\t Invalid inputs were given to this function."
<< "\n\t size_scale: " << size_scale
);
if (size_scale == 1.0) return; // no need to do anything at all
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);

View File

@ -435,6 +435,7 @@ namespace dlib
- #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.
- Returns immediately, if size_scale == 1.0
!*/
// ----------------------------------------------------------------------------------------