
* doc/mln/convert.dox: Add examples and explanations. * mln/convert/from_to.hh, * mln/convert/to.hh, * mln/convert/to_image.hh, * mln/convert/to_p_array.hh, * mln/convert/to_p_set.hh, * mln/convert/to_qimage.hh, * mln/convert/to_qimage_nocopy.hh, * mln/convert/to_upper_window.hh, * mln/convert/to_window.hh, * mln/data/convert.hh, * mln/fun/v2v/convert.hh, * mln/fun/v2v/hsl_to_rgb.hh, * mln/fun/v2v/qt_rgb_to_int_u.hh, * mln/fun/v2v/rgb8_to_rgbn.hh, * mln/fun/v2v/rgb_to_hsl.hh, * mln/fun/v2v/rgb_to_int_u.hh, * mln/fun/v2v/rgb_to_luma.hh: Add to conversion module. --- milena/ChangeLog | 24 +++++ milena/doc/mln/convert.dox | 165 +++++++++++++++++++++++++++++++- milena/mln/convert/from_to.hh | 2 +- milena/mln/convert/to.hh | 19 ++++- milena/mln/convert/to_image.hh | 28 ++++- milena/mln/convert/to_p_array.hh | 21 +++- milena/mln/convert/to_p_set.hh | 35 ++++++-- milena/mln/convert/to_qimage.hh | 18 +++- milena/mln/convert/to_qimage_nocopy.hh | 24 +++++- milena/mln/convert/to_upper_window.hh | 14 ++- milena/mln/convert/to_window.hh | 23 ++++- milena/mln/data/convert.hh | 14 ++- milena/mln/fun/v2v/convert.hh | 16 +++- milena/mln/fun/v2v/hsl_to_rgb.hh | 13 ++- milena/mln/fun/v2v/qt_rgb_to_int_u.hh | 8 ++- milena/mln/fun/v2v/rgb8_to_rgbn.hh | 31 +++--- milena/mln/fun/v2v/rgb_to_hsl.hh | 27 +++++- milena/mln/fun/v2v/rgb_to_int_u.hh | 15 +++- milena/mln/fun/v2v/rgb_to_luma.hh | 13 +++- 19 files changed, 436 insertions(+), 74 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index f25eaf7..86129ef 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,29 @@ 2013-04-19 Guillaume Lazzara <z@lrde.epita.fr> + Add documentation about image conversions. + + * doc/mln/convert.dox: Add examples and explanations. + + * mln/convert/from_to.hh, + * mln/convert/to.hh, + * mln/convert/to_image.hh, + * mln/convert/to_p_array.hh, + * mln/convert/to_p_set.hh, + * mln/convert/to_qimage.hh, + * mln/convert/to_qimage_nocopy.hh, + * mln/convert/to_upper_window.hh, + * mln/convert/to_window.hh, + * mln/data/convert.hh, + * mln/fun/v2v/convert.hh, + * mln/fun/v2v/hsl_to_rgb.hh, + * mln/fun/v2v/qt_rgb_to_int_u.hh, + * mln/fun/v2v/rgb8_to_rgbn.hh, + * mln/fun/v2v/rgb_to_hsl.hh, + * mln/fun/v2v/rgb_to_int_u.hh, + * mln/fun/v2v/rgb_to_luma.hh: Add to conversion module. + +2013-04-19 Guillaume Lazzara <z@lrde.epita.fr> + * mln/data/convert.hh: Introduce a new overload taking a conversion function as parameter. diff --git a/milena/doc/mln/convert.dox b/milena/doc/mln/convert.dox index bb2b1e6..158fb43 100644 --- a/milena/doc/mln/convert.dox +++ b/milena/doc/mln/convert.dox @@ -1,9 +1,164 @@ /*! \defgroup convert Convertion Routines - * - * \brief All conversion routines provided in Milena. - * - * \ingroup modroutines - */ + + \brief All conversion routines provided in Milena. + + Type conversions in Olena mainly relies on convert::from_to(). This + routine works on a single value only. + + Type conversion of image value types relies on data::convert. This + routine relies on convert::from_to(). For each pixel value, + convert::from_to() is called. + + Examples of use: + \code + image2d<value::int_u8> ima_gl; + // Initialization of ima_gl. + // ... + image2d<value::rgb8> ima_color = mln::data::convert(value::rgb8(), ima_gl); + \endcode + + \code + image2d<value::int_u8> ima_gl; + // Initialization of ima_gl. + // ... + image2d<bool> ima_b = mln::data::convert(bool(), ima_gl); + \endcode + + + Sometimes, no default conversion is available from type \c + mln_value(I) to \c V. It fails with a compilation error such as: + + \code + #include <mln/core/image/image2d.hh> + #include <mln/data/convert.hh> + #include <mln/value/int_u8.hh> + #include <mln/value/rgb8.hh> + + int main() + { + using namespace mln; + + image2d<value::rgb8> ima_color; + // Initialization of ima_color + // ... + image2d<value::int_u8> ima_gl = data::convert(value::int_u8(), ima_color); + } + \endcode + \code + $ g++ -I$OLN/milena main.cc + ... + /my/path/to/oln/milena/mln/convert/from_to.hh:152:5: error: ‘check’ is not a member of ‘mln::metal::abort_<mln::value::rgb<8u> >’ + \endcode + + Missing conversion is sometimes due to non-trivial + conversions. Here, converting a value::rgb8 towards a value::int_u8 + implies to compute the luminance, but several formulae exist. + + For a single use of a specific conversion, the shortest way is to + use the data::convert() overload which takes a conversion function. + It must be used with one of conversion function listed on this page. + + \code + #include <mln/core/image/image2d.hh> + #include <mln/data/convert.hh> + #include <mln/value/int_u8.hh> + #include <mln/value/rgb8.hh> + #include <mln/fun/v2v/rgb_to_luma.hh> + + int main() + { + using namespace mln; + + image2d<value::rgb8> ima_color; + // Initialization of ima_color + // ... + image2d<value::int_u8> ima_gl = data::convert(fun::v2v::rgb_to_luma<value::int_u8>(), ima_color); + } + \endcode + + It is also possible to declare a user-defined function. Just declare + a class that inherits from the mln::Function_v2v class and respects + the required interface. + + \code + #include <mln/core/image/image2d.hh> + #include <mln/data/convert.hh> + #include <mln/value/int_u8.hh> + #include <mln/value/rgb8.hh> + #include <mln/fun/v2v/rgb_to_luma.hh> + + namespace mln + { + struct only_red_component : public Function_v2v<only_red_component> + { + typedef value::int_u8 result; + typedef mln::value::rgb8 argument; + + result operator()(const argument& v) const + { + return v.red(); + } + }; + + } // end of namespace mln + + int main() + { + using namespace mln; + + image2d<value::rgb8> ima_color; + // Initialization of ima_color + // ... + image2d<value::int_u8> ima_red_gl = data::convert(only_red_component(), ima_color); + } + \endcode + + + If a program requires conversions that are not provided by default + they can be defined manually by declaring a from_to_() + overload. Default overloads are listed in module \ref fromto. + + \code + #include <mln/core/image/image2d.hh> + #include <mln/data/convert.hh> + #include <mln/value/int_u8.hh> + #include <mln/value/rgb8.hh> + + namespace mln + { + namespace value + { + + void from_to_(const value::rgb8& from, value::int_u8& to) + { + to = (from.red() + from.green() + from.blue()) / 3; + } + + } // end of namespace mln::value + } // end of namespace mln + + int main() + { + using namespace mln; + + image2d<value::rgb8> ima_color; + // Initialization of ima_color + // ... + image2d<value::int_u8> ima_red_gl = data::convert(value::int_u8(), ima_color); + } + \endcode + + Such declarations extend the capabilities of from_to() and all + conversion routines relying on it. + + \warning In order to work properly, the from_to_ overload must be + declared in the exact same namespace as its first argument. In case + the first argument is a builtin type (e.g. int), rely on the second + argument namespace. from_to_ overload resolution relies on the + Argument-Dependent Lookup (ADL) provided by C++. + + \ingroup modroutines +*/ /*! \defgroup fromto from_to_ Routines * diff --git a/milena/mln/convert/from_to.hh b/milena/mln/convert/from_to.hh index 32a471d..2befb57 100644 --- a/milena/mln/convert/from_to.hh +++ b/milena/mln/convert/from_to.hh @@ -58,7 +58,7 @@ namespace mln namespace convert { - /*! \brief Value conversion routine. + /*! \brief Conversion routine. This is a generic function to convert an object towards another one. diff --git a/milena/mln/convert/to.hh b/milena/mln/convert/to.hh index 6dc72e9..699b71d 100644 --- a/milena/mln/convert/to.hh +++ b/milena/mln/convert/to.hh @@ -46,7 +46,24 @@ namespace mln { - /// Conversion of the object \p from towards an object with type \c T. + /*! + \brief Conversion of the object \p from towards an object with + type \c T. + + This routine relies on from_to(). + + It is provided for conveniance. + + \warning The destination type must be specified as template + parameter while calling this function. + + \code + value::int_u8 gl = 3; + value::rgb8 color = convert::to<value::rgb8>(gl); + \endcode + + \ingroup convert + */ template <typename T, typename O> T to(const O& from); diff --git a/milena/mln/convert/to_image.hh b/milena/mln/convert/to_image.hh index 71fde90..2eda6e7 100644 --- a/milena/mln/convert/to_image.hh +++ b/milena/mln/convert/to_image.hh @@ -55,28 +55,44 @@ namespace mln { - /// Convert a point set \p pset into a binary image. Width of the - /// converted image will be pset.bbox + 2 * \p border. + /*! + \brief Convert a point set \p pset into a binary image. + + Width of the converted image will be pset.bbox + 2 * \p border. + \ingroup convert + */ template <typename S> mln_image_from_grid(mln_site(S)::grid, bool) to_image(const Site_Set<S>& pset, unsigned border = 1); - /// Convert a window \p win into a binary image. + /*! + \brief Convert a window \p win into a binary image. + \ingroup convert + */ template <typename W> mln_image_from_grid(mln_site(W)::grid, bool) to_image(const Window<W>& win); - /// Convert a weighted window \p w_win into an image. + /*! + \brief Convert a weighted window \p w_win into an image. + \ingroup convert + */ template <typename W> mln_image_from_grid(mln_site(W)::grid, mln_weight(W)) to_image(const Weighted_Window<W>& w_win); - /// Convert a neighborhood \p nbh into a binary image. + /*! + \brief Convert a neighborhood \p nbh into a binary image. + \ingroup convert + */ template <typename N> mln_image_from_grid(mln_site(N)::grid, bool) to_image(const Neighborhood<N>& nbh); - /// Convert an histo \p h into an image1d<unsigned>. + /*! + \brief Convert an histo \p h into an image1d<unsigned>. + \ingroup convert + */ template <typename T> image1d<unsigned> to_image(const histo::array<T>& h); diff --git a/milena/mln/convert/to_p_array.hh b/milena/mln/convert/to_p_array.hh index 24d64fc..3d54b53 100644 --- a/milena/mln/convert/to_p_array.hh +++ b/milena/mln/convert/to_p_array.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -43,18 +44,28 @@ namespace mln namespace convert { - /// Convert a point set \p pset into a p_array (point set vector). + /*! + \brief Convert a point set \p pset into a p_array (point set vector). + \ingroup convert + */ template <typename S> p_array<mln_psite(S)> to_p_array(const Site_Set<S>& pset); - /// Convert a window \p win centered at point \p p into a p_array - /// (point set vector). + /*! + \brief Convert a window \p win centered at point \p p into a p_array + (point set vector). + + \ingroup convert + */ template <typename W> p_array<mln_psite(W)> to_p_array(const Window<W>& win, const mln_psite(W)& p); - /// Convert an image \p img into a p_array. + /*! + \brief Convert an image \p img into a p_array. + \ingroup convert + */ template <typename I> p_array<mln_psite(I)> to_p_array(const Image<I>& img); diff --git a/milena/mln/convert/to_p_set.hh b/milena/mln/convert/to_p_set.hh index 46cd5e7..5758579 100644 --- a/milena/mln/convert/to_p_set.hh +++ b/milena/mln/convert/to_p_set.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -48,28 +49,48 @@ namespace mln namespace convert { - /// Convert a neighborhood \p nbh into a site set. + /*! + \brief Convert a neighborhood \p nbh into a site set. + \ingroup convert + */ template <typename N> p_set<mln_psite(N)> to_p_set(const Neighborhood<N>& nbh); - /// Convert a binary image \p ima into a site set. + /*! + \brief Convert a binary image \p ima into a site set. + \ingroup convert + */ template <typename I> p_set<mln_psite(I)> to_p_set(const Image<I>& ima); - /// Convert a Window \p win into a site set. + /*! + \brief Convert a Window \p win into a site set. + \ingroup convert + */ template <typename W> p_set<mln_psite(W)> to_p_set(const Window<W>& win); - /// Convert an std::set \p s of sites into a site set. - /// C is the comparison functor. + /*! + \brief Convert an std::set \p s of sites into a site set. + + \tparam P is the site type. + \tparam C is the comparison functor. + + \ingroup convert + */ template <typename P, typename C> p_set<P> to_p_set(const std::set<P, C>& s); - /// Convert any site set \p ps into a 'mln::p_set<>' site set. + /*! + \brief Convert any site set \p ps into a 'mln::p_set<>' site + set. + + \ingroup convert + */ template <typename S> p_set<mln_psite(S)> to_p_set(const Site_Set<S>& ps); diff --git a/milena/mln/convert/to_qimage.hh b/milena/mln/convert/to_qimage.hh index fd90125..b6f84a6 100755 --- a/milena/mln/convert/to_qimage.hh +++ b/milena/mln/convert/to_qimage.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2010, 2012 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2010, 2012, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -56,9 +56,17 @@ namespace mln namespace convert { - /// \brief Convert a Milena image to a Qimage. - /// - // + /*! + \brief Convert a Milena image to a Qimage by copying data. + + This function requires the library <a + href="http://www.qt-project.org">Qt</a> 4.x or 5.x. + + This function copies the content of \p ima into the QImage + output. + + \ingroup convert + */ template <typename I> inline QImage diff --git a/milena/mln/convert/to_qimage_nocopy.hh b/milena/mln/convert/to_qimage_nocopy.hh index 2820f0e..2d5df86 100755 --- a/milena/mln/convert/to_qimage_nocopy.hh +++ b/milena/mln/convert/to_qimage_nocopy.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -52,6 +53,26 @@ namespace mln namespace convert { + /*! + \brief Convert a Milena image to a Qimage without copy. + + This function requires the library <a + href="http://www.qt-project.org">Qt</a> 4.x or 5.x. + + It does not copy any data. The underlying data remains held by + \p ima. + + \warning \p ima must remain valid until QImage is destroyed. + + \ingroup convert + */ + template <typename I> + inline + QImage to_qimage_nocopy(const Image<I>& ima); + + +# ifndef MLN_INCLUDE_ONLY + // Implementation namespace impl @@ -171,6 +192,7 @@ namespace mln return output; } +# endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::convert diff --git a/milena/mln/convert/to_upper_window.hh b/milena/mln/convert/to_upper_window.hh index aae46e2..af0b7f7 100644 --- a/milena/mln/convert/to_upper_window.hh +++ b/milena/mln/convert/to_upper_window.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -42,11 +43,18 @@ namespace mln namespace convert { - /// Convert a window \p nbh into an upper window. + /*! + \brief Convert a window \p nbh into an upper window. + + \ingroup convert + */ template <typename W> window<mln_dpsite(W)> to_upper_window(const Window<W>& win); - /// Convert a neighborhood \p nbh into an upper window. + /*! + \brief Convert a neighborhood \p nbh into an upper window. + \ingroup convert + */ template <typename N> window<mln_dpoint(N)> to_upper_window(const Neighborhood<N>& nbh); diff --git a/milena/mln/convert/to_window.hh b/milena/mln/convert/to_window.hh index 9114a00..a5697ff 100644 --- a/milena/mln/convert/to_window.hh +++ b/milena/mln/convert/to_window.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -46,19 +47,31 @@ namespace mln namespace convert { - /// Convert a neighborhood \p nbh into a window. + /*! + Convert a neighborhood \p nbh into a window. + \ingroup convert + */ template <typename N> mln_window(N) to_window(const Neighborhood<N>& nbh); - /// Convert a binary image \p ima into a window. + /*! + \brief Convert a binary image \p ima into a window. + \ingroup convert + */ template <typename I> window<mln_site(I)::dpsite> to_window(const Image<I>& ima); - /// Convert a site set \p pset into a window. + /*! + \brief Convert a site set \p pset into a window. + \ingroup convert + */ template <typename S> window<mln_site(S)::dpsite> to_window(const Site_Set<S>& pset); - /// Convert an std::set \p s of delta-sites into a window. + /*! + \brief Convert an std::set \p s of delta-sites into a window. + \ingroup convert + */ template <typename D, typename C> window<D> to_window(const std::set<D, C>& s); diff --git a/milena/mln/data/convert.hh b/milena/mln/data/convert.hh index f004076..2c2a4f0 100644 --- a/milena/mln/data/convert.hh +++ b/milena/mln/data/convert.hh @@ -45,11 +45,15 @@ namespace mln { /*! \brief Convert the image \p input by changing the value type. - * - * \param[in] v A value of the destination type. - * \param[in] input The input image. - * - * \ingroup mlndata + + \param[in] v A value of the destination type. Its type is used + to specify the target value type. The value itself + is unused. + \param[in] input The input image. + + \return An image of value type V. + + \ingroup mlndata convert */ template <typename V, typename I> mln_ch_value(I, V) diff --git a/milena/mln/fun/v2v/convert.hh b/milena/mln/fun/v2v/convert.hh index e1064b8..42c4229 100644 --- a/milena/mln/fun/v2v/convert.hh +++ b/milena/mln/fun/v2v/convert.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -28,7 +29,7 @@ /// \file /// -/// FIXME. +/// \brief Function which relies on from_to() to convert values. /// /// \todo The function is intrisically meta; how to handle that /// particular case? @@ -47,13 +48,22 @@ namespace mln namespace v2v { - // FIXME: Doc! + /*! \brief Function which relies on from_to() to convert values. + \tparam V The destination type. + + This function relies on convert::from_to(). + + \sa data::convert. + \ingroup modfunv2v convert + */ template <typename V> struct convert : public Function_v2v< convert<V> > { typedef V result; + /// Convert a value of type \c W towards type \c V thanks to + /// convert::from_to(). template <typename W> V operator()(const W& w) const; }; diff --git a/milena/mln/fun/v2v/hsl_to_rgb.hh b/milena/mln/fun/v2v/hsl_to_rgb.hh index 4470681..25f5d10 100644 --- a/milena/mln/fun/v2v/hsl_to_rgb.hh +++ b/milena/mln/fun/v2v/hsl_to_rgb.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2008, 2009, 2011, 2012 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2011, 2012, 2013 EPITA Research and +// Development Laboratory (LRDE) // // This file is part of Olena. // @@ -54,10 +54,11 @@ namespace mln namespace v2v { - /// \brief Convert hsl values to rgb. - /// - /// \ingroup modfunv2v - // + /*! + \brief Convert hsl values to rgb. + + \ingroup modfunv2v convert + */ template <typename T_rgb> struct f_hsl_to_rgb_ : public Function_v2v< f_hsl_to_rgb_<T_rgb> > { diff --git a/milena/mln/fun/v2v/qt_rgb_to_int_u.hh b/milena/mln/fun/v2v/qt_rgb_to_int_u.hh index 17292fb..3a60763 100644 --- a/milena/mln/fun/v2v/qt_rgb_to_int_u.hh +++ b/milena/mln/fun/v2v/qt_rgb_to_int_u.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -43,6 +44,11 @@ namespace mln namespace v2v { + /*! + \brief Convert value::qt::rgb32 values to value::int_u8. + + \ingroup modfunv2v convert + */ template <unsigned n> struct qt_rgb_to_int_u : Function_v2v< qt_rgb_to_int_u<n> > { diff --git a/milena/mln/fun/v2v/rgb8_to_rgbn.hh b/milena/mln/fun/v2v/rgb8_to_rgbn.hh index 74b713e..d4cab2e 100644 --- a/milena/mln/fun/v2v/rgb8_to_rgbn.hh +++ b/milena/mln/fun/v2v/rgb8_to_rgbn.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2010, 2012 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2010, 2012, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -47,25 +47,26 @@ namespace mln { - /// \brief Convert a rgb8 value to a rgn, n < 8. - /// - /// \param n defines the output quantification used for the transformation. - /// - /// \ingroup modfunv2v - // + /*! \brief Convert a rgb8 value to a rgn, n < 8. + + \tparam n defines the output quantification used for the transformation. + + \ingroup modfunv2v convert + */ template <unsigned n> struct rgb8_to_rgbn : Function_v2v< rgb8_to_rgbn<n> > { typedef value::rgb8 argument; typedef value::rgb<n> result; - /// \brief Convert a rgb8 value to a rgn, n < 8. - /// - /// \param[in] c the rgb8 value to convert. - /// - /// Conversion is done by computing the size by which we - /// divide each rgb component. - // + /*! + \brief Convert a rgb8 value to a rgn, n < 8. + + \param[in] c the rgb8 value to convert. + + Conversion is done by computing the size by which we + divide each rgb component. + */ result operator()(const argument& c) const; }; diff --git a/milena/mln/fun/v2v/rgb_to_hsl.hh b/milena/mln/fun/v2v/rgb_to_hsl.hh index 11339fd..177069f 100644 --- a/milena/mln/fun/v2v/rgb_to_hsl.hh +++ b/milena/mln/fun/v2v/rgb_to_hsl.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2008, 2009, 2011, 2012 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2011, 2012, 2013 EPITA Research and +// Development Laboratory (LRDE) // // This file is part of Olena. // @@ -27,6 +27,10 @@ #ifndef MLN_FUN_V2V_RGB_TO_HSL_HH # define MLN_FUN_V2V_RGB_TO_HSL_HH +/// \file +/// +/// \brief Conversion function from value::rgb to value::hsl_. + # include <cmath> # include <mln/math/round.hh> @@ -51,6 +55,13 @@ namespace mln namespace v2v { + /*! + \brief conversion function from value:rgb to value::hsl_. + + \tparam T_hsl The desired output hsl type. + + \ingroup modfunv2v convert + */ template <typename T_hsl> struct f_rgb_to_hsl_ : public Function_v2v< f_rgb_to_hsl_<T_hsl> > { @@ -63,8 +74,20 @@ namespace mln }; + /*! + \brief Type of a default conversion function from value::rgb + to value::hsl_f. + + \ingroup modfunv2v convert + */ typedef f_rgb_to_hsl_<value::hsl_f> f_rgb_to_hsl_f_t; + /*! + \brief Predefined conversion functor converting from value::rgb + to value::hsl_f. + + \ingroup modfunv2v convert + */ extern f_rgb_to_hsl_f_t f_rgb_to_hsl_f; diff --git a/milena/mln/fun/v2v/rgb_to_int_u.hh b/milena/mln/fun/v2v/rgb_to_int_u.hh index 1be1ae2..a6a6feb 100644 --- a/milena/mln/fun/v2v/rgb_to_int_u.hh +++ b/milena/mln/fun/v2v/rgb_to_int_u.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2009, 2010, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -24,6 +24,9 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. +/// \file +/// +/// \brief Conversion function from value::rgb to value::int_u. #ifndef MLN_FUN_V2V_RGB_TO_INT_U_HH # define MLN_FUN_V2V_RGB_TO_INT_U_HH @@ -41,6 +44,14 @@ namespace mln namespace v2v { + /*! + \brief Conversion function from value::rgb to value::int_u. + + \tparam n Defines the number of bits of the integer + destination type. + + \ingroup modfunv2v convert + */ template <unsigned n> struct rgb_to_int_u : Function_v2v< rgb_to_int_u<n> > { diff --git a/milena/mln/fun/v2v/rgb_to_luma.hh b/milena/mln/fun/v2v/rgb_to_luma.hh index 304a798..92c603a 100644 --- a/milena/mln/fun/v2v/rgb_to_luma.hh +++ b/milena/mln/fun/v2v/rgb_to_luma.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -23,6 +24,10 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. +/// \file +/// +/// \brief Conversion function from value::rgb to integer value type. + #ifndef MLN_FUN_V2V_RGB_TO_LUMA_HH # define MLN_FUN_V2V_RGB_TO_LUMA_HH @@ -37,6 +42,12 @@ namespace mln namespace v2v { + /*! + \brief Conversion function from a RGB value to an integer + value type. + + \ingroup modfunv2v convert + */ template <typename T_luma> struct rgb_to_luma : public Function_v2v< rgb_to_luma<T_luma> > { -- 1.7.2.5