Commit ed3c2522 authored by Davis King's avatar Davis King

Made get_pixel_intensity() more efficient.

parent 02bf1190
...@@ -237,7 +237,7 @@ namespace dlib ...@@ -237,7 +237,7 @@ namespace dlib
- if (pixel_traits<P>::grayscale == true) then - if (pixel_traits<P>::grayscale == true) then
- returns src - returns src
- else - else
- converts src to the HSI color space and returns the intensity - converts src to grayscale and returns the resulting value.
!*/ !*/
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -1043,9 +1043,9 @@ namespace dlib ...@@ -1043,9 +1043,9 @@ namespace dlib
{ {
P temp = src; P temp = src;
temp.alpha = 255; temp.alpha = 255;
hsi_pixel p; typename pixel_traits<P>::basic_pixel_type p;
assign_pixel(p,temp); assign_pixel(p,temp);
return static_cast<typename pixel_traits<P>::basic_pixel_type>(p.i); return p;
} }
template < template <
...@@ -1057,9 +1057,9 @@ namespace dlib ...@@ -1057,9 +1057,9 @@ namespace dlib
const P& src const P& src
) )
{ {
hsi_pixel p; typename pixel_traits<P>::basic_pixel_type p;
assign_pixel(p,src); assign_pixel(p,src);
return static_cast<typename pixel_traits<P>::basic_pixel_type>(p.i); return p;
} }
template < template <
......
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