last-svn-commit-12-g7abe6d3 2009-12-15 green <jacquelet@lrde.epita.fr>

Introduce new image converter from color to greyscale. * green/mln/fun/v2v/rgb8_to_int_u8.hh: New image converter. --- milena/sandbox/ChangeLog | 6 ++++ .../{int_u16_to_int_u14.hh => rgb8_to_int_u8.hh} | 32 ++++++++++---------- 2 files changed, 22 insertions(+), 16 deletions(-) copy milena/sandbox/green/mln/fun/v2v/{int_u16_to_int_u14.hh => rgb8_to_int_u8.hh} (75%) diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog index 3863ada..bc689d2 100644 --- a/milena/sandbox/ChangeLog +++ b/milena/sandbox/ChangeLog @@ -1,5 +1,11 @@ 2009-12-15 green <jacquelet@lrde.epita.fr> + Introduce new image converter from color to greyscale. + + * green/mln/fun/v2v/rgb8_to_int_u8.hh: New image converter. + +2009-12-15 green <jacquelet@lrde.epita.fr> + Add new image paths to use the annoting database. * green/mln/img_path.hh: Update to LRDE norm and add annoting database. diff --git a/milena/sandbox/green/mln/fun/v2v/int_u16_to_int_u14.hh b/milena/sandbox/green/mln/fun/v2v/rgb8_to_int_u8.hh similarity index 75% copy from milena/sandbox/green/mln/fun/v2v/int_u16_to_int_u14.hh copy to milena/sandbox/green/mln/fun/v2v/rgb8_to_int_u8.hh index e7f4755..0f63c8c 100644 --- a/milena/sandbox/green/mln/fun/v2v/int_u16_to_int_u14.hh +++ b/milena/sandbox/green/mln/fun/v2v/rgb8_to_int_u8.hh @@ -25,47 +25,47 @@ // 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_INT_U16_TO_INT_U14_HH -#define MLN_FUN_V2V_INT_U16_TO_INT_U14_HH +#ifndef MLN_FUN_V2V_RGB8_TO_INT_U8_HH +# define MLN_FUN_V2V_RGB8_TO_INT_U8_HH -#include <mln/value/int_u16.hh> -#include <mln/value/int_u.hh> +# include <mln/value/int_u8.hh> +# include <mln/value/rgb8.hh> +# include <mln/core/contract.hh> /// \file /// -/// \brief Convert int_u16 value to int_u14. +/// \brief Convert rgb8 color value to int_u8 grey value namespace mln { namespace fun { - + namespace v2v { - /// \brief Convert int_u16 value to int_u14. + /// \brief Convert rgb8 color value to int_u8 grey value /// /// \ingroup modfunv2v - struct int_u16_to_int_u14 : Function_v2v< int_u16_to_int_u14 > + struct rgb8_to_int_u8 : Function_v2v<rgb8_to_int_u8> { - typedef value::int_u16 argument; - typedef value::int_u<14> result; - + typedef value::rgb8 argument; + typedef value::int_u8 result; + result operator()(const argument& c) const { - result res(c / 4); - + result res((c.red() + c.green() + c.blue()) / 3); + return res; } }; } - + } } - -#endif // ! MLN_FUN_V2V_INT_U16_TO_INT_U14_HH +#endif // ! MLN_FUN_V2V_RGB8_TO_INT_U8_HH -- 1.5.6.5
participants (1)
-
green