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
discards e6d70f78a13acfa65347e229ef04bdceb2a87f39 (commit)
discards 0469218d0e308d737baf56a1411993ef220b9c66 (commit)
discards abe7da9fbe85dbde5b55475a3efbf841bf2e0dbe (commit)
discards 0df50239629154b1764e5913eca0a4957b3fe8c1 (commit)
discards f3f7fa20ca15d18317fd31daf7e13efe88f02a45 (commit)
discards 64752940c947d09ef82306107adde7e9d6f33cda (commit)
via ea3a438edd681ee2c2d9d864b4cb9b80d3c5c867 (commit)
via b2a998874f37d267f32ebb987eb1719fd5c2ebcb (commit)
via 4f717cc024f5c959d509d24343a1d4e03ab08bbd (commit)
via 602fc924083865cbe104660c0f724added5ed48f (commit)
via f73de90629e04d201f470cd438ba7842275d5b90 (commit)
via 0167ba81a2e5cdd0d9b88488a46b068dd0a8eb68 (commit)
via 37c9012be49ccb3517c887d0a9e42f973fbe19df (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (e6d70f78a13acfa65347e229ef04bdceb2a87f39)
\
N -- N -- N (ea3a438edd681ee2c2d9d864b4cb9b80d3c5c867)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
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 -----------------------------------------------------------------
ea3a438 mln/core/concept/function.hh: Document function interface for each concept.
b2a9988 Kill Doxygen warnings.
4f717cc Specify conversion formulas for rgb to integer conversion functions.
602fc92 Create sub-modules in image geometry module.
f73de90 doc/mln/convert.dox: Fix typos.
0167ba8 Add documentation about image conversions.
37c9012 mln/data/convert.hh: Introduce a new overload taking a conversion function as parameter.
-----------------------------------------------------------------------
Summary of changes:
milena/ChangeLog | 5 +++++
1 files changed, 5 insertions(+), 0 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 | 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(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>
+
* 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
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/upscale has been created
at 9ab50d8e723ac787402dd898ecf3c33a02332bd5 (commit)
- Log -----------------------------------------------------------------
9ab50d8 milena/mln/upscaling/upscaling_bicubic_2x.hh: Add function to upscale x2 with bicubic interpolation.
-----------------------------------------------------------------------
hooks/post-receive
--
Olena, a generic and efficient image processing platform
---
milena/mln/upscaling/upscaling_bicubic_2x.hh | 145 ++++++++++++++++++++++++++
1 files changed, 145 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/upscaling/upscaling_bicubic_2x.hh
diff --git a/milena/mln/upscaling/upscaling_bicubic_2x.hh b/milena/mln/upscaling/upscaling_bicubic_2x.hh
new file mode 100644
index 0000000..67ed639
--- /dev/null
+++ b/milena/mln/upscaling/upscaling_bicubic_2x.hh
@@ -0,0 +1,145 @@
+// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_UPSCALING_UPSCALE_BICUBIC_2X_HH
+#define MLN_UPSCALING_UPSCALE_BICUBIC_2X_HH
+
+#include <mln/core/image/image2d.hh>
+
+
+/// \file
+///
+/// \brief upscale image x2 with bicubic interpolation.
+
+namespace mln {
+
+ namespace upscaling {
+
+ /**
+ \tparam image_in_ the input image (not modified by the algorithm).
+
+ \return An upscaled x2 image.
+
+ \author J. Fabrizio.
+ */
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_x2_fastest(const Image<I>& in_image_);
+
+#ifndef MLN_INCLUDE_ONLY
+
+ namespace impl {
+
+ template<typename V>
+ inline V tl_bicubic_interpol(const V& v0, const V& v1, const V& v2, const V& v3) {
+ double P = (v3 - v2) - (v0 - v1);
+ double Q = (v0 - v1) - P;
+ double R = v2 - v0;
+ double S = v1;
+ double result = round(P * 0.125 + Q * 0.25 + R * 0.5 + S);
+ result = (result < 0) ? 0 : result;
+ result = (result > mln_max(V)) ? (double) mln_max(V) : result;
+ return (V) result;
+ }
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_x2_fastest(const Image<I>& in_image_) {
+
+ mln_trace("upscaling::upscaling_bicubic_x2");
+ const I& in_image = exact(in_image_);
+ mln_precondition(in_image.is_valid());
+ mln_domain(I) ext_domain(in_image.domain().pmin() * 2,
+ in_image.domain().pmax() * 2);
+ mln_concrete(I) output(ext_domain);
+ data::fill(output, 0);
+
+ mln_concrete(I) tmp;
+ initialize(tmp, in_image);
+ data::fill(tmp, 0);
+
+ int x, y, k, l;
+
+ for (def::coord row = 1; row < in_image.nrows(); ++row)
+ for (def::coord col = 1; col < in_image.ncols(); ++col) {
+ opt::at(tmp, row, col) = tl_bicubic_interpol(in_image(point2d(row, col - 1)), in_image(point2d(row, col)), in_image(point2d(row, col + 1)), in_image(point2d(row, col + 2)));
+ }
+
+ for (def::coord row = 1, k = 1; row < in_image.nrows(); row++, k += 2)
+ for (def::coord col = 1, l = 1; col < in_image.ncols(); col++, l += 2) {
+ opt::at(output, k, l) = in_image(point2d(row, col));
+ opt::at(output, k + 1, l) = tmp(point2d(row, col));
+ opt::at(output, k, l + 1) = tl_bicubic_interpol(in_image(point2d(row - 1, col)), in_image(point2d(row, col)), in_image(point2d(row + 1, col)), in_image(point2d(row + 2, col)));
+ opt::at(output, k + 1, l + 1) = tl_bicubic_interpol(tmp(point2d(row - 1, col)), tmp(point2d(row, col)), tmp(point2d(row + 1, col)), tmp(point2d(row + 2, col)));
+ }
+
+ return output;
+ }
+
+ }// end of namespace mln::upscaling::impl
+
+
+ namespace internal {
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_dispatch(const Image<I>& in_image_
+ , mln::trait::image::speed::any) {
+ mlc_abort(I)::check();
+ }
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_dispatch(const Image<I>& in_image_,
+ mln::trait::image::speed::fastest) {
+ return mln::upscaling::impl::upscale_bicubic_x2_fastest(in_image_);
+ }
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_dispatch(const Image<I>& in_image_) {
+ return upscale_bicubic_dispatch(in_image_,
+ mln_trait_image_speed(I)());
+ }
+
+ }//end of namespace namespace mln::binarization::internal
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_x2_fastest(const Image<I>& in_image_) {
+ const I& ima = exact(in_image_);
+ return mln::upscaling::internal::upscale_bicubic_dispatch(ima);
+ }
+
+
+
+#endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::upscaling
+
+
+} // end of namespace mln
+
+#endif // ! MLN_UPSCALING_UPSCALE_BICUBIC_2X_HH
--
1.7.2.5
---
milena/mln/upscaling/upscaling_bicubic_2x.hh | 145 ++++++++++++++++++++++++++
1 files changed, 145 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/upscaling/upscaling_bicubic_2x.hh
diff --git a/milena/mln/upscaling/upscaling_bicubic_2x.hh b/milena/mln/upscaling/upscaling_bicubic_2x.hh
new file mode 100644
index 0000000..67ed639
--- /dev/null
+++ b/milena/mln/upscaling/upscaling_bicubic_2x.hh
@@ -0,0 +1,145 @@
+// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_UPSCALING_UPSCALE_BICUBIC_2X_HH
+#define MLN_UPSCALING_UPSCALE_BICUBIC_2X_HH
+
+#include <mln/core/image/image2d.hh>
+
+
+/// \file
+///
+/// \brief upscale image x2 with bicubic interpolation.
+
+namespace mln {
+
+ namespace upscaling {
+
+ /**
+ \tparam image_in_ the input image (not modified by the algorithm).
+
+ \return An upscaled x2 image.
+
+ \author J. Fabrizio.
+ */
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_x2_fastest(const Image<I>& in_image_);
+
+#ifndef MLN_INCLUDE_ONLY
+
+ namespace impl {
+
+ template<typename V>
+ inline V tl_bicubic_interpol(const V& v0, const V& v1, const V& v2, const V& v3) {
+ double P = (v3 - v2) - (v0 - v1);
+ double Q = (v0 - v1) - P;
+ double R = v2 - v0;
+ double S = v1;
+ double result = round(P * 0.125 + Q * 0.25 + R * 0.5 + S);
+ result = (result < 0) ? 0 : result;
+ result = (result > mln_max(V)) ? (double) mln_max(V) : result;
+ return (V) result;
+ }
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_x2_fastest(const Image<I>& in_image_) {
+
+ mln_trace("upscaling::upscaling_bicubic_x2");
+ const I& in_image = exact(in_image_);
+ mln_precondition(in_image.is_valid());
+ mln_domain(I) ext_domain(in_image.domain().pmin() * 2,
+ in_image.domain().pmax() * 2);
+ mln_concrete(I) output(ext_domain);
+ data::fill(output, 0);
+
+ mln_concrete(I) tmp;
+ initialize(tmp, in_image);
+ data::fill(tmp, 0);
+
+ int x, y, k, l;
+
+ for (def::coord row = 1; row < in_image.nrows(); ++row)
+ for (def::coord col = 1; col < in_image.ncols(); ++col) {
+ opt::at(tmp, row, col) = tl_bicubic_interpol(in_image(point2d(row, col - 1)), in_image(point2d(row, col)), in_image(point2d(row, col + 1)), in_image(point2d(row, col + 2)));
+ }
+
+ for (def::coord row = 1, k = 1; row < in_image.nrows(); row++, k += 2)
+ for (def::coord col = 1, l = 1; col < in_image.ncols(); col++, l += 2) {
+ opt::at(output, k, l) = in_image(point2d(row, col));
+ opt::at(output, k + 1, l) = tmp(point2d(row, col));
+ opt::at(output, k, l + 1) = tl_bicubic_interpol(in_image(point2d(row - 1, col)), in_image(point2d(row, col)), in_image(point2d(row + 1, col)), in_image(point2d(row + 2, col)));
+ opt::at(output, k + 1, l + 1) = tl_bicubic_interpol(tmp(point2d(row - 1, col)), tmp(point2d(row, col)), tmp(point2d(row + 1, col)), tmp(point2d(row + 2, col)));
+ }
+
+ return output;
+ }
+
+ }// end of namespace mln::upscaling::impl
+
+
+ namespace internal {
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_dispatch(const Image<I>& in_image_
+ , mln::trait::image::speed::any) {
+ mlc_abort(I)::check();
+ }
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_dispatch(const Image<I>& in_image_,
+ mln::trait::image::speed::fastest) {
+ return mln::upscaling::impl::upscale_bicubic_x2_fastest(in_image_);
+ }
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_dispatch(const Image<I>& in_image_) {
+ return upscale_bicubic_dispatch(in_image_,
+ mln_trait_image_speed(I)());
+ }
+
+ }//end of namespace namespace mln::binarization::internal
+
+ template<typename I>
+ mln_concrete(I)
+ upscale_bicubic_x2_fastest(const Image<I>& in_image_) {
+ const I& ima = exact(in_image_);
+ return mln::upscaling::internal::upscale_bicubic_dispatch(ima);
+ }
+
+
+
+#endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::upscaling
+
+
+} // end of namespace mln
+
+#endif // ! MLN_UPSCALING_UPSCALE_BICUBIC_2X_HH
--
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/TL has been updated
via b25251523bbcbc79cba19cd0c413821b83db4b1f (commit)
via 47b72ac7490d216d57bd741ee307e5e71b0ae908 (commit)
via fc5725233277b23ea1f1d5f9bfcf7aad4e286784 (commit)
via 15df2972abb572db54e3ca12773dfe323433a245 (commit)
from 67a45dad80adf097fd6b02e78b0f96e1009dce38 (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 -----------------------------------------------------------------
b252515 Merge branch 'exp/image2d-ffmpeg' into exp/TL
-----------------------------------------------------------------------
Summary of changes:
milena/mln/core/image/image2d_ffmpeg.hh | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform