From 71ab04f7bcff6917d0804625ad39a44a9f364607 Mon Sep 17 00:00:00 2001 From: sutr90 Date: Tue, 26 Jul 2016 22:11:56 +0200 Subject: [PATCH] Added missing conversion between HSI and CIELab. --- dlib/pixel.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dlib/pixel.h b/dlib/pixel.h index 8629f6490..6148c8223 100644 --- a/dlib/pixel.h +++ b/dlib/pixel.h @@ -1241,6 +1241,18 @@ namespace dlib assign_pixel_helpers::assign(dest,temp); } + template < typename P1, typename P2 > + typename enable_if_c::hsi && pixel_traits::lab>::type + assign(P1& dest, const P2& src) + { + rgb_pixel temp; + // convert lab value to our temp rgb pixel + assign_pixel_helpers::assign(temp,src); + // now we can just go assign the new rgb value to the + // hsi pixel + assign_pixel_helpers::assign(dest,temp); + } + // ----------------------------- // dest is an lab pixel template < typename P1> @@ -1293,6 +1305,20 @@ namespace dlib // hsi pixel assign_pixel_helpers::assign(dest,temp); } + + template < typename P1, typename P2 > + typename enable_if_c::lab && pixel_traits::hsi>::type + assign(P1& dest, const P2& src) + { + rgb_pixel temp; + + // convert hsi value to our temp rgb pixel + assign_pixel_helpers::assign(temp,src); + + // now we can just go assign the new rgb value to the + // lab pixel + assign_pixel_helpers::assign(dest,temp); + } } // -----------------------------