* mln/fun/v2v/all.hh: Include the new header. * mln/fun/v2v/rgb_to_int_u.hh: New. --- milena/ChangeLog | 8 +++++ milena/mln/fun/v2v/all.hh | 1 + milena/mln/fun/v2v/{id.hh => rgb_to_int_u.hh} | 38 ++++++++---------------- 3 files changed, 22 insertions(+), 25 deletions(-) copy milena/mln/fun/v2v/{id.hh => rgb_to_int_u.hh} (72%) diff --git a/milena/ChangeLog b/milena/ChangeLog index c2335e8..73b9647 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,13 @@ 2009-12-14 Guillaume Lazzara <z@lrde.epita.fr> + Add rbg_to_int_u function. + + * mln/fun/v2v/all.hh: Include the new header. + + * mln/fun/v2v/rgb_to_int_u.hh: New. + +2009-12-14 Guillaume Lazzara <z@lrde.epita.fr> + Add an antialiased subsampling. * mln/subsampling/antialiased.hh: New. diff --git a/milena/mln/fun/v2v/all.hh b/milena/mln/fun/v2v/all.hh index 425d24e..2c455a5 100644 --- a/milena/mln/fun/v2v/all.hh +++ b/milena/mln/fun/v2v/all.hh @@ -60,6 +60,7 @@ namespace mln # include <mln/fun/v2v/linear.hh> # include <mln/fun/v2v/norm.hh> # include <mln/fun/v2v/projection.hh> +# include <mln/fun/v2v/rgb_to_int_u.hh> //<<lrde # include <mln/fun/v2v/rgb_to_hsi.hh> # include <mln/fun/v2v/rgb_to_hsl.hh> diff --git a/milena/mln/fun/v2v/id.hh b/milena/mln/fun/v2v/rgb_to_int_u.hh similarity index 72% copy from milena/mln/fun/v2v/id.hh copy to milena/mln/fun/v2v/rgb_to_int_u.hh index 21398c7..d04dbf0 100644 --- a/milena/mln/fun/v2v/id.hh +++ b/milena/mln/fun/v2v/rgb_to_int_u.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -23,16 +23,9 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef MLN_FUN_V2V_ID_HH -# define MLN_FUN_V2V_ID_HH - -/*! \file - * - * \brief Identity function. - */ - -# include <mln/fun/internal/selector.hh> +#ifndef MLN_FUN_V2V_RGB_TO_INT_U_HH +# define MLN_FUN_V2V_RGB_TO_INT_U_HH namespace mln { @@ -43,25 +36,21 @@ namespace mln namespace v2v { - // FIXME: Doc! - - template <typename T> - struct id - : fun::internal::selector_<T, T, id<T> >::ret + template <unsigned n> + struct rgb_to_int_u : Function_v2v< rgb_to_int_u<n> > { - typedef T result; - T operator()(const T& t) const; - }; + typedef value::int_u<n> result; + result operator()(const value::rgb<n>& c) const; + }; # ifndef MLN_INCLUDE_ONLY - template <typename T> - inline - T - id<T>::operator()(const T& t) const + template <unsigned n> + typename rgb_to_int_u<n>::result + rgb_to_int_u<n>::operator()(const value::rgb<n>& c) const { - return t; + return (c.red() + c.green() + c.blue()) / 3; } # endif // ! MLN_INCLUDE_ONLY @@ -72,5 +61,4 @@ namespace mln } // end of namespace mln - -#endif // ! MLN_FUN_V2V_ID_HH +#endif // ! MLN_FUN_V2V_RGB_TO_INT_U_HH -- 1.5.6.5