* green/mln/accu/stat/histo1d.hh: New header component.
* green/mln/fun/p2b/achromatic.hh: New header component.
* green/mln/fun/p2b/component_equals.hh: New header component.
* green/mln/fun/v2v/achromatism.hh: New header component.
* green/mln/fun/v2v/hue_concentration.hh: New header component.
* green/mln/fun/v2v/rgb_to_achromatism_map.hh: New header component.
* green/mln/fun/v2v/rgb_to_hsv.hh: New header component.
* green/mln/fun/v2v/rgb_to_hue_map.hh: New header component.
* green/mln/fun/v2v/rgb_to_saturation_map.hh: New header component.
* green/mln/fun/v2v/rgb_to_value_map.hh: New header component.
* green/mln/img_path.hh: New header component.
* green/mln/math/ceil.hh: New header component.
* green/mln/math/floor.hh: New header component.
* green/mln/math/hsv.hh: New header component.
---
milena/sandbox/ChangeLog | 32 ++-
milena/sandbox/green/mln/accu/stat/histo1d.hh | 66 ++--
milena/sandbox/green/mln/fun/p2b/achromatic.hh | 112 +++++
.../sandbox/green/mln/fun/p2b/component_equals.hh | 99 +++++
milena/sandbox/green/mln/fun/v2v/achromatism.hh | 64 +++
.../sandbox/green/mln/fun/v2v/hue_concentration.hh | 100 +++++
.../green/mln/fun/v2v/rgb_to_achromatism_map.hh | 77 ++++
milena/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh | 149 +++++++
milena/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh | 96 +++++
.../green/mln/fun/v2v/rgb_to_saturation_map.hh | 83 ++++
.../sandbox/green/mln/fun/v2v/rgb_to_value_map.hh | 75 ++++
milena/sandbox/green/mln/img_path.hh | 227 +++++++++--
milena/sandbox/green/mln/math/ceil.hh | 64 +++
milena/sandbox/green/mln/math/floor.hh | 64 +++
milena/sandbox/green/mln/value/hsv.hh | 424 ++++++++++++++++++++
15 files changed, 1670 insertions(+), 62 deletions(-)
create mode 100644 milena/sandbox/green/mln/fun/p2b/achromatic.hh
create mode 100644 milena/sandbox/green/mln/fun/p2b/component_equals.hh
create mode 100644 milena/sandbox/green/mln/fun/v2v/achromatism.hh
create mode 100644 milena/sandbox/green/mln/fun/v2v/hue_concentration.hh
create mode 100644 milena/sandbox/green/mln/fun/v2v/rgb_to_achromatism_map.hh
create mode 100644 milena/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh
create mode 100644 milena/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh
create mode 100644 milena/sandbox/green/mln/fun/v2v/rgb_to_saturation_map.hh
create mode 100644 milena/sandbox/green/mln/fun/v2v/rgb_to_value_map.hh
create mode 100644 milena/sandbox/green/mln/math/ceil.hh
create mode 100644 milena/sandbox/green/mln/math/floor.hh
create mode 100644 milena/sandbox/green/mln/value/hsv.hh
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index c41ef7c..62c6e21 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,6 +1,36 @@
2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
- Work on Millet saturation descriptor.
+ Add milena library components.
+
+ * green/mln/accu/stat/histo1d.hh: New header component.
+ * green/mln/fun/p2b/achromatic.hh: New header component.
+ * green/mln/fun/p2b/component_equals.hh: New header component.
+ * green/mln/fun/v2v/achromatism.hh: New header component.
+ * green/mln/fun/v2v/hue_concentration.hh: New header component.
+ * green/mln/fun/v2v/rgb_to_achromatism_map.hh: New header component.
+ * green/mln/fun/v2v/rgb_to_hsv.hh: New header component.
+ * green/mln/fun/v2v/rgb_to_hue_map.hh: New header component.
+ * green/mln/fun/v2v/rgb_to_saturation_map.hh: New header component.
+ * green/mln/fun/v2v/rgb_to_value_map.hh: New header component.
+ * green/mln/img_path.hh: New header component.
+ * green/mln/math/ceil.hh: New header component.
+ * green/mln/math/floor.hh: New header component.
+ * green/mln/math/hsv.hh: New header component.
+
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Work on Millet value descriptor.
+
+ * green/exp/annotating/value: New directory.
+ * green/exp/annotating/value/Makefile.am: New Makefile.
+ * green/exp/annotating/value/value.cc: New source file.
+ * green/exp/annotating/value/text-color.txt: New image class.
+ * green/exp/annotating/value/text-img.txt: New image class.
+ * green/exp/annotating/value/text-only.txt: New image class.
+
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Work on Millet hue descriptor.
* green/exp/annotating/hue: New directory.
* green/exp/annotating/hue/Makefile.am: New Makefile.
diff --git a/milena/sandbox/green/mln/accu/stat/histo1d.hh
b/milena/sandbox/green/mln/accu/stat/histo1d.hh
index 807f3bd..57d6103 100644
--- a/milena/sandbox/green/mln/accu/stat/histo1d.hh
+++ b/milena/sandbox/green/mln/accu/stat/histo1d.hh
@@ -76,26 +76,26 @@
namespace mln
{
-
+
namespace accu
{
-
+
namespace stat
{
-
+
// Forward declaration
template <typename V>
struct histo1d;
} // end of namespace mln::accu::stat
-
+
namespace meta
{
-
+
namespace stat
{
-
+
struct histo1d : public Meta_Accumulator<histo1d>
{
template <typename V>
@@ -104,16 +104,16 @@ namespace mln
typedef accu::stat::histo1d<V> ret;
};
};
-
+
} // end of namespace mln::accu::meta::stat
-
+
} // end of namespace mln::accu::meta
-
+
} // end of namespace mln::accu
namespace trait
{
-
+
template <typename V>
struct accumulator_< mln::accu::stat::histo1d<V> >
{
@@ -124,34 +124,34 @@ namespace mln
};
template <typename V>
- struct set_precise_binary_<op::eq,
+ struct set_precise_binary_<op::eq,
accu::stat::histo1d<V>,
accu::stat::histo1d<V> >
{
typedef bool ret;
};
-
+
} // end of namespace mln::trait
namespace accu
{
-
+
namespace stat
- {
+ {
- /// \brief Define an histogram which returns an image1d .
+ /// \brief Define an histogram which returns an image1d .
///
/// Param V defines the space in which we count the values.
/// For instance, this histogram works with image2d<int_u8> or with
/// image1d<int_u<14> >. The histogram count the occurrence of each
value.
/// The number of bins depends of the graylevel values, for 8 bits there
- /// is 256 bins, for 14 bits there is 16384 bins. Note that over
+ /// is 256 bins, for 14 bits there is 16384 bins. Note that over
/// quantification works too (up to 14 bits).
///
/// \ingroup modaccuvalues
template <typename V>
- struct histo1d :
+ struct histo1d :
public mln::accu::internal::base<image1d<unsigned>, histo1d<V> >
{
typedef V argument;
@@ -162,22 +162,22 @@ namespace mln
/// \{
/// \brief Initialize the size of the resulting image1d.
///
- /// Initialize the size the resulting image from the theorical dynamic
+ /// Initialize the size the resulting image from the theorical dynamic
/// of the graylevel values (Use V to manage it).
histo1d();
/// \}
-
+
/// Manipulators.
/// \{
/// \brief Initialize the histogram with zero value.
///
- /// This method must be called just before starting the use of the
- /// histogram. If it's not, resulting values won't converge to the
+ /// This method must be called just before starting the use of the
+ /// histogram. If it's not, resulting values won't converge to the
/// density.
void init();
-
+
/// \brief Update the histogram with the graylevel of the pixel t.
/// \param[in] t a graylevel pixel of type V.
///
@@ -189,7 +189,7 @@ namespace mln
/// \brief Update the histogram with an other histogram.
/// \param[in] other the other histogram.
///
- /// The end user shouldn't call this method. This is part of
+ /// The end user shouldn't call this method. This is part of
/// data compute interface mechanism.
void take(const histo1d<V>& other);
@@ -234,7 +234,7 @@ namespace mln
typedef mln_trait_value_comp(V,0) comp;
typedef point<grid::tick, V> v_point1d;
typedef box<v_point1d> v_box1d;
-
+
// comp keep a trace of the dimension of the theorical image.
// mln_min(comp) --> 0
// mln_max(comp) --> 2^(n-1) [127 for n=7][255 for n=8] ...
@@ -242,8 +242,8 @@ namespace mln
count_.init_(box1d(point1d(mln_min(comp)),
point1d(mln_max(comp))));
- // std::cout << "min : " << mln_min(comp) << std::endl;
- // std::cout << "max : " << mln_max(comp) << std::endl;
+// std::cout << "min : " << mln_min(comp) << std::endl;
+// std::cout << "max : " << mln_max(comp) << std::endl;
trace::exiting("mln::accu::stat::histo1d<V>::histo1d");
}
@@ -264,14 +264,14 @@ namespace mln
{
trace::entering("mln::accu::stat::histo1d<V>::take");
- // Just convert a graylevel value (int_u8 like) to a position for an
+ // Just convert a graylevel value (int_u8 like) to a position for an
// iterator on the resulting image.
++count_(point1d(t));
trace::exiting("mln::accu::stat::histo1d<V>::take");
}
-
+
template <typename V>
inline
void histo1d<V>::take(const histo1d<V>& other)
@@ -282,7 +282,7 @@ namespace mln
trace::exiting("mln::accu::stat::histo1d<V>::take");
}
-
+
template <typename V>
inline
typename histo1d<V>::result histo1d<V>::to_result() const
@@ -292,7 +292,7 @@ namespace mln
trace::exiting("mln::accu::stat::histo1d<V>::to_result");
return count_;
}
-
+
template <typename V>
inline
histo1d<V>::operator result() const
@@ -301,7 +301,7 @@ namespace mln
trace::exiting("mln::accu::stat::histo1d<V>::operator result");
return count_;
- }
+ }
template <typename V>
inline
@@ -309,7 +309,7 @@ namespace mln
{
trace::entering("mln::accu::stat::histo1d<V>::is_valid");
bool result = count_.is_valid();
-
+
trace::exiting("mln::accu::stat::histo1d<V>::is_valid");
return result;
}
@@ -322,7 +322,7 @@ namespace mln
bool result = true;
const image1d<unsigned>& res1 = histo1.to_result();
const image1d<unsigned>& res2 = histo2.to_result();
-
+
mln_precondition(res1.is_valid());
mln_precondition(res2.is_valid());
diff --git a/milena/sandbox/green/mln/fun/p2b/achromatic.hh
b/milena/sandbox/green/mln/fun/p2b/achromatic.hh
new file mode 100644
index 0000000..1f45b2d
--- /dev/null
+++ b/milena/sandbox/green/mln/fun/p2b/achromatic.hh
@@ -0,0 +1,112 @@
+// Copyright (C) 2008, 2009 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_FUN_P2B_ACHROMATIC_HH
+# define MLN_FUN_P2B_ACHROMATIC_HH
+
+/// \file
+///
+/// In the vectorial image context (as RGB, HSL, HSV), compare one component
+/// to a specific value.
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/core/concept/function.hh>
+# include <mln/trait/value/comp.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace p2b
+ {
+ /// \brief Functor that compare the i-th component of a value.
+ // V is for the type of the value received
+ // i is the ith component to select
+ template <typename T_rgb>
+ struct achromatic : public Function_v2b< achromatic<T_rgb> >
+ {
+ typedef bool result;
+ bool operator()(const point2d& p) const;
+
+ achromatic(const image2d<T_rgb>& img, const float threshold);
+
+ const float threshold_;
+ const image2d<T_rgb>& img_;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T_rgb>
+ achromatic<T_rgb>::achromatic(const image2d<T_rgb>& img,
+ const float threshold)
+ : threshold_(threshold), img_(img)
+ {
+ }
+
+ template <typename T_rgb>
+ bool achromatic<T_rgb>::operator()(const point2d& p) const
+ {
+ typedef typename T_rgb::red_t t_red;
+ typedef typename T_rgb::green_t t_green;
+ typedef typename T_rgb::blue_t t_blue;
+
+ const T_rgb rgb = img_(p);
+
+ // To obtain red between 0 and 1
+ const float max_red = mln_max(t_red);
+ const float min_red = mln_min(t_red);
+ const float red = (rgb.red() - min_red)/(max_red - min_red);
+
+ // To obtain green between 0 and 1
+ const float max_green = mln_max(t_green);
+ const float min_green = mln_min(t_green);
+ const float green = (rgb.green()-min_green)/(max_green-min_green);
+
+ // To obtain blue between 0 and 1
+ const float max_blue = mln_max(t_blue);
+ const float min_blue = mln_min(t_blue);
+ const float blue = (rgb.blue()-min_blue)/(max_blue-min_blue);
+
+ bool result = (threshold_ > math::abs(red - green) &&
+ threshold_ > math::abs(red - blue) &&
+ threshold_ > math::abs(green - blue));
+
+ return result;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::p2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_P2B_ACHROMATIC_HH
diff --git a/milena/sandbox/green/mln/fun/p2b/component_equals.hh
b/milena/sandbox/green/mln/fun/p2b/component_equals.hh
new file mode 100644
index 0000000..2a4c62c
--- /dev/null
+++ b/milena/sandbox/green/mln/fun/p2b/component_equals.hh
@@ -0,0 +1,99 @@
+// Copyright (C) 2008, 2009 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_FUN_P2B_COMPONENT_EQUALS_HH
+# define MLN_FUN_P2B_COMPONENT_EQUALS_HH
+
+/// \file
+///
+/// In the vectorial image context (as RGB, HSL, HSV), compare one component
+/// to a specific value.
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/core/concept/function.hh>
+# include <mln/trait/value/comp.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace p2b
+ {
+
+ /// \brief Functor that compare the i-th component of a value.
+ // V is for the type of the value received
+ // i is the ith component to select
+ template <typename I, unsigned i>
+ struct component_equals : public Function_v2b< component_equals<I,i> >
+ {
+ typedef bool result;
+ bool operator()(const point2d& p) const;
+
+ component_equals(const I& img,
+ const mln_trait_value_comp(mln_value(I),i)& ref);
+
+ const mln_trait_value_comp(mln_value(I),i) _ref;
+ const I& _img;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, unsigned i>
+ inline
+ component_equals<I,i>::
+ component_equals(const I& img,
+ const mln_trait_value_comp(mln_value(I),i)& ref)
+ : _ref(ref), _img(img)
+ {
+ }
+
+ template <typename I, unsigned i>
+ inline
+ bool
+ component_equals<I,i>::operator()(const point2d& p) const
+ {
+ typedef mln_value(I) t_value;
+ typedef mln_trait_value_comp(t_value,i) mln_value_comp;
+
+ t_value v = _img(p);
+ mln_value_comp c = trait::value::internal::comp<t_value,i>::on(v);
+
+ return (c == _ref);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::p2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_P2B_COMPONENT_EQUALS_HH
diff --git a/milena/sandbox/green/mln/fun/v2v/achromatism.hh
b/milena/sandbox/green/mln/fun/v2v/achromatism.hh
new file mode 100644
index 0000000..72b545c
--- /dev/null
+++ b/milena/sandbox/green/mln/fun/v2v/achromatism.hh
@@ -0,0 +1,64 @@
+// Copyright (C) 2008, 2009 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_FUN_V2V_ACHROMATISM_HH
+# define MLN_FUN_V2V_ACHROMATISM_HH
+
+# include <mln/value/rgb8.hh>
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ struct achromatism : public Function_v2v< achromatism >
+ {
+ typedef float result;
+
+ float operator()(const value::rgb8 rgb) const;
+ };
+
+# ifndef MLN_INCLUDE_ONLY
+
+ float achromatism::operator()(const value::rgb8 rgb) const
+ {
+ return (math::abs(rgb.red() - rgb.green())
+ + math::abs(rgb.red() - rgb.blue())
+ + math::abs(rgb.green() - rgb.blue()))/3.0;
+ }
+
+# endif // !MLN_INCLUDE_ONLY
+
+ } // end of namespace fun::v2v
+
+ } // end of namespace fun
+
+} // end of namespace mln
+
+#endif // ! MLN_FUN_V2V_ACHROMATISM_HH
diff --git a/milena/sandbox/green/mln/fun/v2v/hue_concentration.hh
b/milena/sandbox/green/mln/fun/v2v/hue_concentration.hh
new file mode 100644
index 0000000..84d26c8
--- /dev/null
+++ b/milena/sandbox/green/mln/fun/v2v/hue_concentration.hh
@@ -0,0 +1,100 @@
+// Copyright (C) 2008, 2009 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_FUN_V2V_HUE_CONCENTRATION_HH
+# define MLN_FUN_V2V_HUE_CONCENTRATION_HH
+
+# include <mln/core/image/image1d.hh>
+# include <mln/math/abs.hh>
+# include <mln/opt/at.hh>
+# include <mln/value/hsv.hh>
+# include <mln/value/rgb8.hh>
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ unsigned peak_histo(const mln::image1d<unsigned>& hue_histo);
+
+ struct hue_concentration : public Function_v2v< hue_concentration >
+ {
+ typedef float result;
+
+ float operator()(const float hue) const;
+
+ hue_concentration(const mln::image1d<unsigned>& hue_histo)
+ {
+ peak = peak_histo(hue_histo);
+ }
+
+ unsigned peak;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ unsigned peak_histo(const mln::image1d<unsigned>& hue_histo)
+ {
+ mln_precondition(hue_histo.is_valid());
+
+ // Find the peak of the histogram
+ unsigned v_max = mln::opt::at(hue_histo, 0);
+ short p_max = 0;
+
+ mln_piter_(mln::image1d<unsigned>) p(hue_histo.domain());
+
+ for_all(p)
+ {
+ if (v_max < hue_histo(p))
+ {
+ v_max = hue_histo(p);
+ p_max = p.ind();
+ }
+ }
+
+ return p_max;
+ }
+
+
+ float hue_concentration::operator()(float hue) const
+ {
+ return mln::math::abs(peak - hue);
+ }
+
+# endif // !MLN_INCLUDE_ONLY
+
+ } // end of namespace fun::v2v
+
+ } // end of namespace fun
+
+} // end of namespace mln
+
+#endif // ! MLN_FUN_V2V_HUE_CONCENTRATION_HH
diff --git a/milena/sandbox/green/mln/fun/v2v/rgb_to_achromatism_map.hh
b/milena/sandbox/green/mln/fun/v2v/rgb_to_achromatism_map.hh
new file mode 100644
index 0000000..6de63ec
--- /dev/null
+++ b/milena/sandbox/green/mln/fun/v2v/rgb_to_achromatism_map.hh
@@ -0,0 +1,77 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009 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_FUN_V2V_RGB_TO_ACHROMATISM_MAP_HH
+# define MLN_FUN_V2V_RGB_TO_ACHROMATISM_MAP_HH
+
+# include <mln/math/abs.hh>
+# include <mln/math/max.hh>
+
+# include <mln/value/rgb.hh>
+
+
+/// \file
+///
+/// \brief Convert rgb value to achromatism map.
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ /// \brief Convert rgb value to achromatism map.
+ ///
+ /// \ingroup modfunv2v
+
+ template <unsigned n>
+ struct rgb_to_achromatism_map :
+ Function_v2v< rgb_to_achromatism_map<n> >
+ {
+ typedef value::rgb<n> argument;
+ typedef value::int_u<n> result;
+
+ result operator()(const argument& v) const
+ {
+ result max = math::max(math::max(v.red(),v.green()),v.blue());
+ result min = math::min(math::min(v.red(),v.green()),v.blue());
+ result ret = max - min;
+
+ return ret;
+ }
+ };
+
+ } // end of namespace mln::fun::v2v
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+#endif // ! MLN_FUN_V2V_RGB_TO_ACHROMATISM_MAP_HH
diff --git a/milena/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh
b/milena/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh
new file mode 100644
index 0000000..3dd8eb0
--- /dev/null
+++ b/milena/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh
@@ -0,0 +1,149 @@
+// Copyright (C) 2008, 2009 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_FUN_V2V_RGB_TO_HSV_HH
+# define MLN_FUN_V2V_RGB_TO_HSV_HH
+
+#include <mln/math/max.hh>
+#include <mln/math/min.hh>
+
+#include <mln/trait/promote.hh>
+
+#include <mln/value/hsv.hh>
+#include <mln/value/rgb.hh>
+
+namespace mln
+{
+
+ namespace value
+ {
+ template <typename H, typename S, typename V> class hsv_;
+ typedef hsv_<float, float, float> hsv_f;
+ typedef hsv_<double, double, double> hsv_d;
+ template <unsigned n> struct rgb;
+ }
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ template <typename T_hsv>
+ struct f_rgb_to_hsv_ : public Function_v2v< f_rgb_to_hsv_<T_hsv> >
+ {
+ typedef T_hsv result;
+
+
+ /// HSV implementation from millet.2008.phd.pdf p67
+ template <typename T_rgb>
+ T_hsv operator()(const T_rgb& rgb) const;
+
+ };
+
+ typedef f_rgb_to_hsv_<value::hsv_f> f_rgb_to_hsv_f_t;
+
+ extern f_rgb_to_hsv_f_t f_rgb_to_hsv_f;
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ /// Global variables.
+ /// \{
+ f_rgb_to_hsv_f_t f_rgb_to_hsv_f;
+ /// \}
+
+
+ template <typename T_hsv>
+ template <typename T_rgb>
+ inline
+ T_hsv
+ f_rgb_to_hsv_<T_hsv>::operator()(const T_rgb& rgb) const
+ {
+ typedef typename T_rgb::red_t t_red;
+ typedef typename T_rgb::green_t t_green;
+ typedef typename T_rgb::blue_t t_blue;
+ typedef typename T_hsv::h_type t_hue;
+ typedef typename T_hsv::s_type t_sat;
+ typedef typename T_hsv::v_type t_val;
+ typedef mln_trait_promote(t_hue, t_sat) t_max_hue_sat;
+ typedef mln_trait_promote(t_max_hue_sat, t_val) t_max_hsv;
+
+ // To obtain red between 0 and 1
+ const t_max_hsv max_red = mln_max(t_red);
+ const t_max_hsv min_red = mln_min(t_red);
+ const t_max_hsv red = (rgb.red() - min_red)/(max_red - min_red);
+
+ // To obtain green between 0 and 1
+ const t_max_hsv max_green = mln_max(t_green);
+ const t_max_hsv min_green = mln_min(t_green);
+ const t_max_hsv green =(rgb.green()-min_green)/(max_green-min_green);
+
+ // To obtain blue between 0 and 1
+ const t_max_hsv max_blue = mln_max(t_blue);
+ const t_max_hsv min_blue = mln_min(t_blue);
+ const t_max_hsv blue = (rgb.blue()-min_blue)/(max_blue-min_blue);
+
+ const t_max_hsv max = math::max(red, math::max(green, blue));
+ const t_max_hsv min = math::min(red, math::min(green, blue));
+ const t_max_hsv max_minus_min = max-min;
+ const t_max_hsv s = 0.03;
+
+ // Locals.
+ T_hsv hsv;
+
+ // SPECIFIC CASE WHEN PIXEL IS ACHROMATIC
+ if (s > math::abs(red - blue) &&
+ s > math::abs(blue - red) &&
+ s > math::abs(red - green))
+ {
+ hsv.val() = (red + green + blue)/3.0;
+ hsv.sat() = 0.0;
+ hsv.hue() = -1.0;
+ }
+ else
+ {
+ hsv.val() = max;
+ hsv.sat() = max_minus_min / max;
+ if (max == red)
+ hsv.hue() = 60 * ((green - blue) / max_minus_min);
+ else if (max == green)
+ hsv.hue() = 60 * (2 + (blue - red) / max_minus_min);
+ else // (max == blue)
+ hsv.hue() = 60 * (4 + (red - green) / max_minus_min);
+ }
+ return hsv;
+ }
+
+
+# endif // !MLN_INCLUDE_ONLY
+
+ } // end of namespace fun::v2v
+
+ } // end of namespace fun
+
+} // end of namespace mln
+
+#endif // ! MLN_FUN_V2V_RGB_TO_HSV_HH
diff --git a/milena/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh
b/milena/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh
new file mode 100644
index 0000000..8b228e0
--- /dev/null
+++ b/milena/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh
@@ -0,0 +1,96 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009 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_FUN_V2V_RGB_TO_HUE_MAP_HH
+# define MLN_FUN_V2V_RGB_TO_HUE_MAP_HH
+
+# include <mln/math/abs.hh>
+# include <mln/math/max.hh>
+
+# include <mln/value/rgb.hh>
+
+
+/// \file
+///
+/// \brief Convert rgb value to hue map.
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ /// \brief Convert rgb value to hue map.
+ ///
+ /// \ingroup modfunv2v
+
+ template <unsigned n>
+ struct rgb_to_hue_map :
+ Function_v2v< rgb_to_hue_map<n> >
+ {
+ typedef value::rgb<n> argument;
+ typedef value::int_u<n> result;
+
+ result operator()(const argument& v) const
+ {
+ const float max = math::max(math::max(v.red(), v.green()), v.blue());
+ const float min = math::min(math::min(v.red(), v.green()), v.blue());
+ const float diff = max - min;
+ float hue = 0;
+
+ if (0 != diff)
+ {
+ if (v.red() == max)
+ {
+ hue = 60 * ((v.green() - v.blue()) / diff);
+
+ if (0 < hue)
+ hue = 360.0 + hue;
+ }
+ else if (v.green() == max)
+ hue = 60 * (2 + (v.blue() - v.red()) / diff);
+ else // (v.blue() == max)
+ hue = 60 * (4 + (v.red() - v.green()) / diff);
+ }
+
+ const result ret = (hue/360.0) * (mln_max(result) - mln_min(result))
+ + mln_min(result);
+
+ return ret;
+ }
+ };
+
+ } // end of namespace mln::fun::v2v
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+#endif // ! MLN_FUN_V2V_RGB_TO_HUE_MAP_HH
diff --git a/milena/sandbox/green/mln/fun/v2v/rgb_to_saturation_map.hh
b/milena/sandbox/green/mln/fun/v2v/rgb_to_saturation_map.hh
new file mode 100644
index 0000000..a8847a0
--- /dev/null
+++ b/milena/sandbox/green/mln/fun/v2v/rgb_to_saturation_map.hh
@@ -0,0 +1,83 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009 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_FUN_V2V_RGB_TO_SATURATION_MAP_HH
+# define MLN_FUN_V2V_RGB_TO_SATURATION_MAP_HH
+
+# include <mln/math/abs.hh>
+# include <mln/math/max.hh>
+
+# include <mln/value/rgb.hh>
+
+
+/// \file
+///
+/// \brief Convert rgb value to saturation map.
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ /// \brief Convert rgb value to saturation map.
+ ///
+ /// \ingroup modfunv2v
+
+ template <unsigned n>
+ struct rgb_to_saturation_map :
+ Function_v2v< rgb_to_saturation_map<n> >
+ {
+ typedef value::rgb<n> argument;
+ typedef value::int_u<n> result;
+
+ result operator()(const argument& v) const
+ {
+ const float max = math::max(math::max(v.red(), v.green()), v.blue());
+ const float min = math::min(math::min(v.red(), v.green()), v.blue());
+ float sat = 0.0;
+
+ if (0 != max)
+ sat = (1 - (float)min/max);
+
+ const result ret = sat * (mln_max(result) - mln_min(result))
+ + mln_min(result);
+
+ return ret;
+ }
+ };
+
+ } // end of namespace mln::fun::v2v
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+#endif // ! MLN_FUN_V2V_RGB_TO_SATURATION_MAP_HH
diff --git a/milena/sandbox/green/mln/fun/v2v/rgb_to_value_map.hh
b/milena/sandbox/green/mln/fun/v2v/rgb_to_value_map.hh
new file mode 100644
index 0000000..12ac1db
--- /dev/null
+++ b/milena/sandbox/green/mln/fun/v2v/rgb_to_value_map.hh
@@ -0,0 +1,75 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009 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_FUN_V2V_RGB_TO_VALUE_MAP_HH
+# define MLN_FUN_V2V_RGB_TO_VALUE_MAP_HH
+
+# include <mln/math/abs.hh>
+# include <mln/math/max.hh>
+
+# include <mln/value/rgb.hh>
+
+
+/// \file
+///
+/// \brief Convert rgb value to value map.
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ /// \brief Convert rgb value to value map.
+ ///
+ /// \ingroup modfunv2v
+
+ template <unsigned n>
+ struct rgb_to_value_map :
+ Function_v2v< rgb_to_value_map<n> >
+ {
+ typedef value::rgb<n> argument;
+ typedef value::int_u<n> result;
+
+ result operator()(const argument& v) const
+ {
+ const result ret = math::max(math::max(v.red(), v.green()), v.blue());
+
+ return ret;
+ }
+ };
+
+ } // end of namespace mln::fun::v2v
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+#endif // ! MLN_FUN_V2V_RGB_TO_VALUE_MAP_HH
diff --git a/milena/sandbox/green/mln/img_path.hh b/milena/sandbox/green/mln/img_path.hh
index 7368c22..d205e1f 100644
--- a/milena/sandbox/green/mln/img_path.hh
+++ b/milena/sandbox/green/mln/img_path.hh
@@ -28,41 +28,212 @@
#ifndef MLN_IMG_PATH_HH
# define MLN_IMG_PATH_HH
-# define IMG_PATH "/home/green/svn/oln/trunk/milena/sandbox/green/img"
-# define RESULT_PATH "/home/green/svn/oln/trunk/milena/sandbox/green/result"
+# define IMG_PATH "/home/green/git/img"
+# define RET_PATH "/home/green/git/result"
# define INIM_IMG_PATH IMG_PATH"/inim"
-# define INIM_FG_BG_IMG_PATH INIM_IMG_PATH"/fg_bg"
+# define INIM_BG_IMG_PATH INIM_IMG_PATH"/bg"
+# define INIM_FG_IMG_PATH INIM_IMG_PATH"/fg"
# define INIM_IN_IMG_PATH INIM_IMG_PATH"/in"
# define OLENA_IMG_PATH IMG_PATH"/olena"
-# define SCRIBO_IMG_PATH IMG_PATH"/scribo"
-# define SCRIBO_JPG_IMG_PATH SCRIBO_IMG_PATH"/jpg_50p"
-# define SCRIBO_PGM_IMG_PATH SCRIBO_IMG_PATH"/pgm_50p"
-# define SCRIBO_PPM_IMG_PATH SCRIBO_IMG_PATH"/ppm_50p"
-
-# define ANNOTATING_IMG_PATH IMG_PATH"/annotating"
-# define ANNOTATING_BILL_IMG_PATH ANNOTATING_IMG_PATH"/bill"
-# define ANNOTATING_FAX_IMG_PATH ANNOTATING_IMG_PATH"/fax"
-# define ANNOTATING_HANDWRITTEN_IMG_PATH ANNOTATING_IMG_PATH"/handwritten"
-# define ANNOTATING_LOGO_IMG_PATH ANNOTATING_IMG_PATH"/logo"
-# define ANNOTATING_MAP_IMG_PATH ANNOTATING_IMG_PATH"/map"
-# define ANNOTATING_SCREENSHOT_IMG_PATH ANNOTATING_IMG_PATH"/screenshot"
-# define ANNOTATING_SLIDE_IMG_PATH ANNOTATING_IMG_PATH"/slide"
-# define ANNOTATING_TYPED_IMG_PATH ANNOTATING_IMG_PATH"/typed"
-# define ANNOTATING_PHOTO_IMG_PATH ANNOTATING_IMG_PATH"/photo"
+# define ICDAR_IMG_PATH IMG_PATH"/icdar"
+# define ICDAR_100P_IMG_PATH ICDAR_IMG_PATH"/100p"
+# define ICDAR_100P_PPM_IMG_PATH ICDAR_100P_IMG_PATH"/ppm"
+# define ICDAR_100P_PGM_IMG_PATH ICDAR_100P_IMG_PATH"/pgm"
+# define ICDAR_100P_PBM_IMG_PATH ICDAR_100P_IMG_PATH"/pbm"
+# define ICDAR_100P_THICK_IMG_PATH ICDAR_100P_IMG_PATH"/gradient_thick"
+# define ICDAR_100P_THIN_IMG_PATH ICDAR_100P_IMG_PATH"/gradient_thin"
+
+# define ICDAR_50P_IMG_PATH ICDAR_IMG_PATH"/50p"
+# define ICDAR_50P_PPM_IMG_PATH ICDAR_50P_IMG_PATH"/ppm"
+# define ICDAR_50P_PGM_IMG_PATH ICDAR_50P_IMG_PATH"/pgm"
+# define ICDAR_50P_PBM_IMG_PATH ICDAR_50P_IMG_PATH"/pbm"
+
+# define ICDAR_20P_IMG_PATH ICDAR_IMG_PATH"/20p"
+# define ICDAR_20P_TEXT_ONLY_IMG_PATH ICDAR_20P_IMG_PATH"/text-only"
+# define ICDAR_20P_TEXT_COLOR_IMG_PATH ICDAR_20P_IMG_PATH"/text-color"
+# define ICDAR_20P_TEXT_PHOTO_IMG_PATH ICDAR_20P_IMG_PATH"/text-photo"
+# define ICDAR_20P_GMP30_IMG_PATH ICDAR_20P_IMG_PATH"/gimp-pal-30"
+# define ICDAR_20P_MGK30_IMG_PATH ICDAR_20P_IMG_PATH"/magick-pal-30"
+# define ICDAR_20P_GMP20_IMG_PATH ICDAR_20P_IMG_PATH"/gimp-pal-20"
+# define ICDAR_20P_MGK20_IMG_PATH ICDAR_20P_IMG_PATH"/magick-pal-20"
+# define ICDAR_20P_GMP10_IMG_PATH ICDAR_20P_IMG_PATH"/gimp-pal-10"
+# define ICDAR_20P_MGK10_IMG_PATH ICDAR_20P_IMG_PATH"/magick-pal-10"
+# define ICDAR_20P_INPUT_IMG_PATH ICDAR_20P_IMG_PATH"/ppm"
+# define ICDAR_20P_CROP_IMG_PATH ICDAR_20P_IMG_PATH"/crop"
+# define ICDAR_20P_PGM_IMG_PATH ICDAR_20P_IMG_PATH"/pgm"
+# define ICDAR_20P_PPM_IMG_PATH ICDAR_20P_IMG_PATH"/ppm"
+# define ICDAR_20P_PBM_IMG_PATH ICDAR_20P_IMG_PATH"/pbm"
+
+# define AFP_IMG_PATH IMG_PATH"/afp"
+# define AFP_GMP30_IMG_PATH AFP_IMG_PATH"/gimp-pal-30"
+# define AFP_GMP20_IMG_PATH AFP_IMG_PATH"/gimp-pal-20"
+# define AFP_GMP10_IMG_PATH AFP_IMG_PATH"/gimp-pal-10"
+# define AFP_MGK30_IMG_PATH AFP_IMG_PATH"/magick-pal-30"
+# define AFP_MGK20_IMG_PATH AFP_IMG_PATH"/magick-pal-20"
+# define AFP_MGK10_IMG_PATH AFP_IMG_PATH"/magick-pal-10"
+# define AFP_INPUT_IMG_PATH AFP_IMG_PATH"/ppm"
+# define AFP_PPM_IMG_PATH AFP_IMG_PATH"/ppm"
+# define AFP_JPG_IMG_PATH AFP_IMG_PATH"/jpg"
+
+# define ANNOTATING_1_IMG_PATH IMG_PATH"/annotating-1"
+# define ANNOTATING_1_BILL_IMG_PATH ANNOTATING_1_IMG_PATH"/bill"
+# define ANNOTATING_1_FAX_IMG_PATH ANNOTATING_1_IMG_PATH"/fax"
+# define ANNOTATING_1_HANDWRITTEN_IMG_PATH ANNOTATING_1_IMG_PATH"/handwritten"
+# define ANNOTATING_1_LOGO_IMG_PATH ANNOTATING_1_IMG_PATH"/logo"
+# define ANNOTATING_1_MAP_IMG_PATH ANNOTATING_1_IMG_PATH"/map"
+# define ANNOTATING_1_SCREENSHOT_IMG_PATH ANNOTATING_1_IMG_PATH"/screenshot"
+# define ANNOTATING_1_SLIDE_IMG_PATH ANNOTATING_1_IMG_PATH"/slide"
+# define ANNOTATING_1_TYPED_IMG_PATH ANNOTATING_1_IMG_PATH"/typed"
+# define ANNOTATING_1_PHOTO_IMG_PATH ANNOTATING_1_IMG_PATH"/photo"
+
+# define ANNOTATING_2_IMG_PATH IMG_PATH"/annotating-2"
+# define ANNOTATING_2_BILL_IMG_PATH ANNOTATING_2_IMG_PATH"/bill"
+# define ANNOTATING_2_FAX_IMG_PATH ANNOTATING_2_IMG_PATH"/fax"
+# define ANNOTATING_2_HANDWRITTEN_IMG_PATH ANNOTATING_2_IMG_PATH"/handwritten"
+# define ANNOTATING_2_LOGO_IMG_PATH ANNOTATING_2_IMG_PATH"/logo"
+# define ANNOTATING_2_MAP_IMG_PATH ANNOTATING_2_IMG_PATH"/map"
+# define ANNOTATING_2_SCREENSHOT_IMG_PATH ANNOTATING_2_IMG_PATH"/screenshot"
+# define ANNOTATING_2_SLIDE_IMG_PATH ANNOTATING_2_IMG_PATH"/slide"
+# define ANNOTATING_2_TYPED_IMG_PATH ANNOTATING_2_IMG_PATH"/typed"
+# define ANNOTATING_2_PHOTO_IMG_PATH ANNOTATING_2_IMG_PATH"/photo"
// result directories
-# define RESULT_ANNOTATING_PATH RESULT_PATH"/annotating"
-# define RESULT_ANNOTATING_BILL_PATH RESULT_ANNOTATING_PATH"/bill"
-# define RESULT_ANNOTATING_FAX_PATH RESULT_ANNOTATING_PATH"/fax"
-# define RESULT_ANNOTATING_HANDWRITTEN_PATH
RESULT_ANNOTATING_PATH"/handwritten"
-# define RESULT_ANNOTATING_LOGO_PATH RESULT_ANNOTATING_PATH"/logo"
-# define RESULT_ANNOTATING_MAP_PATH RESULT_ANNOTATING_PATH"/map"
-# define RESULT_ANNOTATING_SCREENSHOT_PATH
RESULT_ANNOTATING_PATH"/screenshot"
-# define RESULT_ANNOTATING_SLIDE_PATH RESULT_ANNOTATING_PATH"/slide"
-# define RESULT_ANNOTATING_TYPED_PATH RESULT_ANNOTATING_PATH"/typed"
-# define RESULT_ANNOTATING_PHOTO_PATH RESULT_ANNOTATING_PATH"/photo"
+# define ANNOTATING_RET_PATH RET_PATH"/annotating"
+
+# define ANNOTATING_ICDAR_RET_PATH ANNOTATING_RET_PATH"/icdar"
+
+# define ANNOTATING_ICDAR_INPUT_RET_PATH ANNOTATING_ICDAR_RET_PATH"/input"
+# define ANNOTATING_ICDAR_H_INPUT_RET_PATH ANNOTATING_ICDAR_INPUT_RET_PATH"/h"
+# define ANNOTATING_ICDAR_S_INPUT_RET_PATH ANNOTATING_ICDAR_INPUT_RET_PATH"/s"
+# define ANNOTATING_ICDAR_V_INPUT_RET_PATH ANNOTATING_ICDAR_INPUT_RET_PATH"/v"
+# define ANNOTATING_ICDAR_R_INPUT_RET_PATH ANNOTATING_ICDAR_INPUT_RET_PATH"/r"
+# define ANNOTATING_ICDAR_G_INPUT_RET_PATH ANNOTATING_ICDAR_INPUT_RET_PATH"/g"
+# define ANNOTATING_ICDAR_B_INPUT_RET_PATH ANNOTATING_ICDAR_INPUT_RET_PATH"/b"
+
+# define ANNOTATING_ICDAR_GMP30_RET_PATH
ANNOTATING_ICDAR_RET_PATH"/gimp-pal-30"
+# define ANNOTATING_ICDAR_H_GMP30_RET_PATH ANNOTATING_ICDAR_GMP30_RET_PATH"/h"
+# define ANNOTATING_ICDAR_S_GMP30_RET_PATH ANNOTATING_ICDAR_GMP30_RET_PATH"/s"
+# define ANNOTATING_ICDAR_V_GMP30_RET_PATH ANNOTATING_ICDAR_GMP30_RET_PATH"/v"
+# define ANNOTATING_ICDAR_R_GMP30_RET_PATH ANNOTATING_ICDAR_GMP30_RET_PATH"/r"
+# define ANNOTATING_ICDAR_G_GMP30_RET_PATH ANNOTATING_ICDAR_GMP30_RET_PATH"/g"
+# define ANNOTATING_ICDAR_B_GMP30_RET_PATH ANNOTATING_ICDAR_GMP30_RET_PATH"/b"
+
+# define ANNOTATING_ICDAR_GMP20_RET_PATH
ANNOTATING_ICDAR_RET_PATH"/gimp-pal-20"
+# define ANNOTATING_ICDAR_H_GMP20_RET_PATH ANNOTATING_ICDAR_GMP20_RET_PATH"/h"
+# define ANNOTATING_ICDAR_S_GMP20_RET_PATH ANNOTATING_ICDAR_GMP20_RET_PATH"/s"
+# define ANNOTATING_ICDAR_V_GMP20_RET_PATH ANNOTATING_ICDAR_GMP20_RET_PATH"/v"
+# define ANNOTATING_ICDAR_R_GMP20_RET_PATH ANNOTATING_ICDAR_GMP20_RET_PATH"/r"
+# define ANNOTATING_ICDAR_G_GMP20_RET_PATH ANNOTATING_ICDAR_GMP20_RET_PATH"/g"
+# define ANNOTATING_ICDAR_B_GMP20_RET_PATH ANNOTATING_ICDAR_GMP20_RET_PATH"/b"
+
+# define ANNOTATING_ICDAR_GMP10_RET_PATH
ANNOTATING_ICDAR_RET_PATH"/gimp-pal-10"
+# define ANNOTATING_ICDAR_H_GMP10_RET_PATH ANNOTATING_ICDAR_GMP10_RET_PATH"/h"
+# define ANNOTATING_ICDAR_S_GMP10_RET_PATH ANNOTATING_ICDAR_GMP10_RET_PATH"/s"
+# define ANNOTATING_ICDAR_V_GMP10_RET_PATH ANNOTATING_ICDAR_GMP10_RET_PATH"/v"
+# define ANNOTATING_ICDAR_R_GMP10_RET_PATH ANNOTATING_ICDAR_GMP10_RET_PATH"/r"
+# define ANNOTATING_ICDAR_G_GMP10_RET_PATH ANNOTATING_ICDAR_GMP10_RET_PATH"/g"
+# define ANNOTATING_ICDAR_B_GMP10_RET_PATH ANNOTATING_ICDAR_GMP10_RET_PATH"/b"
+
+# define ANNOTATING_ICDAR_MGK30_RET_PATH
ANNOTATING_ICDAR_RET_PATH"/magick-pal-30"
+# define ANNOTATING_ICDAR_H_MGK30_RET_PATH ANNOTATING_ICDAR_MGK30_RET_PATH"/h"
+# define ANNOTATING_ICDAR_S_MGK30_RET_PATH ANNOTATING_ICDAR_MGK30_RET_PATH"/s"
+# define ANNOTATING_ICDAR_V_MGK30_RET_PATH ANNOTATING_ICDAR_MGK30_RET_PATH"/v"
+# define ANNOTATING_ICDAR_R_MGK30_RET_PATH ANNOTATING_ICDAR_MGK30_RET_PATH"/r"
+# define ANNOTATING_ICDAR_G_MGK30_RET_PATH ANNOTATING_ICDAR_MGK30_RET_PATH"/g"
+# define ANNOTATING_ICDAR_B_MGK30_RET_PATH ANNOTATING_ICDAR_MGK30_RET_PATH"/b"
+
+# define ANNOTATING_ICDAR_MGK20_RET_PATH
ANNOTATING_ICDAR_RET_PATH"/magick-pal-20"
+# define ANNOTATING_ICDAR_H_MGK20_RET_PATH ANNOTATING_ICDAR_MGK20_RET_PATH"/h"
+# define ANNOTATING_ICDAR_S_MGK20_RET_PATH ANNOTATING_ICDAR_MGK20_RET_PATH"/s"
+# define ANNOTATING_ICDAR_V_MGK20_RET_PATH ANNOTATING_ICDAR_MGK20_RET_PATH"/v"
+# define ANNOTATING_ICDAR_R_MGK20_RET_PATH ANNOTATING_ICDAR_MGK20_RET_PATH"/r"
+# define ANNOTATING_ICDAR_G_MGK20_RET_PATH ANNOTATING_ICDAR_MGK20_RET_PATH"/g"
+# define ANNOTATING_ICDAR_B_MGK20_RET_PATH ANNOTATING_ICDAR_MGK20_RET_PATH"/b"
+
+# define ANNOTATING_ICDAR_MGK10_RET_PATH
ANNOTATING_ICDAR_RET_PATH"/magick-pal-10"
+# define ANNOTATING_ICDAR_H_MGK10_RET_PATH ANNOTATING_ICDAR_MGK10_RET_PATH"/h"
+# define ANNOTATING_ICDAR_S_MGK10_RET_PATH ANNOTATING_ICDAR_MGK10_RET_PATH"/s"
+# define ANNOTATING_ICDAR_V_MGK10_RET_PATH ANNOTATING_ICDAR_MGK10_RET_PATH"/v"
+# define ANNOTATING_ICDAR_R_MGK10_RET_PATH ANNOTATING_ICDAR_MGK10_RET_PATH"/r"
+# define ANNOTATING_ICDAR_G_MGK10_RET_PATH ANNOTATING_ICDAR_MGK10_RET_PATH"/g"
+# define ANNOTATING_ICDAR_B_MGK10_RET_PATH ANNOTATING_ICDAR_MGK10_RET_PATH"/b"
+
+
+
+
+# define ANNOTATING_AFP_RET_PATH ANNOTATING_RET_PATH"/afp"
+
+# define ANNOTATING_AFP_INPUT_RET_PATH ANNOTATING_AFP_RET_PATH"/input"
+# define ANNOTATING_AFP_H_INPUT_RET_PATH ANNOTATING_AFP_INPUT_RET_PATH"/h"
+# define ANNOTATING_AFP_S_INPUT_RET_PATH ANNOTATING_AFP_INPUT_RET_PATH"/s"
+# define ANNOTATING_AFP_V_INPUT_RET_PATH ANNOTATING_AFP_INPUT_RET_PATH"/v"
+# define ANNOTATING_AFP_R_INPUT_RET_PATH ANNOTATING_AFP_INPUT_RET_PATH"/r"
+# define ANNOTATING_AFP_G_INPUT_RET_PATH ANNOTATING_AFP_INPUT_RET_PATH"/g"
+# define ANNOTATING_AFP_B_INPUT_RET_PATH ANNOTATING_AFP_INPUT_RET_PATH"/b"
+
+# define ANNOTATING_AFP_GMP30_RET_PATH ANNOTATING_AFP_RET_PATH"/gimp-pal-30"
+# define ANNOTATING_AFP_H_GMP30_RET_PATH ANNOTATING_AFP_GMP30_RET_PATH"/h"
+# define ANNOTATING_AFP_S_GMP30_RET_PATH ANNOTATING_AFP_GMP30_RET_PATH"/s"
+# define ANNOTATING_AFP_V_GMP30_RET_PATH ANNOTATING_AFP_GMP30_RET_PATH"/v"
+# define ANNOTATING_AFP_R_GMP30_RET_PATH ANNOTATING_AFP_GMP30_RET_PATH"/r"
+# define ANNOTATING_AFP_G_GMP30_RET_PATH ANNOTATING_AFP_GMP30_RET_PATH"/g"
+# define ANNOTATING_AFP_B_GMP30_RET_PATH ANNOTATING_AFP_GMP30_RET_PATH"/b"
+
+# define ANNOTATING_AFP_GMP20_RET_PATH ANNOTATING_AFP_RET_PATH"/gimp-pal-20"
+# define ANNOTATING_AFP_H_GMP20_RET_PATH ANNOTATING_AFP_GMP20_RET_PATH"/h"
+# define ANNOTATING_AFP_S_GMP20_RET_PATH ANNOTATING_AFP_GMP20_RET_PATH"/s"
+# define ANNOTATING_AFP_V_GMP20_RET_PATH ANNOTATING_AFP_GMP20_RET_PATH"/v"
+# define ANNOTATING_AFP_R_GMP20_RET_PATH ANNOTATING_AFP_GMP20_RET_PATH"/r"
+# define ANNOTATING_AFP_G_GMP20_RET_PATH ANNOTATING_AFP_GMP20_RET_PATH"/g"
+# define ANNOTATING_AFP_B_GMP20_RET_PATH ANNOTATING_AFP_GMP20_RET_PATH"/b"
+
+# define ANNOTATING_AFP_GMP10_RET_PATH ANNOTATING_AFP_RET_PATH"/gimp-pal-10"
+# define ANNOTATING_AFP_H_GMP10_RET_PATH ANNOTATING_AFP_GMP10_RET_PATH"/h"
+# define ANNOTATING_AFP_S_GMP10_RET_PATH ANNOTATING_AFP_GMP10_RET_PATH"/s"
+# define ANNOTATING_AFP_V_GMP10_RET_PATH ANNOTATING_AFP_GMP10_RET_PATH"/v"
+# define ANNOTATING_AFP_R_GMP10_RET_PATH ANNOTATING_AFP_GMP10_RET_PATH"/r"
+# define ANNOTATING_AFP_G_GMP10_RET_PATH ANNOTATING_AFP_GMP10_RET_PATH"/g"
+# define ANNOTATING_AFP_B_GMP10_RET_PATH ANNOTATING_AFP_GMP10_RET_PATH"/b"
+
+# define ANNOTATING_AFP_MGK30_RET_PATH
ANNOTATING_AFP_RET_PATH"/magick-pal-30"
+# define ANNOTATING_AFP_H_MGK30_RET_PATH ANNOTATING_AFP_MGK30_RET_PATH"/h"
+# define ANNOTATING_AFP_S_MGK30_RET_PATH ANNOTATING_AFP_MGK30_RET_PATH"/s"
+# define ANNOTATING_AFP_V_MGK30_RET_PATH ANNOTATING_AFP_MGK30_RET_PATH"/v"
+# define ANNOTATING_AFP_R_MGK30_RET_PATH ANNOTATING_AFP_MGK30_RET_PATH"/r"
+# define ANNOTATING_AFP_G_MGK30_RET_PATH ANNOTATING_AFP_MGK30_RET_PATH"/g"
+# define ANNOTATING_AFP_B_MGK30_RET_PATH ANNOTATING_AFP_MGK30_RET_PATH"/b"
+
+# define ANNOTATING_AFP_MGK20_RET_PATH
ANNOTATING_AFP_RET_PATH"/magick-pal-20"
+# define ANNOTATING_AFP_H_MGK20_RET_PATH ANNOTATING_AFP_MGK20_RET_PATH"/h"
+# define ANNOTATING_AFP_S_MGK20_RET_PATH ANNOTATING_AFP_MGK20_RET_PATH"/s"
+# define ANNOTATING_AFP_V_MGK20_RET_PATH ANNOTATING_AFP_MGK20_RET_PATH"/v"
+# define ANNOTATING_AFP_R_MGK20_RET_PATH ANNOTATING_AFP_MGK20_RET_PATH"/r"
+# define ANNOTATING_AFP_G_MGK20_RET_PATH ANNOTATING_AFP_MGK20_RET_PATH"/g"
+# define ANNOTATING_AFP_B_MGK20_RET_PATH ANNOTATING_AFP_MGK20_RET_PATH"/b"
+
+# define ANNOTATING_AFP_MGK10_RET_PATH
ANNOTATING_AFP_RET_PATH"/magick-pal-10"
+# define ANNOTATING_AFP_H_MGK10_RET_PATH ANNOTATING_AFP_MGK10_RET_PATH"/h"
+# define ANNOTATING_AFP_S_MGK10_RET_PATH ANNOTATING_AFP_MGK10_RET_PATH"/s"
+# define ANNOTATING_AFP_V_MGK10_RET_PATH ANNOTATING_AFP_MGK10_RET_PATH"/v"
+# define ANNOTATING_AFP_R_MGK10_RET_PATH ANNOTATING_AFP_MGK10_RET_PATH"/r"
+# define ANNOTATING_AFP_G_MGK10_RET_PATH ANNOTATING_AFP_MGK10_RET_PATH"/g"
+# define ANNOTATING_AFP_B_MGK10_RET_PATH ANNOTATING_AFP_MGK10_RET_PATH"/b"
+
+
+# define ANNOTATING_BILL_RET_PATH ANNOTATING_RET_PATH"/bill"
+# define ANNOTATING_FAX_RET_PATH ANNOTATING_RET_PATH"/fax"
+# define ANNOTATING_HANDWRITTEN_RET_PATH ANNOTATING_RET_PATH"/handwritten"
+# define ANNOTATING_LOGO_RET_PATH ANNOTATING_RET_PATH"/logo"
+# define ANNOTATING_MAP_RET_PATH ANNOTATING_RET_PATH"/map"
+# define ANNOTATING_SCREENSHOT_RET_PATH ANNOTATING_RET_PATH"/screenshot"
+# define ANNOTATING_SLIDE_RET_PATH ANNOTATING_RET_PATH"/slide"
+# define ANNOTATING_TYPED_RET_PATH ANNOTATING_RET_PATH"/typed"
+# define ANNOTATING_PHOTO_RET_PATH ANNOTATING_RET_PATH"/photo"
+
+# define ANNOTATING_ICDAR_ACHROMATISM_RET_PATH
ANNOTATING_ICDAR_RET_PATH"/achromatism"
+
#endif // ! MLN_IMG_PATH_HH
diff --git a/milena/sandbox/green/mln/math/ceil.hh
b/milena/sandbox/green/mln/math/ceil.hh
new file mode 100644
index 0000000..6fc08c8
--- /dev/null
+++ b/milena/sandbox/green/mln/math/ceil.hh
@@ -0,0 +1,64 @@
+// Copyright (C) 2007, 2008, 2009, 2010
+// 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_MATH_CEIL_HH
+# define MLN_MATH_CEIL_HH
+
+/*! \file
+ *
+ * \brief Define the ceil (ceil) routine.
+ */
+
+# include <cmath>
+
+
+namespace mln
+{
+
+ namespace math
+ {
+
+ template <typename T>
+ T ceil(const T& v);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T>
+ inline
+ T ceil(const T& v)
+ {
+ return std::ceil(v);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::math
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MATH_FLOOR_HH
diff --git a/milena/sandbox/green/mln/math/floor.hh
b/milena/sandbox/green/mln/math/floor.hh
new file mode 100644
index 0000000..97e63bd
--- /dev/null
+++ b/milena/sandbox/green/mln/math/floor.hh
@@ -0,0 +1,64 @@
+// Copyright (C) 2007, 2008, 2009, 2010
+// 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_MATH_FLOOR_HH
+# define MLN_MATH_FLOOR_HH
+
+/*! \file
+ *
+ * \brief Define the floor (floor) routine.
+ */
+
+# include <cmath>
+
+
+namespace mln
+{
+
+ namespace math
+ {
+
+ template <typename T>
+ T floor(const T& v);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T>
+ inline
+ T floor(const T& v)
+ {
+ return std::floor(v);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::math
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MATH_FLOOR_HH
diff --git a/milena/sandbox/green/mln/value/hsv.hh
b/milena/sandbox/green/mln/value/hsv.hh
new file mode 100644
index 0000000..69948d9
--- /dev/null
+++ b/milena/sandbox/green/mln/value/hsv.hh
@@ -0,0 +1,424 @@
+// Copyright (C) 2008, 2009 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_VALUE_HSV_HH
+# define MLN_VALUE_HSV_HH
+
+#include <mln/value/ops.hh>
+
+#include <mln/value/concept/vectorial.hh>
+#include <mln/value/int_u.hh>
+// #include <mln/algebra/vec.hh>
+
+// Used in from_to
+// #include <mln/fun/v2v/rgb_to_hsv.hh>
+
+
+namespace mln
+{
+
+ // Forward declarations.
+ namespace value
+ {
+
+ template <typename H, typename S, typename V>
+ class hsv_;
+
+ }
+
+
+/*
+ namespace convert
+ {
+
+ namespace over_load
+ {
+
+ // rgb to hsv_
+ void
+ from_to_(const value::rgb<16>& from,
value::hsv_<float,float,float>& to);
+
+ // rgb to hsv_
+ void
+ from_to_(const value::rgb<8>& from,
value::hsv_<float,float,float>& to);
+
+ } // end of namespace mln::convert::over_load
+
+ } // end of namespace mln::convert
+*/
+
+
+ namespace trait
+ {
+
+ template <typename H, typename S, typename V>
+ struct set_precise_binary_< op::plus, mln::value::hsv_<H,S,V>,
+ mln::value::hsv_<H,S,V> >
+ {
+ typedef mln::value::hsv_<H,S,V> ret;
+ };
+
+ template <typename H, typename S, typename V>
+ struct set_precise_binary_< op::minus, mln::value::hsv_<H,S,V>,
+ mln::value::hsv_<H,S,V> >
+ {
+ typedef mln::value::hsv_<H,S,V> ret;
+ };
+
+ template <typename H, typename S, typename V, typename S2>
+ struct set_precise_binary_< op::times, mln::value::hsv_<H,S,V>,
+ mln::value::scalar_<S2> >
+ {
+ typedef mln::value::hsv_<H,S,V> ret;
+ };
+
+ template <typename H, typename S, typename V, typename S2>
+ struct set_precise_binary_< op::div, mln::value::hsv_<H,S,V>,
+ mln::value::scalar_<S2> >
+ {
+ typedef mln::value::hsv_<H,S,V> ret;
+ };
+
+
+ // FIXME : Is there any way more generic? a way to factor
+ // set_precise_binary_< op::div, mln::value::hsv_<H,S,V>,
mln::value::scalar_<S> >
+ // and
+ // set_precise_binary_< op::div, mln::value::hsv_<H,S,V>,
mln::value::int_u<m> >
+ // as for op::times.
+
+ template <typename H, typename S, typename V, unsigned m>
+ struct set_precise_binary_< op::times, mln::value::hsv_<H,S,V>,
+ mln::value::int_u<m> >
+ {
+ typedef mln::value::hsv_<H,S,V> ret;
+ };
+
+ template <typename H, typename S, typename V, unsigned m>
+ struct set_precise_binary_< op::div, mln::value::hsv_<H,S,V>,
+ mln::value::int_u<m> >
+ {
+ typedef mln::value::hsv_<H,S,V> ret;
+ };
+
+ template <typename H, typename S, typename V>
+ struct value_< mln::value::hsv_<H,S,V> >
+ {
+ enum {
+ dim = 3,
+ nbits = (sizeof (H) + sizeof (S) + sizeof (V)) * 8,
+ card = mln_value_card_from_(nbits)
+ };
+
+ typedef trait::value::nature::vectorial nature;
+ typedef trait::value::kind::color kind;
+ typedef mln_value_quant_from_(card) quant;
+
+ typedef void comp;
+ typedef H comp_0;
+ typedef S comp_1;
+ typedef V comp_2;
+
+ template <typename VAL>
+ static comp_0 get_comp_0(const VAL& v) { return v.hue(); }
+
+ template <typename VAL>
+ static comp_1 get_comp_1(const VAL& v) { return v.sat(); }
+
+ template <typename VAL>
+ static comp_2 get_comp_2(const VAL& v) { return v.val(); }
+
+ typedef mln::value::hsv_<H,S,V> sum;
+ };
+
+ } // end of namespace trait
+
+
+ namespace value
+ {
+
+ template <typename E>
+ struct HSV : Object<E>
+ {
+ };
+
+ template <typename H, typename S, typename V>
+ class hsv_ : public HSV< hsv_<H,S,V> >
+ {
+ public:
+
+ typedef H h_type;
+ typedef S s_type;
+ typedef V v_type;
+
+ /// Constructor without argument.
+ hsv_()
+ {
+ }
+
+ hsv_(const literal::zero_t&)
+ : hue_(0),
+ sat_(0),
+ val_(0)
+ {
+ }
+
+ /// Constructor from component values.
+ hsv_(const H& hue, const S& sat, const V& val)
+ : hue_(hue),
+ sat_(sat),
+ val_(val)
+ {
+ }
+
+ /// Read-only access to the hue component.
+ const H& hue() const;
+ const S& sat() const;
+ const V& val() const;
+
+ /// Read-write access to the hue component.
+ H& hue();
+ S& sat();
+ V& val();
+
+ private:
+ //FIXME: Don't we want to store these values in a vector?
+ H hue_;
+ S sat_;
+ V val_;
+ };
+
+
+ typedef hsv_<float, float, float> hsv_f;
+ typedef hsv_<double, double, double> hsv_d;
+
+
+ /// Print an hsv \p c into the output stream \p ostr.
+ ///
+ /// \param[in,out] ostr An output stream.
+ /// \param[in] c An rgb.
+ ///
+ /// \return The modified output stream \p ostr.
+ template <typename H, typename S, typename V>
+ std::ostream& operator<<(std::ostream& ostr, const
hsv_<H,S,V>& c);
+
+
+ /// Addition.
+ /// {
+ template <typename H, typename S, typename V>
+ hsv_<H,S,V>
+ operator+(const hsv_<H,S,V>& lhs, const hsv_<H,S,V>& rhs);
+ /// \}
+
+ /// Subtraction.
+ /// \{
+ template <typename H, typename S, typename V>
+ hsv_<H,S,V>
+ operator-(const hsv_<H,S,V>& lhs, const hsv_<H,S,V>& rhs);
+ /// \}
+
+ /// Product.
+ /// \{
+ template <typename H, typename S, typename V, typename S2>
+ hsv_<H,S,V>
+ operator*(const hsv_<H,S,V>& lhs, const mln::value::scalar_<S2>&
s);
+ /// \}
+
+ /// Division.
+ /// \{
+ template <typename H, typename S, typename V, typename S2>
+ hsv_<H,S,V>
+ operator/(const hsv_<H,S,V>& lhs, const mln::value::scalar_<S2>&
s);
+ /// \}
+
+ /// Comparison.
+ /// \{
+ template <typename H, typename S, typename V>
+ bool
+ operator==(const hsv_<H,S,V>& lhs, const hsv_<H,S,V>& rhs);
+ /// \}
+
+ } // end of namespace mln::value
+
+
+
+ // More forward declarations
+ namespace fun
+ {
+ namespace v2v
+ {
+
+ template <typename T_hsv>
+ struct f_rgb_to_hsv_;
+
+ typedef f_rgb_to_hsv_<value::hsv_f> f_rgb_to_hsv_f_t;
+
+ extern f_rgb_to_hsv_f_t f_rgb_to_hsv_f;
+
+ }
+
+ }
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ namespace value
+ {
+
+ template <typename H, typename S, typename V>
+ const H&
+ hsv_<H,S,V>::hue() const
+ {
+ return this->hue_;
+ }
+
+ template <typename H, typename S, typename V>
+ const S&
+ hsv_<H,S,V>::sat() const
+ {
+ return this->sat_;
+ }
+
+ template <typename H, typename S, typename V>
+ const V&
+ hsv_<H,S,V>::val() const
+ {
+ return this->val_;
+ }
+
+ template <typename H, typename S, typename V>
+ H&
+ hsv_<H,S,V>::hue()
+ {
+ return this->hue_;
+ }
+
+ template <typename H, typename S, typename V>
+ S&
+ hsv_<H,S,V>::sat()
+ {
+ return this->sat_;
+ }
+
+ template <typename H, typename S, typename V>
+ V&
+ hsv_<H,S,V>::val()
+ {
+ return this->val_;
+ }
+
+
+ template <typename H, typename S, typename V>
+ inline
+ std::ostream& operator<<(std::ostream& ostr, const
hsv_<H,S,V>& v)
+ {
+ return ostr << '(' << debug::format(v.hue())
+ << ',' << debug::format(v.sat())
+ << ',' << debug::format(v.val())
+ << ')';
+ }
+
+
+ template <typename H, typename S, typename V>
+ hsv_<H,S,V>
+ operator+(const hsv_<H,S,V>& lhs, const hsv_<H,S,V>& rhs)
+ {
+ return hsv_<H,S,V>(lhs.hue() + rhs.hue(),
+ lhs.sat() + rhs.sat(),
+ lhs.val() + rhs.val());
+ }
+
+
+ template <typename H, typename S, typename V>
+ hsv_<H,S,V>
+ operator-(const hsv_<H,S,V>& lhs, const hsv_<H,S,V>& rhs)
+ {
+ return hsv_<H,S,V>(lhs.hue() - rhs.hue(),
+ lhs.sat() - rhs.sat(),
+ lhs.val() - rhs.val());
+ }
+
+
+ template <typename H, typename S, typename V, typename S2>
+ hsv_<H,S,V>
+ operator*(const hsv_<H,S,V>& lhs, const mln::value::scalar_<S2>&
s)
+ {
+ return hsv_<H,S,V>(lhs.hue() * s,
+ lhs.sat() * s,
+ lhs.val() * s);
+ }
+
+
+ template <typename H, typename S, typename V, typename S2>
+ hsv_<H,S,V>
+ operator/(const hsv_<H,S,V>& lhs, const mln::value::scalar_<S2>&
s)
+ {
+ return hsv_<H,S,V>(lhs.hue() / s,
+ lhs.sat() / s,
+ lhs.val() / s);
+ }
+
+ template <typename H, typename S, typename V>
+ bool
+ operator==(const hsv_<H,S,V>& lhs, const hsv_<H,S,V>& rhs)
+ {
+ return lhs.hue() == rhs.hue()
+ && lhs.sat() == rhs.sat()
+ && lhs.val() == rhs.val();
+ }
+
+ } // end of namespace mln::value
+
+/*
+ namespace convert
+ {
+
+ namespace over_load
+ {
+
+ inline
+ void
+ from_to_(const value::rgb<16>& from,
value::hsv_<float,float,float>& to)
+ {
+ to = fun::v2v::f_rgb_to_hsv_f(from);
+ }
+
+ inline
+ void
+ from_to_(const value::rgb<8>& from,
value::hsv_<float,float,float>& to)
+ {
+ to = fun::v2v::f_rgb_to_hsv_f(from);
+ }
+
+ } // end of namespace mln::convert::over_load
+
+ } // end of namespace mln::convert
+*/
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+} // end of namespace mln
+
+#endif // ! MLN_VALUE_HSV_HH
--
1.5.6.5