Return shortcut in disturb_colors (#2909)

* Return shortcut in disturb_colors

No need to do anything if both gamma and color magnitudes are set to 0.

* Fix typo

This happens for being lazy and making the change directly from GitHub...
This commit is contained in:
Adrià Arrufat 2024-01-29 00:04:12 +09:00 committed by GitHub
parent b0f6be8058
commit 85aa29a4e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -75,6 +75,9 @@ namespace dlib
const double color_magnitude = 0.2 const double color_magnitude = 0.2
) )
{ {
if (gamma_magnitude == 0 && color_magnitude == 0)
return;
image_view<image_type> img(img_); image_view<image_type> img(img_);
random_color_transform tform(rnd, gamma_magnitude, color_magnitude); random_color_transform tform(rnd, gamma_magnitude, color_magnitude);
for (long r = 0; r < img.nr(); ++r) for (long r = 0; r < img.nr(); ++r)