26 #ifndef MLN_FUN_V2V_RGB_TO_LUMA_HH
27 # define MLN_FUN_V2V_RGB_TO_LUMA_HH
29 # include <mln/value/rgb.hh>
40 template <
typename T_luma>
41 struct rgb_to_luma :
public Function_v2v< rgb_to_luma<T_luma> >
43 typedef T_luma result;
45 template <
typename T_rgb>
46 T_luma operator()(
const T_rgb& rgb)
const;
51 # ifndef MLN_INCLUDE_ONLY
53 template <
typename T_luma>
54 template <
typename T_rgb>
57 rgb_to_luma<T_luma>::operator()(
const T_rgb& rgb)
const
59 float luma = 0.299 * rgb.red() + 0.587 * rgb.green() + 0.114 * rgb.blue();
60 return unsigned(luma + 0.49999);
64 # endif // !MLN_INCLUDE_ONLY
72 #endif // ! MLN_FUN_V2V_RGB_TO_LUMA_HH