From 85aa29a4e88e2a0963c4d0a170a3e7f555b5ec9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= <1671644+arrufat@users.noreply.github.com> Date: Mon, 29 Jan 2024 00:04:12 +0900 Subject: [PATCH] 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... --- dlib/image_transforms/random_color_transform.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlib/image_transforms/random_color_transform.h b/dlib/image_transforms/random_color_transform.h index a80e6162f..e6952ac8a 100644 --- a/dlib/image_transforms/random_color_transform.h +++ b/dlib/image_transforms/random_color_transform.h @@ -75,6 +75,9 @@ namespace dlib const double color_magnitude = 0.2 ) { + if (gamma_magnitude == 0 && color_magnitude == 0) + return; + image_view img(img_); random_color_transform tform(rnd, gamma_magnitude, color_magnitude); for (long r = 0; r < img.nr(); ++r)