rgb_to_luminance.hpp 1007 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
  3. //
  4. // Distributed under the Boost Software License, Version 1.0
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. //
  8. #ifndef BOOST_GIL_EXTENSION_TOOLBOX_COLOR_CONVERTERS_RGB_TO_LUMINANCE_HPP
  9. #define BOOST_GIL_EXTENSION_TOOLBOX_COLOR_CONVERTERS_RGB_TO_LUMINANCE_HPP
  10. #include <boost/gil/color_convert.hpp>
  11. namespace boost{ namespace gil { namespace detail {
  12. /// - performance specialization double
  13. /// - to eliminate compiler warning 4244
  14. template <typename GrayChannelValue>
  15. struct rgb_to_luminance_fn< double, double, double, GrayChannelValue >
  16. {
  17. GrayChannelValue operator()( const double& red
  18. , const double& green
  19. , const double& blue ) const
  20. {
  21. return channel_convert<GrayChannelValue>( red * 0.30 + green * 0.59 + blue * 0.11 );
  22. }
  23. };
  24. } // namespace detail
  25. } // namespace gil
  26. } // namespace boost
  27. #endif