---
milena/ChangeLog | 4 ++++
milena/doc/mln/convert.dox | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 86129ef..6c8c7c7 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,9 @@
2013-04-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * doc/mln/convert.dox: Fix typos.
+
+2013-04-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add documentation about image conversions.
* doc/mln/convert.dox: Add examples and explanations.
diff --git a/milena/doc/mln/convert.dox b/milena/doc/mln/convert.dox
index 158fb43..60319fd 100644
--- a/milena/doc/mln/convert.dox
+++ b/milena/doc/mln/convert.dox
@@ -5,7 +5,7 @@
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
+ 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.
@@ -47,7 +47,7 @@
\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> >’
+ /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
@@ -114,7 +114,7 @@
\endcode
- If a program requires conversions that are not provided by default
+ 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.
--
1.7.2.5
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/newdoc has been updated
via 64752940c947d09ef82306107adde7e9d6f33cda (commit)
from a8d117672fb512482f7a098499a41e99a53fa445 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
6475294 Add documentation about image conversions.
-----------------------------------------------------------------------
Summary of changes:
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 | 38 +++++++-
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, 460 insertions(+), 74 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform
* 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 | 38 +++++++-
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, 460 insertions(+), 74 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 3f29bbc..b1cba37 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,29 @@
2013-04-19 Guillaume Lazzara <z(a)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(a)lrde.epita.fr>
+
Add references to from_to_ overloads in documentation.
* mln/algebra/h_mat.hh,
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 260baac..2c2a4f0 100644
--- a/milena/mln/data/convert.hh
+++ b/milena/mln/data/convert.hh
@@ -45,16 +45,32 @@ 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)
convert(const V& v, const Image<I>& input);
+ /*!
+ \brief Convert the image \p input by changing the value type.
+ \overload
+
+ This overload allows to specify a specific conversion function
+ thanks to parameter \p convert_function.
+
+ \ingroup mlndata convert
+ */
+ template <typename F, typename I>
+ mln_ch_value(I, mln_result(F))
+ convert(const Function_v2v<F>& convert_function, const Image<I>& input);
# ifndef MLN_INCLUDE_ONLY
@@ -163,6 +179,18 @@ namespace mln
return output;
}
+ template <typename F, typename I>
+ mln_ch_value(I, mln_result(F))
+ convert(const Function_v2v<F>& convert_function, const Image<I>& input)
+ {
+ mln_trace("data::convert");
+ typedef mln_result(F) V;
+ internal::convert_tests(V(), input);
+
+ mln_ch_value(I, V) output = data::transform(input, convert_function);
+
+ return output;
+ }
# endif // ! MLN_INCLUDE_ONLY
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
* doc/examples/split/tuto3_rw_image-3.cc.raw,
* doc/examples/split/tuto3_rw_image-4.cc.raw,
* doc/examples/split/tuto3_rw_image-5.cc.raw,
* doc/examples/split/tuto3_rw_image-6.cc.raw,
* doc/examples/split/tuto3_rw_image-7.cc.raw,
* doc/examples/split/tuto3_rw_image-8.cc.raw: Regen.
* doc/examples/tuto3_rw_image.cc: Add an example with iterators.
* doc/tutorial.tex: Add more explanations on iterators.
---
milena/ChangeLog | 15 +++++++++
milena/doc/examples/split/tuto3_rw_image-3.cc.raw | 6 ++--
milena/doc/examples/split/tuto3_rw_image-4.cc.raw | 2 +-
milena/doc/examples/split/tuto3_rw_image-5.cc.raw | 5 ++-
milena/doc/examples/split/tuto3_rw_image-6.cc.raw | 3 +-
milena/doc/examples/split/tuto3_rw_image-7.cc.raw | 2 +-
...3_rw_image-7.cc.raw => tuto3_rw_image-8.cc.raw} | 0
milena/doc/examples/tuto3_rw_image.cc | 6 ++++
milena/doc/tutorial.tex | 31 ++++++++++++-------
9 files changed, 50 insertions(+), 20 deletions(-)
copy milena/doc/examples/split/{tuto3_rw_image-7.cc.raw => tuto3_rw_image-8.cc.raw} (100%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index c4a23a0..6c15ccc 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,20 @@
2013-04-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Explain how to iterate over an image in tutorial.
+
+ * doc/examples/split/tuto3_rw_image-3.cc.raw,
+ * doc/examples/split/tuto3_rw_image-4.cc.raw,
+ * doc/examples/split/tuto3_rw_image-5.cc.raw,
+ * doc/examples/split/tuto3_rw_image-6.cc.raw,
+ * doc/examples/split/tuto3_rw_image-7.cc.raw,
+ * doc/examples/split/tuto3_rw_image-8.cc.raw: Regen.
+
+ * doc/examples/tuto3_rw_image.cc: Add an example with iterators.
+
+ * doc/tutorial.tex: Add more explanations on iterators.
+
+2013-04-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Introduce image transformation module in documentation.
* doc/mln/main.dox: Create new group.
diff --git a/milena/doc/examples/split/tuto3_rw_image-3.cc.raw b/milena/doc/examples/split/tuto3_rw_image-3.cc.raw
index f25ab40..88b5a64 100644
--- a/milena/doc/examples/split/tuto3_rw_image-3.cc.raw
+++ b/milena/doc/examples/split/tuto3_rw_image-3.cc.raw
@@ -1,3 +1,3 @@
- for (def::coord row = 20; row < 30; ++row)
- for (def::coord col = 20; col < 30; ++col)
- ima(point2d(row, col)) = literal::blue;
+ mln_piter(image2d<value::rgb8>) p(ima.domain());
+ for_all(p)
+ ima(p) = literal::red;
diff --git a/milena/doc/examples/split/tuto3_rw_image-4.cc.raw b/milena/doc/examples/split/tuto3_rw_image-4.cc.raw
index 06559c5..f25ab40 100644
--- a/milena/doc/examples/split/tuto3_rw_image-4.cc.raw
+++ b/milena/doc/examples/split/tuto3_rw_image-4.cc.raw
@@ -1,3 +1,3 @@
for (def::coord row = 20; row < 30; ++row)
for (def::coord col = 20; col < 30; ++col)
- opt::at(ima, row, col) = literal::blue;
+ ima(point2d(row, col)) = literal::blue;
diff --git a/milena/doc/examples/split/tuto3_rw_image-5.cc.raw b/milena/doc/examples/split/tuto3_rw_image-5.cc.raw
index d98037c..06559c5 100644
--- a/milena/doc/examples/split/tuto3_rw_image-5.cc.raw
+++ b/milena/doc/examples/split/tuto3_rw_image-5.cc.raw
@@ -1,2 +1,3 @@
- image2d<value::rgb8> lena;
- io::ppm::load(lena, MLN_IMG_DIR "/small.ppm");
+ for (def::coord row = 20; row < 30; ++row)
+ for (def::coord col = 20; col < 30; ++col)
+ opt::at(ima, row, col) = literal::blue;
diff --git a/milena/doc/examples/split/tuto3_rw_image-6.cc.raw b/milena/doc/examples/split/tuto3_rw_image-6.cc.raw
index 10eb29f..d98037c 100644
--- a/milena/doc/examples/split/tuto3_rw_image-6.cc.raw
+++ b/milena/doc/examples/split/tuto3_rw_image-6.cc.raw
@@ -1 +1,2 @@
- data::fill(ima, lena);
+ image2d<value::rgb8> lena;
+ io::ppm::load(lena, MLN_IMG_DIR "/small.ppm");
diff --git a/milena/doc/examples/split/tuto3_rw_image-7.cc.raw b/milena/doc/examples/split/tuto3_rw_image-7.cc.raw
index d362105..10eb29f 100644
--- a/milena/doc/examples/split/tuto3_rw_image-7.cc.raw
+++ b/milena/doc/examples/split/tuto3_rw_image-7.cc.raw
@@ -1 +1 @@
- data::paste(ima, lena);
+ data::fill(ima, lena);
diff --git a/milena/doc/examples/split/tuto3_rw_image-7.cc.raw b/milena/doc/examples/split/tuto3_rw_image-8.cc.raw
similarity index 100%
copy from milena/doc/examples/split/tuto3_rw_image-7.cc.raw
copy to milena/doc/examples/split/tuto3_rw_image-8.cc.raw
diff --git a/milena/doc/examples/tuto3_rw_image.cc b/milena/doc/examples/tuto3_rw_image.cc
index 14ba056..6e84f32 100644
--- a/milena/doc/examples/tuto3_rw_image.cc
+++ b/milena/doc/examples/tuto3_rw_image.cc
@@ -49,6 +49,12 @@ int main()
// \}
// \{
+ mln_piter(image2d<value::rgb8>) p(ima.domain());
+ for_all(p)
+ ima(p) = literal::red;
+ // \}
+
+ // \{
for (def::coord row = 20; row < 30; ++row)
for (def::coord col = 20; col < 30; ++col)
ima(point2d(row, col)) = literal::blue;
diff --git a/milena/doc/tutorial.tex b/milena/doc/tutorial.tex
index e67a9da..3e016ed 100644
--- a/milena/doc/tutorial.tex
+++ b/milena/doc/tutorial.tex
@@ -1474,13 +1474,20 @@ After this step you should know how to:
First create an empty color image with a \var{box2d} of 40x40 as domain.
\doxycode[1]{tuto3_rw_image}
-If you want to initialize the image with the color red, simply call data::fill as follows:
+If you want to initialize the image with the color red, you can
+iterate over all the image pixels using iterators:
+\doxycode[3]{tuto3_rw_image}
+
+Or simply call data::fill as follows:
\doxycode[2]{tuto3_rw_image}
-Updating a site value is also possible using \code{operator()} or the
-\code{opt::at()} routine. Here we create a blue square of 10x10 pixels from site
-(20, 20) to (30, 30).
-\doxycode[3]{tuto3_rw_image}
+Updating a site value is also possible using the \code{opt::at()}
+routine. Here we create a blue square of 10x10 pixels from site (20,
+20) to (30, 30).
+\doxycode[5]{tuto3_rw_image}
+
+The following code with image2d::operator() is also possible but may
+be slower because of the creation of a point2d.
\doxycode[4]{tuto3_rw_image}
The corresponding image: \\
@@ -1489,27 +1496,27 @@ The corresponding image: \\
An image can also be initialized/modified thanks to another image.
Let's load a new image.
-\doxycode[5]{tuto3_rw_image}
+\doxycode[6]{tuto3_rw_image}
\var{lena} looks like: \\
\doxyimg{small-enlarged}{3cm}
If we want to initialize \var{ima} with \var{lena}, we can use \code{data::fill}:
-\doxycode[6]{tuto3_rw_image}
+\doxycode[7]{tuto3_rw_image}
Output: \\
\doxyfigure[2]{tuto3_rw_image}{3cm} \\
-Note that to fill an image with some data, the image domain \must be smaller
-or equal to the data.
+Note that to fill an image with some data, the image domain \must be
+smaller or equal to the data.
Likewise, it is possible to paste data from an image to another:
-\doxycode[7]{tuto3_rw_image}
+\doxycode[8]{tuto3_rw_image}
Output: \\
\doxyfigure[3]{tuto3_rw_image}{3cm}
-More details can be found in sections \doxyref{imaaccessmodval}, \doxyref{fillop} and \doxyref{pasteop} in
-the reference guide.
+More details can be found in sections \doxyref{imaaccessmodval},
+\doxyref{fillop} and \doxyref{pasteop} in the reference guide.
\vspace{2cm}
\begin{center}
--
1.7.2.5
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/newdoc has been updated
via 61eb85aae63899be7b13c45c08e022bb6cd223ac (commit)
from b14fad47f31cd31e47452c2997c4e80377eb7669 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
61eb85a Introduce image transformation module in documentation.
-----------------------------------------------------------------------
Summary of changes:
milena/ChangeLog | 17 +++++++++++++++++
milena/doc/mln/main.dox | 7 +++++++
milena/mln/geom/crop.hh | 6 +++---
milena/mln/geom/crop_without_localization.hh | 6 +++---
milena/mln/geom/horizontal_symmetry.hh | 6 +++---
milena/mln/geom/rotate.hh | 10 +++++-----
milena/mln/geom/translate.hh | 8 ++++----
milena/mln/geom/vertical_symmetry.hh | 6 +++---
milena/mln/registration/icp.hh | 3 +++
milena/mln/subsampling/antialiased.hh | 12 ++++++++++--
milena/mln/upscaling/art/scale2x.hh | 6 +++---
milena/mln/upscaling/art/scale3x.hh | 6 +++---
12 files changed, 64 insertions(+), 29 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform