Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
21 Jun '10
* mln/convert/from_to.hxx: New conversion utilities.
* mln/convert/impl/from_unsigned_to_value.hh: New conversion utilities.
---
milena/ChangeLog | 7 +++++++
milena/mln/convert/from_to.hxx | 4 ++++
milena/mln/convert/impl/from_unsigned_to_value.hh | 10 ++++++++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 4f302ce..24cf7f3 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -534,6 +534,13 @@
* mln/value/rgb.hh: Make use of the new routine to print a
correct type names in dump format.
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Fix the way to convert unsigned to float.
+
+ * mln/convert/from_to.hxx: New conversion utilities.
+ * mln/convert/impl/from_unsigned_to_value.hh: New conversion utilities.
+
2009-12-02 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Fix the outside template use case for the convolve macros.
diff --git a/milena/mln/convert/from_to.hxx b/milena/mln/convert/from_to.hxx
index 5007baf..ad031a4 100644
--- a/milena/mln/convert/from_to.hxx
+++ b/milena/mln/convert/from_to.hxx
@@ -292,6 +292,10 @@ namespace mln
void
from_to_(const Value<F>& from, Value<T>& to);
+ // unsigned -> float
+ void
+ from_to_(const unsigned& from, float& to);
+
// double-> Value
template <typename V>
void
diff --git a/milena/mln/convert/impl/from_unsigned_to_value.hh b/milena/mln/convert/impl/from_unsigned_to_value.hh
index ad54cff..fe09a3e 100644
--- a/milena/mln/convert/impl/from_unsigned_to_value.hh
+++ b/milena/mln/convert/impl/from_unsigned_to_value.hh
@@ -118,6 +118,16 @@ namespace mln
internal::from_unsigned_to_value_dispatch(from, to);
}
+
+ // Facades.
+ // unsigned-> float
+ void
+ from_to_(const unsigned& from, float& to)
+ {
+ to = from;
+ }
+
+
} // end of namespace mln::convert::over_load
--
1.5.6.5
1
0
* 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 2c3ec85..2714e45 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
1
0
* 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 +++---
.../sandbox/green/mln/fun/p2b/achromatic.hh | 0
.../sandbox/green/mln/fun/p2b/component_equals.hh | 0
.../sandbox/green/mln/fun/v2v/achromatism.hh | 0
.../sandbox/green/mln/fun/v2v/hue_concentration.hh | 0
.../green/mln/fun/v2v/rgb_to_achromatism_map.hh | 0
.../sandbox/green/mln/fun/v2v/rgb_to_hsv.hh | 0
.../sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh | 0
.../green/mln/fun/v2v/rgb_to_saturation_map.hh | 0
.../sandbox/green/mln/fun/v2v/rgb_to_value_map.hh | 0
milena/sandbox/green/mln/img_path.hh | 227 +++++++++++++++++---
{scribo => milena}/sandbox/green/mln/math/ceil.hh | 0
{scribo => milena}/sandbox/green/mln/math/floor.hh | 0
{scribo => milena}/sandbox/green/mln/value/hsv.hh | 0
15 files changed, 263 insertions(+), 62 deletions(-)
copy {scribo => milena}/sandbox/green/mln/fun/p2b/achromatic.hh (100%)
copy {scribo => milena}/sandbox/green/mln/fun/p2b/component_equals.hh (100%)
copy {scribo => milena}/sandbox/green/mln/fun/v2v/achromatism.hh (100%)
copy {scribo => milena}/sandbox/green/mln/fun/v2v/hue_concentration.hh (100%)
copy {scribo => milena}/sandbox/green/mln/fun/v2v/rgb_to_achromatism_map.hh (100%)
copy {scribo => milena}/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh (100%)
copy {scribo => milena}/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh (100%)
copy {scribo => milena}/sandbox/green/mln/fun/v2v/rgb_to_saturation_map.hh (100%)
copy {scribo => milena}/sandbox/green/mln/fun/v2v/rgb_to_value_map.hh (100%)
copy {scribo => milena}/sandbox/green/mln/math/ceil.hh (100%)
copy {scribo => milena}/sandbox/green/mln/math/floor.hh (100%)
copy {scribo => milena}/sandbox/green/mln/value/hsv.hh (100%)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 2b14f89..4e0e24b 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -77,7 +77,37 @@
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/scribo/sandbox/green/mln/fun/p2b/achromatic.hh b/milena/sandbox/green/mln/fun/p2b/achromatic.hh
similarity index 100%
copy from scribo/sandbox/green/mln/fun/p2b/achromatic.hh
copy to milena/sandbox/green/mln/fun/p2b/achromatic.hh
diff --git a/scribo/sandbox/green/mln/fun/p2b/component_equals.hh b/milena/sandbox/green/mln/fun/p2b/component_equals.hh
similarity index 100%
copy from scribo/sandbox/green/mln/fun/p2b/component_equals.hh
copy to milena/sandbox/green/mln/fun/p2b/component_equals.hh
diff --git a/scribo/sandbox/green/mln/fun/v2v/achromatism.hh b/milena/sandbox/green/mln/fun/v2v/achromatism.hh
similarity index 100%
copy from scribo/sandbox/green/mln/fun/v2v/achromatism.hh
copy to milena/sandbox/green/mln/fun/v2v/achromatism.hh
diff --git a/scribo/sandbox/green/mln/fun/v2v/hue_concentration.hh b/milena/sandbox/green/mln/fun/v2v/hue_concentration.hh
similarity index 100%
copy from scribo/sandbox/green/mln/fun/v2v/hue_concentration.hh
copy to milena/sandbox/green/mln/fun/v2v/hue_concentration.hh
diff --git a/scribo/sandbox/green/mln/fun/v2v/rgb_to_achromatism_map.hh b/milena/sandbox/green/mln/fun/v2v/rgb_to_achromatism_map.hh
similarity index 100%
copy from scribo/sandbox/green/mln/fun/v2v/rgb_to_achromatism_map.hh
copy to milena/sandbox/green/mln/fun/v2v/rgb_to_achromatism_map.hh
diff --git a/scribo/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh b/milena/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh
similarity index 100%
copy from scribo/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh
copy to milena/sandbox/green/mln/fun/v2v/rgb_to_hsv.hh
diff --git a/scribo/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh b/milena/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh
similarity index 100%
copy from scribo/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh
copy to milena/sandbox/green/mln/fun/v2v/rgb_to_hue_map.hh
diff --git a/scribo/sandbox/green/mln/fun/v2v/rgb_to_saturation_map.hh b/milena/sandbox/green/mln/fun/v2v/rgb_to_saturation_map.hh
similarity index 100%
copy from scribo/sandbox/green/mln/fun/v2v/rgb_to_saturation_map.hh
copy to milena/sandbox/green/mln/fun/v2v/rgb_to_saturation_map.hh
diff --git a/scribo/sandbox/green/mln/fun/v2v/rgb_to_value_map.hh b/milena/sandbox/green/mln/fun/v2v/rgb_to_value_map.hh
similarity index 100%
copy from scribo/sandbox/green/mln/fun/v2v/rgb_to_value_map.hh
copy to milena/sandbox/green/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/scribo/sandbox/green/mln/math/ceil.hh b/milena/sandbox/green/mln/math/ceil.hh
similarity index 100%
copy from scribo/sandbox/green/mln/math/ceil.hh
copy to milena/sandbox/green/mln/math/ceil.hh
diff --git a/scribo/sandbox/green/mln/math/floor.hh b/milena/sandbox/green/mln/math/floor.hh
similarity index 100%
copy from scribo/sandbox/green/mln/math/floor.hh
copy to milena/sandbox/green/mln/math/floor.hh
diff --git a/scribo/sandbox/green/mln/value/hsv.hh b/milena/sandbox/green/mln/value/hsv.hh
similarity index 100%
copy from scribo/sandbox/green/mln/value/hsv.hh
copy to milena/sandbox/green/mln/value/hsv.hh
--
1.5.6.5
1
0
21 Jun '10
* 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.
---
.../annotating/{achromastism => value}/Makefile.am | 0
.../{achromastism => value}/text-color.txt | 0
.../{achromastism => value}/text-img.txt | 0
.../{achromastism => value}/text-only.txt | 0
.../exp/annotating/{hue/hue.cc => value/value.cc} | 143 ++++++++++++--------
5 files changed, 84 insertions(+), 59 deletions(-)
copy milena/sandbox/green/exp/annotating/{achromastism => value}/Makefile.am (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => value}/text-color.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => value}/text-img.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => value}/text-only.txt (100%)
copy milena/sandbox/green/exp/annotating/{hue/hue.cc => value/value.cc} (68%)
diff --git a/milena/sandbox/green/exp/annotating/achromastism/Makefile.am b/milena/sandbox/green/exp/annotating/value/Makefile.am
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/Makefile.am
copy to milena/sandbox/green/exp/annotating/value/Makefile.am
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-color.txt b/milena/sandbox/green/exp/annotating/value/text-color.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-color.txt
copy to milena/sandbox/green/exp/annotating/value/text-color.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-img.txt b/milena/sandbox/green/exp/annotating/value/text-img.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-img.txt
copy to milena/sandbox/green/exp/annotating/value/text-img.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-only.txt b/milena/sandbox/green/exp/annotating/value/text-only.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-only.txt
copy to milena/sandbox/green/exp/annotating/value/text-only.txt
diff --git a/milena/sandbox/green/exp/annotating/hue/hue.cc b/milena/sandbox/green/exp/annotating/value/value.cc
similarity index 68%
copy from milena/sandbox/green/exp/annotating/hue/hue.cc
copy to milena/sandbox/green/exp/annotating/value/value.cc
index 883e1c6..9209d47 100644
--- a/milena/sandbox/green/exp/annotating/hue/hue.cc
+++ b/milena/sandbox/green/exp/annotating/value/value.cc
@@ -1,4 +1,4 @@
-// SATURATION TEST CF MILLET 2008
+// VALUE TEST CF MILLET 2008
#include <iostream>
#include <sstream>
@@ -26,7 +26,7 @@
#include <mln/geom/nsites.hh>
-#include <mln/fun/v2v/rgb_to_hue_map.hh>
+#include <mln/fun/v2v/rgb_to_value_map.hh>
#include <mln/io/ppm/load.hh>
#include <mln/io/pgm/save.hh>
@@ -97,52 +97,25 @@ mln::value::rgb8 label_hue(const mln::value::int_u8 hue)
{
mln::value::rgb8 result;
-
- if (10 > hue)
+ if (14 > hue)
result = mln::literal::red;
- else if (32 > hue)
+ else if (29 > hue)
result = mln::literal::orange;
- else if (53 > hue)
+ else if (45 > hue)
result = mln::literal::yellow;
- else if (74 > hue)
- result = mln::literal::green; // chartreuse
- else if (96 > hue)
+ else if (113 > hue)
result = mln::literal::green;
- else if (116 > hue)
- result = mln::literal::green;// turquoise, aigue-marine
- else if (138 > hue)
- result = mln::literal::green; // cyan
- else if (159 > hue)
- result = mln::literal::blue; // azur
- else if (181 > hue)
+ else if (149 > hue)
+ result = mln::literal::cyan;
+ else if (205 > hue)
result = mln::literal::blue;
- else if (202 > hue)
+ else if (235 > hue)
result = mln::literal::violet;
- else if (223 > hue)
+ else if (242 > hue)
result = mln::literal::pink;
- else // if (244 > hue)
+ else
result = mln::literal::red;
-
-// if (14 > hue)
-// result = mln::literal::red;
-// else if (29 > hue)
-// result = mln::literal::orange;
-// else if (45 > hue)
-// result = mln::literal::yellow;
-// else if (113 > hue)
-// result = mln::literal::green;
-// else if (149 > hue)
-// result = mln::literal::cyan;
-// else if (205 > hue)
-// result = mln::literal::blue;
-// else if (235 > hue)
-// result = mln::literal::violet;
-// else if (242 > hue)
-// result = mln::literal::pink;
-// else
-// result = mln::literal::red;
-
return result;
}
@@ -212,14 +185,69 @@ unsigned mean_histo(const mln::Image<I>& histo_)
return mean;
}
+// calcul de contribution
+float r(short p, unsigned histo_p, short x, unsigned histo_x)
+{
+ float result = mln::math::sqr(((float)histo_x / histo_p) * (x-p));
+
+ return result;
+}
+
+template <typename I>
+float stddev3(const mln::Image<I>& histo_, unsigned peak)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Compute stddev
+
+ float stddev = 0.0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ stddev += r((short)peak, mln::opt::at(histo,peak), p.ind(), histo(p));
+ }
+
+ return stddev;
+}
+
+template <typename I>
+float stddev2(const mln::Image<I>& histo_, unsigned peak, unsigned limit)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ float stddev_low = 0.0;
+ float stddev_up = 0.0;
+ float ret = 0.0;
+
+ // A transformer avec des iterators
+
+ if (250 > peak)
+ stddev_up = stddev3(histo |mln::box1d(mln::point1d(peak+1),
+ mln::point1d(peak+limit)), peak);
+
+ if (5 < peak)
+ stddev_low = stddev3(histo |mln::box1d(mln::point1d(peak-limit),
+ mln::point1d(peak-1)), peak);
+
+ ret = (250 < peak)? stddev_low : (5 > peak)? stddev_up :
+ (stddev_low + stddev_up)/2;
+
+ return ret;
+}
-float hue_test(const std::string input,
- const std::string output,
- const std::string tmp,
- const unsigned threshold)
+float value_test(const std::string input,
+ const std::string output,
+ const std::string tmp,
+ const unsigned threshold)
{
- typedef mln::fun::v2v::rgb_to_hue_map<8> t_rgb_to_hue_map;
+ typedef mln::fun::v2v::rgb_to_value_map<8> t_rgb_to_value_map;
mln::image2d<mln::value::rgb8> input_rgb8;
mln::image2d<mln::value::int_u8> map;
@@ -228,23 +256,20 @@ float hue_test(const std::string input,
unsigned cnt2;
float prop;
unsigned peak;
- mln::value::rgb8 color;
mln::io::ppm::load(input_rgb8, input.c_str());
- map = mln::data::transform(input_rgb8, t_rgb_to_hue_map());
+ map = mln::data::transform(input_rgb8, t_rgb_to_value_map());
histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map);
- peak = mean_histo(histo); //peak_histo(histo);
- color = label_hue(peak);
- cnt1 = count_histo(histo | mln::box1d(mln::point1d(peak-threshold),
- mln::point1d(peak+threshold)));
- cnt2 = mln::geom::nsites(input_rgb8);
- prop = ((100.0 * cnt1) / cnt2);
+ peak = peak_histo(histo); // mean_histo(histo);
+ prop = stddev2(histo, peak, limit);
+// cnt1 = count_histo(histo | mln::box1d(mln::point1d(peak-threshold),
+// mln::point1d(peak+threshold)));
+// cnt2 = mln::geom::nsites(input_rgb8);
+// prop = ((100.0 * cnt1) / cnt2);
mln::io::plot::save_image_sh(histo, output.c_str());
mln::io::pgm::save(map, tmp.c_str());
- std::cout << "peak = " << peak << std::endl;
- std::cout << "color = " << color << std::endl;
return prop;
}
@@ -271,15 +296,15 @@ int main()
for (t_iter_path dir_iter(full_path[i]); end_iter != dir_iter; ++dir_iter)
{
// concatenation de chaine
- t_path directory(ANNOTATING_HUE_RET_PATH);
+ t_path directory(ANNOTATING_VALUE_RET_PATH);
t_path leaf = dir_iter->path().leaf();
t_path output = change_extension(directory / leaf, ".sh");
t_path tmp = change_extension(directory / leaf, ".pgm");
- prop = hue_test(dir_iter->path().string(),
- output.string(),
- tmp.string(),
- 20);
+ prop = value_test(dir_iter->path().string(),
+ output.string(),
+ tmp.string(),
+ 15);
std::cout << output << " : " << prop << std::endl;
std::cerr << output << " : " << prop << std::endl;
--
1.5.6.5
1
0
21 Jun '10
* 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.
---
.../annotating/{achromastism => value}/Makefile.am | 0
.../{achromastism => value}/text-color.txt | 0
.../{achromastism => value}/text-img.txt | 0
.../{achromastism => value}/text-only.txt | 0
.../exp/annotating/{hue/hue.cc => value/value.cc} | 143 ++++++++++++--------
5 files changed, 84 insertions(+), 59 deletions(-)
copy milena/sandbox/green/exp/annotating/{achromastism => value}/Makefile.am (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => value}/text-color.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => value}/text-img.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => value}/text-only.txt (100%)
copy milena/sandbox/green/exp/annotating/{hue/hue.cc => value/value.cc} (68%)
diff --git a/milena/sandbox/green/exp/annotating/achromastism/Makefile.am b/milena/sandbox/green/exp/annotating/value/Makefile.am
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/Makefile.am
copy to milena/sandbox/green/exp/annotating/value/Makefile.am
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-color.txt b/milena/sandbox/green/exp/annotating/value/text-color.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-color.txt
copy to milena/sandbox/green/exp/annotating/value/text-color.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-img.txt b/milena/sandbox/green/exp/annotating/value/text-img.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-img.txt
copy to milena/sandbox/green/exp/annotating/value/text-img.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-only.txt b/milena/sandbox/green/exp/annotating/value/text-only.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-only.txt
copy to milena/sandbox/green/exp/annotating/value/text-only.txt
diff --git a/milena/sandbox/green/exp/annotating/hue/hue.cc b/milena/sandbox/green/exp/annotating/value/value.cc
similarity index 68%
copy from milena/sandbox/green/exp/annotating/hue/hue.cc
copy to milena/sandbox/green/exp/annotating/value/value.cc
index 883e1c6..9209d47 100644
--- a/milena/sandbox/green/exp/annotating/hue/hue.cc
+++ b/milena/sandbox/green/exp/annotating/value/value.cc
@@ -1,4 +1,4 @@
-// SATURATION TEST CF MILLET 2008
+// VALUE TEST CF MILLET 2008
#include <iostream>
#include <sstream>
@@ -26,7 +26,7 @@
#include <mln/geom/nsites.hh>
-#include <mln/fun/v2v/rgb_to_hue_map.hh>
+#include <mln/fun/v2v/rgb_to_value_map.hh>
#include <mln/io/ppm/load.hh>
#include <mln/io/pgm/save.hh>
@@ -97,52 +97,25 @@ mln::value::rgb8 label_hue(const mln::value::int_u8 hue)
{
mln::value::rgb8 result;
-
- if (10 > hue)
+ if (14 > hue)
result = mln::literal::red;
- else if (32 > hue)
+ else if (29 > hue)
result = mln::literal::orange;
- else if (53 > hue)
+ else if (45 > hue)
result = mln::literal::yellow;
- else if (74 > hue)
- result = mln::literal::green; // chartreuse
- else if (96 > hue)
+ else if (113 > hue)
result = mln::literal::green;
- else if (116 > hue)
- result = mln::literal::green;// turquoise, aigue-marine
- else if (138 > hue)
- result = mln::literal::green; // cyan
- else if (159 > hue)
- result = mln::literal::blue; // azur
- else if (181 > hue)
+ else if (149 > hue)
+ result = mln::literal::cyan;
+ else if (205 > hue)
result = mln::literal::blue;
- else if (202 > hue)
+ else if (235 > hue)
result = mln::literal::violet;
- else if (223 > hue)
+ else if (242 > hue)
result = mln::literal::pink;
- else // if (244 > hue)
+ else
result = mln::literal::red;
-
-// if (14 > hue)
-// result = mln::literal::red;
-// else if (29 > hue)
-// result = mln::literal::orange;
-// else if (45 > hue)
-// result = mln::literal::yellow;
-// else if (113 > hue)
-// result = mln::literal::green;
-// else if (149 > hue)
-// result = mln::literal::cyan;
-// else if (205 > hue)
-// result = mln::literal::blue;
-// else if (235 > hue)
-// result = mln::literal::violet;
-// else if (242 > hue)
-// result = mln::literal::pink;
-// else
-// result = mln::literal::red;
-
return result;
}
@@ -212,14 +185,69 @@ unsigned mean_histo(const mln::Image<I>& histo_)
return mean;
}
+// calcul de contribution
+float r(short p, unsigned histo_p, short x, unsigned histo_x)
+{
+ float result = mln::math::sqr(((float)histo_x / histo_p) * (x-p));
+
+ return result;
+}
+
+template <typename I>
+float stddev3(const mln::Image<I>& histo_, unsigned peak)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Compute stddev
+
+ float stddev = 0.0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ stddev += r((short)peak, mln::opt::at(histo,peak), p.ind(), histo(p));
+ }
+
+ return stddev;
+}
+
+template <typename I>
+float stddev2(const mln::Image<I>& histo_, unsigned peak, unsigned limit)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ float stddev_low = 0.0;
+ float stddev_up = 0.0;
+ float ret = 0.0;
+
+ // A transformer avec des iterators
+
+ if (250 > peak)
+ stddev_up = stddev3(histo |mln::box1d(mln::point1d(peak+1),
+ mln::point1d(peak+limit)), peak);
+
+ if (5 < peak)
+ stddev_low = stddev3(histo |mln::box1d(mln::point1d(peak-limit),
+ mln::point1d(peak-1)), peak);
+
+ ret = (250 < peak)? stddev_low : (5 > peak)? stddev_up :
+ (stddev_low + stddev_up)/2;
+
+ return ret;
+}
-float hue_test(const std::string input,
- const std::string output,
- const std::string tmp,
- const unsigned threshold)
+float value_test(const std::string input,
+ const std::string output,
+ const std::string tmp,
+ const unsigned threshold)
{
- typedef mln::fun::v2v::rgb_to_hue_map<8> t_rgb_to_hue_map;
+ typedef mln::fun::v2v::rgb_to_value_map<8> t_rgb_to_value_map;
mln::image2d<mln::value::rgb8> input_rgb8;
mln::image2d<mln::value::int_u8> map;
@@ -228,23 +256,20 @@ float hue_test(const std::string input,
unsigned cnt2;
float prop;
unsigned peak;
- mln::value::rgb8 color;
mln::io::ppm::load(input_rgb8, input.c_str());
- map = mln::data::transform(input_rgb8, t_rgb_to_hue_map());
+ map = mln::data::transform(input_rgb8, t_rgb_to_value_map());
histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map);
- peak = mean_histo(histo); //peak_histo(histo);
- color = label_hue(peak);
- cnt1 = count_histo(histo | mln::box1d(mln::point1d(peak-threshold),
- mln::point1d(peak+threshold)));
- cnt2 = mln::geom::nsites(input_rgb8);
- prop = ((100.0 * cnt1) / cnt2);
+ peak = peak_histo(histo); // mean_histo(histo);
+ prop = stddev2(histo, peak, limit);
+// cnt1 = count_histo(histo | mln::box1d(mln::point1d(peak-threshold),
+// mln::point1d(peak+threshold)));
+// cnt2 = mln::geom::nsites(input_rgb8);
+// prop = ((100.0 * cnt1) / cnt2);
mln::io::plot::save_image_sh(histo, output.c_str());
mln::io::pgm::save(map, tmp.c_str());
- std::cout << "peak = " << peak << std::endl;
- std::cout << "color = " << color << std::endl;
return prop;
}
@@ -271,15 +296,15 @@ int main()
for (t_iter_path dir_iter(full_path[i]); end_iter != dir_iter; ++dir_iter)
{
// concatenation de chaine
- t_path directory(ANNOTATING_HUE_RET_PATH);
+ t_path directory(ANNOTATING_VALUE_RET_PATH);
t_path leaf = dir_iter->path().leaf();
t_path output = change_extension(directory / leaf, ".sh");
t_path tmp = change_extension(directory / leaf, ".pgm");
- prop = hue_test(dir_iter->path().string(),
- output.string(),
- tmp.string(),
- 20);
+ prop = value_test(dir_iter->path().string(),
+ output.string(),
+ tmp.string(),
+ 15);
std::cout << output << " : " << prop << std::endl;
std::cerr << output << " : " << prop << std::endl;
--
1.5.6.5
1
0
21 Jun '10
* green/exp/annotating/hue: New directory.
* green/exp/annotating/hue/Makefile.am: New Makefile.
* green/exp/annotating/hue/hue.cc: New source file.
* green/exp/annotating/hue/text-color.txt: New image class.
* green/exp/annotating/hue/text-img.txt: New image class.
* green/exp/annotating/hue/text-only.txt: New image class.
---
milena/sandbox/ChangeLog | 11 +
.../annotating/{achromastism => hue}/Makefile.am | 0
milena/sandbox/green/exp/annotating/hue/hue.cc | 291 ++++++++++++++++++++
.../{achromastism => hue}/text-color.txt | 0
.../annotating/{achromastism => hue}/text-img.txt | 0
.../annotating/{achromastism => hue}/text-only.txt | 0
6 files changed, 302 insertions(+), 0 deletions(-)
copy milena/sandbox/green/exp/annotating/{achromastism => hue}/Makefile.am (100%)
create mode 100644 milena/sandbox/green/exp/annotating/hue/hue.cc
copy milena/sandbox/green/exp/annotating/{achromastism => hue}/text-color.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => hue}/text-img.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => hue}/text-only.txt (100%)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index eb301e5..2c3ec85 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -2,6 +2,17 @@
Work on Millet saturation descriptor.
+ * green/exp/annotating/hue: New directory.
+ * green/exp/annotating/hue/Makefile.am: New Makefile.
+ * green/exp/annotating/hue/hue.cc: New source file.
+ * green/exp/annotating/hue/text-color.txt: New image class.
+ * green/exp/annotating/hue/text-img.txt: New image class.
+ * green/exp/annotating/hue/text-only.txt: New image class.
+
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Work on Millet saturation descriptor.
+
* green/exp/annotating/saturation: New directory.
* green/exp/annotating/saturation/Makefile.am: New Makefile.
* green/exp/annotating/saturation/saturation.cc: New source file.
diff --git a/milena/sandbox/green/exp/annotating/achromastism/Makefile.am b/milena/sandbox/green/exp/annotating/hue/Makefile.am
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/Makefile.am
copy to milena/sandbox/green/exp/annotating/hue/Makefile.am
diff --git a/milena/sandbox/green/exp/annotating/hue/hue.cc b/milena/sandbox/green/exp/annotating/hue/hue.cc
new file mode 100644
index 0000000..883e1c6
--- /dev/null
+++ b/milena/sandbox/green/exp/annotating/hue/hue.cc
@@ -0,0 +1,291 @@
+// SATURATION TEST CF MILLET 2008
+
+#include <iostream>
+#include <sstream>
+#include <boost/filesystem.hpp>
+
+#include <mln/img_path.hh>
+
+#include <mln/accu/stat/histo1d.hh>
+
+#include <mln/core/image/image1d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/image/dmorph/image_if.hh>
+
+#include <mln/data/compute.hh>
+#include <mln/data/stretch.hh>
+#include <mln/data/transform.hh>
+
+#include <mln/literal/colors.hh>
+#include <mln/literal/grays.hh>
+
+#include <mln/math/max.hh>
+#include <mln/math/min.hh>
+
+#include <mln/opt/at.hh>
+
+#include <mln/geom/nsites.hh>
+
+#include <mln/fun/v2v/rgb_to_hue_map.hh>
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/pgm/save.hh>
+#include <mln/io/plot/save_image_sh.hh>
+
+#include <mln/value/rgb8.hh>
+
+mln::value::rgb8 label_val(const mln::value::int_u8 val)
+{
+ mln::value::rgb8 result;
+
+ if (82 > val)
+ result = mln::literal::black;
+ else if (179 > val)
+ result= mln::literal::medium_gray;
+ else
+ result = mln::literal::white;
+
+ return result;
+}
+
+
+mln::value::rgb8 label_orange_or_brown(const mln::value::rgb8 color,
+ const mln::value::int_u8 sat,
+ const mln::value::int_u8 val)
+{
+ mln::value::rgb8 result;
+
+ if (mln::literal::orange == color)
+ {
+ unsigned dist_orange = mln::math::abs(sat - 184)
+ + mln::math::abs(val - 65);
+
+ unsigned dist_brown = mln::math::abs(sat - 255)
+ + mln::math::abs(val - 125);
+
+ if (dist_orange < dist_brown)
+ result = mln::literal::orange;
+ else
+ result = mln::literal::brown;
+ }
+ else
+ result = color;
+
+ return result;
+}
+
+mln::value::rgb8 label_yellow_or_green(const mln::value::rgb8 color,
+ const mln::value::int_u8 val)
+{
+ mln::value::rgb8 result;
+
+ if (mln::literal::yellow == color)
+ {
+ // Is it green or yellow ?
+ if (80 > val)
+ result = mln::literal::green;
+ else
+ result = mln::literal::yellow;
+ }
+ else
+ return color;
+
+ return result;
+}
+
+mln::value::rgb8 label_hue(const mln::value::int_u8 hue)
+{
+ mln::value::rgb8 result;
+
+
+ if (10 > hue)
+ result = mln::literal::red;
+ else if (32 > hue)
+ result = mln::literal::orange;
+ else if (53 > hue)
+ result = mln::literal::yellow;
+ else if (74 > hue)
+ result = mln::literal::green; // chartreuse
+ else if (96 > hue)
+ result = mln::literal::green;
+ else if (116 > hue)
+ result = mln::literal::green;// turquoise, aigue-marine
+ else if (138 > hue)
+ result = mln::literal::green; // cyan
+ else if (159 > hue)
+ result = mln::literal::blue; // azur
+ else if (181 > hue)
+ result = mln::literal::blue;
+ else if (202 > hue)
+ result = mln::literal::violet;
+ else if (223 > hue)
+ result = mln::literal::pink;
+ else // if (244 > hue)
+ result = mln::literal::red;
+
+
+// if (14 > hue)
+// result = mln::literal::red;
+// else if (29 > hue)
+// result = mln::literal::orange;
+// else if (45 > hue)
+// result = mln::literal::yellow;
+// else if (113 > hue)
+// result = mln::literal::green;
+// else if (149 > hue)
+// result = mln::literal::cyan;
+// else if (205 > hue)
+// result = mln::literal::blue;
+// else if (235 > hue)
+// result = mln::literal::violet;
+// else if (242 > hue)
+// result = mln::literal::pink;
+// else
+// result = mln::literal::red;
+
+ return result;
+}
+
+template <typename I>
+unsigned count_histo(const mln::Image<I>& img_)
+{
+ const I& img = exact(img_);
+
+ mln_precondition(img.is_valid());
+
+ unsigned result = 0;
+
+ mln_piter(I) p(img.domain());
+
+ for_all(p)
+ result += img(p);
+
+ return result;
+}
+
+template <typename I>
+unsigned peak_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the peak of the histogram
+ unsigned v_max = mln::opt::at(histo, 0);
+ short p_max = 0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ if (v_max < histo(p))
+ {
+ v_max = histo(p);
+ p_max = p.ind();
+ }
+ }
+
+ return p_max;
+}
+
+template <typename I>
+unsigned mean_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the mean of the histogram
+ float sum = 0;
+ float mean = 0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ sum += histo(p);
+ mean += p.ind()*histo(p);
+ }
+
+ mean = mean / sum;
+
+ return mean;
+}
+
+
+float hue_test(const std::string input,
+ const std::string output,
+ const std::string tmp,
+ const unsigned threshold)
+
+{
+ typedef mln::fun::v2v::rgb_to_hue_map<8> t_rgb_to_hue_map;
+
+ mln::image2d<mln::value::rgb8> input_rgb8;
+ mln::image2d<mln::value::int_u8> map;
+ mln::image1d<unsigned> histo;
+ unsigned cnt1;
+ unsigned cnt2;
+ float prop;
+ unsigned peak;
+ mln::value::rgb8 color;
+
+ mln::io::ppm::load(input_rgb8, input.c_str());
+
+ map = mln::data::transform(input_rgb8, t_rgb_to_hue_map());
+ histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map);
+ peak = mean_histo(histo); //peak_histo(histo);
+ color = label_hue(peak);
+ cnt1 = count_histo(histo | mln::box1d(mln::point1d(peak-threshold),
+ mln::point1d(peak+threshold)));
+ cnt2 = mln::geom::nsites(input_rgb8);
+ prop = ((100.0 * cnt1) / cnt2);
+
+ mln::io::plot::save_image_sh(histo, output.c_str());
+ mln::io::pgm::save(map, tmp.c_str());
+ std::cout << "peak = " << peak << std::endl;
+ std::cout << "color = " << color << std::endl;
+
+ return prop;
+}
+
+
+int main()
+{
+ typedef boost::filesystem::path t_path;
+ typedef boost::filesystem::directory_iterator t_iter_path;
+
+ t_path full_path[] = {t_path(ICDAR_20P_PPM_IMG_PATH)};
+
+ for (int i = 0; i < 1; ++i)
+ {
+ std::cout << "entering " << full_path[i] << std::endl;
+
+ if (boost::filesystem::exists(full_path[i]) &&
+ boost::filesystem::is_directory(full_path[i]))
+ {
+ boost::filesystem::system_complete(full_path[i]);
+ const t_iter_path end_iter;
+ float prop = 0.0;
+
+ for (t_iter_path dir_iter(full_path[i]); end_iter != dir_iter; ++dir_iter)
+ {
+ // concatenation de chaine
+ t_path directory(ANNOTATING_HUE_RET_PATH);
+ t_path leaf = dir_iter->path().leaf();
+ t_path output = change_extension(directory / leaf, ".sh");
+ t_path tmp = change_extension(directory / leaf, ".pgm");
+
+ prop = hue_test(dir_iter->path().string(),
+ output.string(),
+ tmp.string(),
+ 20);
+
+ std::cout << output << " : " << prop << std::endl;
+ std::cerr << output << " : " << prop << std::endl;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-color.txt b/milena/sandbox/green/exp/annotating/hue/text-color.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-color.txt
copy to milena/sandbox/green/exp/annotating/hue/text-color.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-img.txt b/milena/sandbox/green/exp/annotating/hue/text-img.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-img.txt
copy to milena/sandbox/green/exp/annotating/hue/text-img.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-only.txt b/milena/sandbox/green/exp/annotating/hue/text-only.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-only.txt
copy to milena/sandbox/green/exp/annotating/hue/text-only.txt
--
1.5.6.5
1
0
21 Jun '10
* green/exp/annotating/hue: New directory.
* green/exp/annotating/hue/Makefile.am: New Makefile.
* green/exp/annotating/hue/hue.cc: New source file.
* green/exp/annotating/hue/text-color.txt: New image class.
* green/exp/annotating/hue/text-img.txt: New image class.
* green/exp/annotating/hue/text-only.txt: New image class.
---
milena/sandbox/ChangeLog | 11 +
.../annotating/{achromastism => hue}/Makefile.am | 0
milena/sandbox/green/exp/annotating/hue/hue.cc | 291 ++++++++++++++++++++
.../{achromastism => hue}/text-color.txt | 0
.../annotating/{achromastism => hue}/text-img.txt | 0
.../annotating/{achromastism => hue}/text-only.txt | 0
6 files changed, 302 insertions(+), 0 deletions(-)
copy milena/sandbox/green/exp/annotating/{achromastism => hue}/Makefile.am (100%)
create mode 100644 milena/sandbox/green/exp/annotating/hue/hue.cc
copy milena/sandbox/green/exp/annotating/{achromastism => hue}/text-color.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => hue}/text-img.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => hue}/text-only.txt (100%)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 074b0fc..2b14f89 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -79,6 +79,17 @@
Work on Millet saturation descriptor.
+ * green/exp/annotating/hue: New directory.
+ * green/exp/annotating/hue/Makefile.am: New Makefile.
+ * green/exp/annotating/hue/hue.cc: New source file.
+ * green/exp/annotating/hue/text-color.txt: New image class.
+ * green/exp/annotating/hue/text-img.txt: New image class.
+ * green/exp/annotating/hue/text-only.txt: New image class.
+
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Work on Millet saturation descriptor.
+
* green/exp/annotating/saturation: New directory.
* green/exp/annotating/saturation/Makefile.am: New Makefile.
* green/exp/annotating/saturation/saturation.cc: New source file.
diff --git a/milena/sandbox/green/exp/annotating/achromastism/Makefile.am b/milena/sandbox/green/exp/annotating/hue/Makefile.am
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/Makefile.am
copy to milena/sandbox/green/exp/annotating/hue/Makefile.am
diff --git a/milena/sandbox/green/exp/annotating/hue/hue.cc b/milena/sandbox/green/exp/annotating/hue/hue.cc
new file mode 100644
index 0000000..883e1c6
--- /dev/null
+++ b/milena/sandbox/green/exp/annotating/hue/hue.cc
@@ -0,0 +1,291 @@
+// SATURATION TEST CF MILLET 2008
+
+#include <iostream>
+#include <sstream>
+#include <boost/filesystem.hpp>
+
+#include <mln/img_path.hh>
+
+#include <mln/accu/stat/histo1d.hh>
+
+#include <mln/core/image/image1d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/image/dmorph/image_if.hh>
+
+#include <mln/data/compute.hh>
+#include <mln/data/stretch.hh>
+#include <mln/data/transform.hh>
+
+#include <mln/literal/colors.hh>
+#include <mln/literal/grays.hh>
+
+#include <mln/math/max.hh>
+#include <mln/math/min.hh>
+
+#include <mln/opt/at.hh>
+
+#include <mln/geom/nsites.hh>
+
+#include <mln/fun/v2v/rgb_to_hue_map.hh>
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/pgm/save.hh>
+#include <mln/io/plot/save_image_sh.hh>
+
+#include <mln/value/rgb8.hh>
+
+mln::value::rgb8 label_val(const mln::value::int_u8 val)
+{
+ mln::value::rgb8 result;
+
+ if (82 > val)
+ result = mln::literal::black;
+ else if (179 > val)
+ result= mln::literal::medium_gray;
+ else
+ result = mln::literal::white;
+
+ return result;
+}
+
+
+mln::value::rgb8 label_orange_or_brown(const mln::value::rgb8 color,
+ const mln::value::int_u8 sat,
+ const mln::value::int_u8 val)
+{
+ mln::value::rgb8 result;
+
+ if (mln::literal::orange == color)
+ {
+ unsigned dist_orange = mln::math::abs(sat - 184)
+ + mln::math::abs(val - 65);
+
+ unsigned dist_brown = mln::math::abs(sat - 255)
+ + mln::math::abs(val - 125);
+
+ if (dist_orange < dist_brown)
+ result = mln::literal::orange;
+ else
+ result = mln::literal::brown;
+ }
+ else
+ result = color;
+
+ return result;
+}
+
+mln::value::rgb8 label_yellow_or_green(const mln::value::rgb8 color,
+ const mln::value::int_u8 val)
+{
+ mln::value::rgb8 result;
+
+ if (mln::literal::yellow == color)
+ {
+ // Is it green or yellow ?
+ if (80 > val)
+ result = mln::literal::green;
+ else
+ result = mln::literal::yellow;
+ }
+ else
+ return color;
+
+ return result;
+}
+
+mln::value::rgb8 label_hue(const mln::value::int_u8 hue)
+{
+ mln::value::rgb8 result;
+
+
+ if (10 > hue)
+ result = mln::literal::red;
+ else if (32 > hue)
+ result = mln::literal::orange;
+ else if (53 > hue)
+ result = mln::literal::yellow;
+ else if (74 > hue)
+ result = mln::literal::green; // chartreuse
+ else if (96 > hue)
+ result = mln::literal::green;
+ else if (116 > hue)
+ result = mln::literal::green;// turquoise, aigue-marine
+ else if (138 > hue)
+ result = mln::literal::green; // cyan
+ else if (159 > hue)
+ result = mln::literal::blue; // azur
+ else if (181 > hue)
+ result = mln::literal::blue;
+ else if (202 > hue)
+ result = mln::literal::violet;
+ else if (223 > hue)
+ result = mln::literal::pink;
+ else // if (244 > hue)
+ result = mln::literal::red;
+
+
+// if (14 > hue)
+// result = mln::literal::red;
+// else if (29 > hue)
+// result = mln::literal::orange;
+// else if (45 > hue)
+// result = mln::literal::yellow;
+// else if (113 > hue)
+// result = mln::literal::green;
+// else if (149 > hue)
+// result = mln::literal::cyan;
+// else if (205 > hue)
+// result = mln::literal::blue;
+// else if (235 > hue)
+// result = mln::literal::violet;
+// else if (242 > hue)
+// result = mln::literal::pink;
+// else
+// result = mln::literal::red;
+
+ return result;
+}
+
+template <typename I>
+unsigned count_histo(const mln::Image<I>& img_)
+{
+ const I& img = exact(img_);
+
+ mln_precondition(img.is_valid());
+
+ unsigned result = 0;
+
+ mln_piter(I) p(img.domain());
+
+ for_all(p)
+ result += img(p);
+
+ return result;
+}
+
+template <typename I>
+unsigned peak_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the peak of the histogram
+ unsigned v_max = mln::opt::at(histo, 0);
+ short p_max = 0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ if (v_max < histo(p))
+ {
+ v_max = histo(p);
+ p_max = p.ind();
+ }
+ }
+
+ return p_max;
+}
+
+template <typename I>
+unsigned mean_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the mean of the histogram
+ float sum = 0;
+ float mean = 0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ sum += histo(p);
+ mean += p.ind()*histo(p);
+ }
+
+ mean = mean / sum;
+
+ return mean;
+}
+
+
+float hue_test(const std::string input,
+ const std::string output,
+ const std::string tmp,
+ const unsigned threshold)
+
+{
+ typedef mln::fun::v2v::rgb_to_hue_map<8> t_rgb_to_hue_map;
+
+ mln::image2d<mln::value::rgb8> input_rgb8;
+ mln::image2d<mln::value::int_u8> map;
+ mln::image1d<unsigned> histo;
+ unsigned cnt1;
+ unsigned cnt2;
+ float prop;
+ unsigned peak;
+ mln::value::rgb8 color;
+
+ mln::io::ppm::load(input_rgb8, input.c_str());
+
+ map = mln::data::transform(input_rgb8, t_rgb_to_hue_map());
+ histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map);
+ peak = mean_histo(histo); //peak_histo(histo);
+ color = label_hue(peak);
+ cnt1 = count_histo(histo | mln::box1d(mln::point1d(peak-threshold),
+ mln::point1d(peak+threshold)));
+ cnt2 = mln::geom::nsites(input_rgb8);
+ prop = ((100.0 * cnt1) / cnt2);
+
+ mln::io::plot::save_image_sh(histo, output.c_str());
+ mln::io::pgm::save(map, tmp.c_str());
+ std::cout << "peak = " << peak << std::endl;
+ std::cout << "color = " << color << std::endl;
+
+ return prop;
+}
+
+
+int main()
+{
+ typedef boost::filesystem::path t_path;
+ typedef boost::filesystem::directory_iterator t_iter_path;
+
+ t_path full_path[] = {t_path(ICDAR_20P_PPM_IMG_PATH)};
+
+ for (int i = 0; i < 1; ++i)
+ {
+ std::cout << "entering " << full_path[i] << std::endl;
+
+ if (boost::filesystem::exists(full_path[i]) &&
+ boost::filesystem::is_directory(full_path[i]))
+ {
+ boost::filesystem::system_complete(full_path[i]);
+ const t_iter_path end_iter;
+ float prop = 0.0;
+
+ for (t_iter_path dir_iter(full_path[i]); end_iter != dir_iter; ++dir_iter)
+ {
+ // concatenation de chaine
+ t_path directory(ANNOTATING_HUE_RET_PATH);
+ t_path leaf = dir_iter->path().leaf();
+ t_path output = change_extension(directory / leaf, ".sh");
+ t_path tmp = change_extension(directory / leaf, ".pgm");
+
+ prop = hue_test(dir_iter->path().string(),
+ output.string(),
+ tmp.string(),
+ 20);
+
+ std::cout << output << " : " << prop << std::endl;
+ std::cerr << output << " : " << prop << std::endl;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-color.txt b/milena/sandbox/green/exp/annotating/hue/text-color.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-color.txt
copy to milena/sandbox/green/exp/annotating/hue/text-color.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-img.txt b/milena/sandbox/green/exp/annotating/hue/text-img.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-img.txt
copy to milena/sandbox/green/exp/annotating/hue/text-img.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-only.txt b/milena/sandbox/green/exp/annotating/hue/text-only.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-only.txt
copy to milena/sandbox/green/exp/annotating/hue/text-only.txt
--
1.5.6.5
1
0
21 Jun '10
* green/exp/annotating/saturation: New directory.
* green/exp/annotating/saturation/Makefile.am: New Makefile.
* green/exp/annotating/saturation/saturation.cc: New source file.
---
milena/sandbox/ChangeLog | 14 ++++++++-
.../{achromastism => saturation}/Makefile.am | 0
.../achromastism.cc => saturation/saturation.cc} | 30 ++++++++++++--------
.../{achromastism => saturation}/text-color.txt | 0
.../{achromastism => saturation}/text-img.txt | 0
.../{achromastism => saturation}/text-only.txt | 0
6 files changed, 31 insertions(+), 13 deletions(-)
copy milena/sandbox/green/exp/annotating/{achromastism => saturation}/Makefile.am (100%)
copy milena/sandbox/green/exp/annotating/{achromastism/achromastism.cc => saturation/saturation.cc} (75%)
copy milena/sandbox/green/exp/annotating/{achromastism => saturation}/text-color.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => saturation}/text-img.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => saturation}/text-only.txt (100%)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 15be8a1..eb301e5 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,9 +1,21 @@
2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Work on Millet saturation descriptor.
+
+ * green/exp/annotating/saturation: New directory.
+ * green/exp/annotating/saturation/Makefile.am: New Makefile.
+ * green/exp/annotating/saturation/saturation.cc: New source file.
+ * green/exp/annotating/saturation/text-color.txt: New image class.
+ * green/exp/annotating/saturation/text-img.txt: New image class.
+ * green/exp/annotating/saturation/text-only.txt: New image class.
+
+
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Work on Millet hsv descriptors.
* green/exp/annotating/hsv: New directory.
- * green/Exp/annotating/hsv/hsv.cc: New source file.
+ * green/exp/annotating/hsv/hsv.cc: New source file.
2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
diff --git a/milena/sandbox/green/exp/annotating/achromastism/Makefile.am b/milena/sandbox/green/exp/annotating/saturation/Makefile.am
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/Makefile.am
copy to milena/sandbox/green/exp/annotating/saturation/Makefile.am
diff --git a/milena/sandbox/green/exp/annotating/achromastism/achromastism.cc b/milena/sandbox/green/exp/annotating/saturation/saturation.cc
similarity index 75%
copy from milena/sandbox/green/exp/annotating/achromastism/achromastism.cc
copy to milena/sandbox/green/exp/annotating/saturation/saturation.cc
index fdb8e6d..3eb27a4 100644
--- a/milena/sandbox/green/exp/annotating/achromastism/achromastism.cc
+++ b/milena/sandbox/green/exp/annotating/saturation/saturation.cc
@@ -1,4 +1,4 @@
-// ACHROMATISM TEST CF MILLET 2008
+// SATURATION TEST CF MILLET 2008
#include <iostream>
#include <sstream>
@@ -21,9 +21,10 @@
#include <mln/geom/nsites.hh>
-#include <mln/fun/v2v/rgb_to_achromatism_map.hh>
+#include <mln/fun/v2v/rgb_to_saturation_map.hh>
#include <mln/io/ppm/load.hh>
+//#include <mln/io/pgm/save.hh>
#include <mln/io/plot/save_image_sh.hh>
#include <mln/value/rgb8.hh>
@@ -45,12 +46,14 @@ unsigned count_histo(const mln::Image<I>& img_)
return result;
}
-float achromatism_test(const std::string input,
- const std::string output,
- const unsigned threshold)
+
+float saturation_test(const std::string input,
+ const std::string output,
+// const std::string tmp,
+ const unsigned threshold)
{
- typedef mln::fun::v2v::rgb_to_achromatism_map<8> t_rgb_to_achromatism_map;
+ typedef mln::fun::v2v::rgb_to_saturation_map<8> t_rgb_to_saturation_map;
mln::image2d<mln::value::rgb8> input_rgb8;
mln::image2d<mln::value::int_u8> map;
@@ -61,7 +64,7 @@ float achromatism_test(const std::string input,
mln::io::ppm::load(input_rgb8, input.c_str());
- map = mln::data::transform(input_rgb8, t_rgb_to_achromatism_map());
+ map = mln::data::transform(input_rgb8, t_rgb_to_saturation_map());
histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map);
cnt1 = count_histo(histo | mln::box1d(mln::point1d(0),
mln::point1d(threshold)));
@@ -69,6 +72,7 @@ float achromatism_test(const std::string input,
prop = ((100.0 * cnt1) / cnt2);
mln::io::plot::save_image_sh(histo, output.c_str());
+// mln::io::pgm::save(map, tmp.c_str());
return prop;
}
@@ -95,13 +99,15 @@ int main()
for (t_iter_path dir_iter(full_path[i]); end_iter != dir_iter; ++dir_iter)
{
// concatenation de chaine
- t_path directory(ANNOTATING_ACHROMATISM_RET_PATH);
- t_path leaf = dir_iter->path().leaf();
+ t_path directory(ANNOTATING_SATURATION_RET_PATH);
+ t_path leaf = dir_iter->path().leaf();
t_path output = change_extension(directory / leaf, ".sh");
+ t_path tmp = change_extension(directory / leaf, ".pgm");
- prop = achromatism_test(dir_iter->path().string(),
- output.string(),
- 11);
+ prop = saturation_test(dir_iter->path().string(),
+ output.string(),
+// tmp.string(),
+ 25);
std::cout << output << " : " << prop << std::endl;
std::cerr << output << " : " << prop << std::endl;
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-color.txt b/milena/sandbox/green/exp/annotating/saturation/text-color.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-color.txt
copy to milena/sandbox/green/exp/annotating/saturation/text-color.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-img.txt b/milena/sandbox/green/exp/annotating/saturation/text-img.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-img.txt
copy to milena/sandbox/green/exp/annotating/saturation/text-img.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-only.txt b/milena/sandbox/green/exp/annotating/saturation/text-only.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-only.txt
copy to milena/sandbox/green/exp/annotating/saturation/text-only.txt
--
1.5.6.5
1
0
21 Jun '10
* green/exp/annotating/saturation: New directory.
* green/exp/annotating/saturation/Makefile.am: New Makefile.
* green/exp/annotating/saturation/saturation.cc: New source file.
---
milena/sandbox/ChangeLog | 14 ++++++++-
.../{achromastism => saturation}/Makefile.am | 0
.../achromastism.cc => saturation/saturation.cc} | 30 ++++++++++++--------
.../{achromastism => saturation}/text-color.txt | 0
.../{achromastism => saturation}/text-img.txt | 0
.../{achromastism => saturation}/text-only.txt | 0
6 files changed, 31 insertions(+), 13 deletions(-)
copy milena/sandbox/green/exp/annotating/{achromastism => saturation}/Makefile.am (100%)
copy milena/sandbox/green/exp/annotating/{achromastism/achromastism.cc => saturation/saturation.cc} (75%)
copy milena/sandbox/green/exp/annotating/{achromastism => saturation}/text-color.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => saturation}/text-img.txt (100%)
copy milena/sandbox/green/exp/annotating/{achromastism => saturation}/text-only.txt (100%)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 6a47420..074b0fc 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -77,10 +77,22 @@
2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Work on Millet saturation descriptor.
+
+ * green/exp/annotating/saturation: New directory.
+ * green/exp/annotating/saturation/Makefile.am: New Makefile.
+ * green/exp/annotating/saturation/saturation.cc: New source file.
+ * green/exp/annotating/saturation/text-color.txt: New image class.
+ * green/exp/annotating/saturation/text-img.txt: New image class.
+ * green/exp/annotating/saturation/text-only.txt: New image class.
+
+
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Work on Millet hsv descriptors.
* green/exp/annotating/hsv: New directory.
- * green/Exp/annotating/hsv/hsv.cc: New source file.
+ * green/exp/annotating/hsv/hsv.cc: New source file.
2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
diff --git a/milena/sandbox/green/exp/annotating/achromastism/Makefile.am b/milena/sandbox/green/exp/annotating/saturation/Makefile.am
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/Makefile.am
copy to milena/sandbox/green/exp/annotating/saturation/Makefile.am
diff --git a/milena/sandbox/green/exp/annotating/achromastism/achromastism.cc b/milena/sandbox/green/exp/annotating/saturation/saturation.cc
similarity index 75%
copy from milena/sandbox/green/exp/annotating/achromastism/achromastism.cc
copy to milena/sandbox/green/exp/annotating/saturation/saturation.cc
index fdb8e6d..3eb27a4 100644
--- a/milena/sandbox/green/exp/annotating/achromastism/achromastism.cc
+++ b/milena/sandbox/green/exp/annotating/saturation/saturation.cc
@@ -1,4 +1,4 @@
-// ACHROMATISM TEST CF MILLET 2008
+// SATURATION TEST CF MILLET 2008
#include <iostream>
#include <sstream>
@@ -21,9 +21,10 @@
#include <mln/geom/nsites.hh>
-#include <mln/fun/v2v/rgb_to_achromatism_map.hh>
+#include <mln/fun/v2v/rgb_to_saturation_map.hh>
#include <mln/io/ppm/load.hh>
+//#include <mln/io/pgm/save.hh>
#include <mln/io/plot/save_image_sh.hh>
#include <mln/value/rgb8.hh>
@@ -45,12 +46,14 @@ unsigned count_histo(const mln::Image<I>& img_)
return result;
}
-float achromatism_test(const std::string input,
- const std::string output,
- const unsigned threshold)
+
+float saturation_test(const std::string input,
+ const std::string output,
+// const std::string tmp,
+ const unsigned threshold)
{
- typedef mln::fun::v2v::rgb_to_achromatism_map<8> t_rgb_to_achromatism_map;
+ typedef mln::fun::v2v::rgb_to_saturation_map<8> t_rgb_to_saturation_map;
mln::image2d<mln::value::rgb8> input_rgb8;
mln::image2d<mln::value::int_u8> map;
@@ -61,7 +64,7 @@ float achromatism_test(const std::string input,
mln::io::ppm::load(input_rgb8, input.c_str());
- map = mln::data::transform(input_rgb8, t_rgb_to_achromatism_map());
+ map = mln::data::transform(input_rgb8, t_rgb_to_saturation_map());
histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map);
cnt1 = count_histo(histo | mln::box1d(mln::point1d(0),
mln::point1d(threshold)));
@@ -69,6 +72,7 @@ float achromatism_test(const std::string input,
prop = ((100.0 * cnt1) / cnt2);
mln::io::plot::save_image_sh(histo, output.c_str());
+// mln::io::pgm::save(map, tmp.c_str());
return prop;
}
@@ -95,13 +99,15 @@ int main()
for (t_iter_path dir_iter(full_path[i]); end_iter != dir_iter; ++dir_iter)
{
// concatenation de chaine
- t_path directory(ANNOTATING_ACHROMATISM_RET_PATH);
- t_path leaf = dir_iter->path().leaf();
+ t_path directory(ANNOTATING_SATURATION_RET_PATH);
+ t_path leaf = dir_iter->path().leaf();
t_path output = change_extension(directory / leaf, ".sh");
+ t_path tmp = change_extension(directory / leaf, ".pgm");
- prop = achromatism_test(dir_iter->path().string(),
- output.string(),
- 11);
+ prop = saturation_test(dir_iter->path().string(),
+ output.string(),
+// tmp.string(),
+ 25);
std::cout << output << " : " << prop << std::endl;
std::cerr << output << " : " << prop << std::endl;
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-color.txt b/milena/sandbox/green/exp/annotating/saturation/text-color.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-color.txt
copy to milena/sandbox/green/exp/annotating/saturation/text-color.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-img.txt b/milena/sandbox/green/exp/annotating/saturation/text-img.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-img.txt
copy to milena/sandbox/green/exp/annotating/saturation/text-img.txt
diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-only.txt b/milena/sandbox/green/exp/annotating/saturation/text-only.txt
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/text-only.txt
copy to milena/sandbox/green/exp/annotating/saturation/text-only.txt
--
1.5.6.5
1
0
* green/exp/annotating/hsv: New directory.
* green/Exp/annotating/hsv/hsv.cc: New source file.
---
milena/sandbox/ChangeLog | 24 +
.../annotating/{achromastism => hsv}/Makefile.am | 0
milena/sandbox/green/exp/annotating/hsv/hsv.cc | 652 ++++++++++++++++++++
3 files changed, 676 insertions(+), 0 deletions(-)
copy milena/sandbox/green/exp/annotating/{achromastism => hsv}/Makefile.am (100%)
create mode 100644 milena/sandbox/green/exp/annotating/hsv/hsv.cc
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index cc4634d..15be8a1 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,5 +1,28 @@
2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Work on Millet hsv descriptors.
+
+ * green/exp/annotating/hsv: New directory.
+ * green/Exp/annotating/hsv/hsv.cc: New source file.
+
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Work on histograms view as density.
+
+ * green/exp/annotating/histo: New directory.
+ * green/exp/annotating/histo/histo.cc: New Makefile.am.
+ * green/exp/annotating/histo/histo.cc: New source.
+
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Test error quantification as a color descriptor in our database.
+
+ * green/exp/annotating/error: New directory.
+ * green/exp/annotating/error/Makefile.am: New Makefile.
+ * green/exp/annotating/error/error.cc: New source.
+
+2010-06-21 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Benchmark few descriptors.
* green/exp/annotating/bench: New directory.
@@ -10,6 +33,7 @@
Test on image database the achromatism descriptor.
+ * green/exp/annotating/achromatism: New directory.
* green/exp/annotating/achromatism/Makefile.am: New Makefile.
* green/exp/annotating/achromatism/achromatism.am: New source.
* green/exp/annotating/achromatism/text-color.txt: New image class.
diff --git a/milena/sandbox/green/exp/annotating/achromastism/Makefile.am b/milena/sandbox/green/exp/annotating/hsv/Makefile.am
similarity index 100%
copy from milena/sandbox/green/exp/annotating/achromastism/Makefile.am
copy to milena/sandbox/green/exp/annotating/hsv/Makefile.am
diff --git a/milena/sandbox/green/exp/annotating/hsv/hsv.cc b/milena/sandbox/green/exp/annotating/hsv/hsv.cc
new file mode 100644
index 0000000..2aa9113
--- /dev/null
+++ b/milena/sandbox/green/exp/annotating/hsv/hsv.cc
@@ -0,0 +1,652 @@
+// HSV TEST CF MILLET 2008
+
+#include <iostream>
+#include <sstream>
+#include <boost/filesystem.hpp>
+
+#include <mln/img_path.hh>
+
+#include <mln/accu/stat/histo1d.hh>
+
+#include <mln/arith/minus.hh>
+#include <mln/arith/div.hh>
+
+#include <mln/core/image/image1d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/image/dmorph/image_if.hh>
+
+#include <mln/data/convert.hh>
+#include <mln/data/compute.hh>
+#include <mln/data/stretch.hh>
+#include <mln/data/transform.hh>
+
+#include <mln/literal/zero.hh>
+#include <mln/literal/colors.hh>
+#include <mln/literal/grays.hh>
+
+#include <mln/math/max.hh>
+#include <mln/math/min.hh>
+#include <mln/math/sqr.hh>
+#include <mln/math/sqrt.hh>
+
+#include <mln/opt/at.hh>
+
+#include <mln/geom/nsites.hh>
+
+#include <mln/fun/v2v/rgb_to_hue_map.hh>
+#include <mln/fun/v2v/rgb_to_saturation_map.hh>
+#include <mln/fun/v2v/rgb_to_value_map.hh>
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/pgm/save.hh>
+#include <mln/io/plot/save_image_sh.hh>
+
+#include <mln/value/rgb8.hh>
+
+//============================================================================//
+// HISTOGRAM
+//============================================================================//
+
+template <typename I>
+mln_value(I) count_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ mln_value(I) result = mln::literal::zero;
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ result += histo(p);
+
+ return result;
+}
+
+template <typename I>
+mln_value(I) sum_frequency_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ mln_value(I) sum = mln::literal::zero;
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ sum += histo(p);
+
+ return sum;
+}
+
+template <typename I>
+mln_value(I) count_null_frequency_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ mln_value(I) count = mln::literal::zero;
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ if (0 == histo(p))
+ count++;
+
+ return count;
+}
+
+template <typename I>
+mln_coord(mln_site_(I)) peak_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the peak of the histogram
+ mln_value(I) v_max = mln::opt::at(histo, mln::literal::zero);
+ mln_coord(mln_site_(I)) p_max = mln::literal::zero;
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ if (v_max < histo(p))
+ {
+ v_max = histo(p);
+ p_max = p.ind();
+ }
+ }
+
+ return p_max;
+}
+
+template <typename I>
+mln_value(I) max_frequency_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the value of the peak from the histogram
+ mln_value(I) max = mln::opt::at(histo, mln::literal::zero);
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ max = mln::math::max(histo(p),max);
+ }
+
+ return max;
+}
+
+template <typename I>
+float mean_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the mean of the histogram
+ float sum = 0;
+ float mean = 0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ sum += histo(p);
+ mean += p.ind()*histo(p);
+ }
+
+ mean = mean / sum;
+
+ return mean;
+}
+
+template <typename I>
+float cmp_equi_frequency_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the mean of the histogram
+ float sum = 0;
+ float var = 0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ sum += histo(p);
+ var += mln::math::sqr(histo(p) - (1/256.0));
+ }
+
+ var = var / sum;
+
+ return var;
+}
+
+template <typename I>
+float var_histo(const mln::Image<I>& histo_, float mean)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the mean of the histogram
+ float sum = 0;
+ float var = 0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ sum += histo(p);
+ var += mln::math::sqr(p.ind() - mean) * histo(p);
+ }
+
+ var = var / sum;
+
+ return var;
+}
+
+template <typename I>
+float mean_frequency_histo(const mln::Image<I>& histo_)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the mean of the histogram
+ float sum = 0;
+ float mean = 0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ sum++;
+ mean += histo(p);
+ }
+
+ mean = mean / sum;
+
+ return mean;
+}
+
+template <typename I>
+float stddev_frequency_histo(const mln::Image<I>& histo_, float mean)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Find the var of the histogram
+ float sum = 0;
+ float var = 0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ sum++;
+ var += mln::math::sqr(histo(p)-mean);
+ }
+
+ var = mln::math::sqrt(var / sum);
+
+ return var;
+}
+
+
+//============================================================================//
+// HUE TEST
+//============================================================================//
+
+mln::value::rgb8 label_val(const mln::value::int_u8 val)
+{
+ mln::value::rgb8 result;
+
+ if (82 > val)
+ result = mln::literal::black;
+ else if (179 > val)
+ result= mln::literal::medium_gray;
+ else
+ result = mln::literal::white;
+
+ return result;
+}
+
+
+mln::value::rgb8 label_orange_or_brown(const mln::value::rgb8 color,
+ const mln::value::int_u8 sat,
+ const mln::value::int_u8 val)
+{
+ mln::value::rgb8 result;
+
+ if (mln::literal::orange == color)
+ {
+ unsigned dist_orange = mln::math::abs(sat - 184)
+ + mln::math::abs(val - 65);
+
+ unsigned dist_brown = mln::math::abs(sat - 255)
+ + mln::math::abs(val - 125);
+
+ if (dist_orange < dist_brown)
+ result = mln::literal::orange;
+ else
+ result = mln::literal::brown;
+ }
+ else
+ result = color;
+
+ return result;
+}
+
+mln::value::rgb8 label_yellow_or_green(const mln::value::rgb8 color,
+ const mln::value::int_u8 val)
+{
+ mln::value::rgb8 result;
+
+ if (mln::literal::yellow == color)
+ {
+ // Is it green or yellow ?
+ if (80 > val)
+ result = mln::literal::green;
+ else
+ result = mln::literal::yellow;
+ }
+ else
+ return color;
+
+ return result;
+}
+
+mln::value::rgb8 label_hue(const mln::value::int_u8 hue)
+{
+ mln::value::rgb8 result;
+
+
+ if (10 > hue)
+ result = mln::literal::red;
+ else if (32 > hue)
+ result = mln::literal::orange;
+ else if (53 > hue)
+ result = mln::literal::yellow;
+ else if (74 > hue)
+ result = mln::literal::green; // chartreuse
+ else if (96 > hue)
+ result = mln::literal::green;
+ else if (116 > hue)
+ result = mln::literal::green;// turquoise, aigue-marine
+ else if (138 > hue)
+ result = mln::literal::green; // cyan
+ else if (159 > hue)
+ result = mln::literal::blue; // azur
+ else if (181 > hue)
+ result = mln::literal::blue;
+ else if (202 > hue)
+ result = mln::literal::violet;
+ else if (223 > hue)
+ result = mln::literal::pink;
+ else // if (244 > hue)
+ result = mln::literal::red;
+
+ return result;
+}
+
+float hue_test(const std::string input,
+ const std::string output,
+ const std::string tmp,
+ const short threshold)
+
+{
+ typedef mln::fun::v2v::rgb_to_hue_map<8> t_rgb_to_hue_map;
+
+ mln::image2d<mln::value::rgb8> input_rgb8;
+ mln::image2d<mln::value::int_u8> map;
+ mln::image1d<unsigned> histo;
+ mln::image1d<float> histo_float;
+ float cnt1;
+ float cnt2;
+ float prop;
+ short peak;
+ mln::value::rgb8 color;
+ float sum;
+ mln::point1d inf;
+ mln::point1d sup;
+
+ mln::io::ppm::load(input_rgb8, input.c_str());
+
+ map = mln::data::transform(input_rgb8, t_rgb_to_hue_map());
+ histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map);
+ sum = sum_frequency_histo(histo);
+ histo_float = mln::data::convert(float(), histo) / sum;
+ peak = mean_histo(histo); //peak_histo(histo);
+ color = label_hue(peak);
+ inf = mln::point1d(mln::math::max(0, peak-threshold));
+ sup = mln::point1d(mln::math::min(255, peak+threshold));
+ cnt1 = count_histo(histo_float|mln::box1d(inf,sup));
+ cnt2 = count_histo(histo_float);
+ prop = ((100.0 * cnt1) / cnt2);
+
+ mln::io::plot::save_image_sh(histo_float, output.c_str());
+ mln::io::pgm::save(map, tmp.c_str());
+// std::cout << "peak = " << peak << std::endl;
+// std::cout << "color = " << color << std::endl;
+
+ return prop;
+}
+
+//============================================================================//
+// SATURATION TEST
+//============================================================================//
+
+float saturation_test(const std::string input,
+ const std::string output,
+ const std::string tmp,
+ const short threshold)
+
+{
+ typedef mln::fun::v2v::rgb_to_saturation_map<8> t_rgb_to_saturation_map;
+
+ mln::image2d<mln::value::rgb8> input_rgb8;
+ mln::image2d<mln::value::int_u8> map;
+ mln::image1d<unsigned> histo;
+ mln::image1d<float> histo_float;
+ float cnt1;
+ float cnt2;
+ float sum;
+ float prop;
+
+ mln::io::ppm::load(input_rgb8, input.c_str());
+
+ map = mln::data::transform(input_rgb8, t_rgb_to_saturation_map());
+ histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map);
+ sum = sum_frequency_histo(histo);
+ histo_float = mln::data::convert(float(), histo) / sum;
+ cnt1 = count_histo(histo_float | mln::box1d(mln::point1d(0),
+ mln::point1d(threshold)));
+ cnt2 = count_histo(histo_float);
+ prop = ((100.0 * cnt1) / cnt2);
+
+ mln::io::plot::save_image_sh(histo_float, output.c_str());
+ mln::io::pgm::save(map, tmp.c_str());
+
+ return prop;
+}
+
+//============================================================================//
+// VALUE TEST
+//============================================================================//
+
+// calcul de contribution
+float r(short p, unsigned histo_p, short x, unsigned histo_x)
+{
+ float result = mln::math::sqr(((float)histo_x / histo_p) * (x-p));
+
+ return result;
+}
+
+template <typename I>
+float stddev3(const mln::Image<I>& histo_, unsigned peak)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ // Compute stddev
+
+ float stddev = 0.0;
+
+ mln_piter(I) p(histo.domain());
+
+ for_all(p)
+ {
+ stddev += r((short)peak, mln::opt::at(histo,peak), p.ind(), histo(p));
+ }
+
+ return stddev;
+}
+
+template <typename I>
+float stddev2(const mln::Image<I>& histo_, unsigned peak, unsigned limit)
+{
+ const I& histo = exact(histo_);
+
+ mln_precondition(histo.is_valid());
+
+ float stddev_low = 0.0;
+ float stddev_up = 0.0;
+ float ret = 0.0;
+
+ // A transformer avec des iterators
+
+ if (250 > peak)
+ stddev_up = stddev3(histo |mln::box1d(mln::point1d(peak+1),
+ mln::point1d(peak+limit)), peak);
+
+ if (5 < peak)
+ stddev_low = stddev3(histo |mln::box1d(mln::point1d(peak-limit),
+ mln::point1d(peak-1)), peak);
+
+ ret = (250 < peak)? stddev_low : (5 > peak)? stddev_up :
+ (stddev_low + stddev_up)/2;
+
+ return ret;
+}
+
+// DOC:
+// la discrimination entre la base AFP et la base ICDAR peut se faire en
+// étudiant la forme des densités des niveaux de gris.
+// Les images naturelles semblent avoir un spectre recouvrant
+// en général les 256 niveaux de gris alors que les images de documents ont
+// une présence importante du fond. Dans le cadre d'une densité, ce qui est
+// alloué sur le fond ne peut se retrouver ailleurs. Une comparaison avec la
+// densité équiprobable nous renseigne donc sur la nature des images.
+// Il semble néanmoins qu'un certain nombre d'images défient ce dispositif.
+// Par exemple des gros plans sur des zones mono-teintée (ski, voile,site web).
+
+
+
+
+float value_test(const std::string input,
+ const std::string output,
+ const std::string tmp,
+ const short threshold)
+
+{
+ typedef mln::fun::v2v::rgb_to_value_map<8> t_rgb_to_value_map;
+
+ mln::image2d<mln::value::rgb8> input_rgb8;
+ mln::image2d<mln::value::int_u8> map;
+ mln::image1d<unsigned> histo;
+ mln::image1d<float> histo_float;
+ float cnt1;
+ float cnt2;
+ float prop;
+ float sum;
+ float prop4;
+ short peak;
+ mln::point1d inf;
+ mln::point1d sup;
+
+
+ mln::io::ppm::load(input_rgb8, input.c_str());
+
+ map = mln::data::transform(input_rgb8, t_rgb_to_value_map());
+ histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map);
+ sum = sum_frequency_histo(histo);
+ histo_float = mln::data::convert(float(), histo) / sum;
+ prop4 = cmp_equi_frequency_histo(histo_float);
+ peak = peak_histo(histo); // mean_histo(histo);
+ //prop = stddev2(histo, peak, threshold);
+ inf = mln::point1d(mln::math::max(0, peak-threshold));
+ sup = mln::point1d(mln::math::min(255, peak+threshold));
+ cnt1 = count_histo(histo_float|mln::box1d(inf,sup));
+ cnt2 = count_histo(histo_float);
+ prop = ((100.0 * cnt1) / cnt2);
+
+ std::cerr << "peak = " << peak << std::endl;
+ std::cerr << "inf = " << inf << std::endl;
+ std::cerr << "sup = " << sup << std::endl;
+ std::cerr << "cnt1 = " << cnt1 << std::endl;
+ std::cerr << "cnt2 = " << cnt2 << std::endl;
+ std::cerr << "prop = " << prop << std::endl;
+ std::cerr << "prop4= " << prop4 << std::endl;
+
+ mln::io::plot::save_image_sh(histo_float, output.c_str());
+ mln::io::pgm::save(map, tmp.c_str());
+
+ return prop;
+}
+
+//============================================================================//
+// MAIN
+//============================================================================//
+
+
+int main()
+{
+ typedef boost::filesystem::path t_path;
+ typedef boost::filesystem::directory_iterator t_iter_path;
+
+// t_path full_path[] = {t_path(ICDAR_20P_TEXT_ONLY_IMG_PATH),
+// t_path(ICDAR_20P_TEXT_COLOR_IMG_PATH),
+// t_path(ICDAR_20P_TEXT_PHOTO_IMG_PATH)};
+
+ t_path full_path[] = {t_path(AFP_PPM_IMG_PATH)};
+
+ std::cout << "#!/usr/bin/gnuplot" << std::endl;
+ std::cout << "set terminal x11 persist 1" << std::endl;
+ std::cout << "#HUE - SATURATION - VALUE" << std::endl;
+ std::cout << "plot '-' using 1:2 with point notitle,\\" << std::endl;
+ std::cout << " '-' using 1:2 with point notitle,\\" << std::endl;
+ std::cout << " '-' using 1:2 with point notitle" << std::endl;
+
+ for (int i = 0; i < 1; ++i)
+ {
+ if (boost::filesystem::exists(full_path[i]) &&
+ boost::filesystem::is_directory(full_path[i]))
+ {
+ boost::filesystem::system_complete(full_path[i]);
+ const t_iter_path end_iter;
+ float prop = 0.0;
+ t_path directory;
+ t_path leaf;
+ t_path output;
+ t_path tmp;
+
+ std::cerr << "entering " << full_path[i] << std::endl;
+
+ for (t_iter_path dir_iter(full_path[i]); end_iter != dir_iter; ++dir_iter)
+ {
+ std::cerr << dir_iter->path() << std::endl;
+ // concatenation de chaine
+// directory = (ANNOTATING_ICDAR_HUE_RET_PATH);
+ directory = (ANNOTATING_AFP_HUE_RET_PATH);
+ leaf = dir_iter->path().leaf();
+ output = change_extension(directory / leaf, ".sh");
+ tmp = change_extension(directory / leaf, ".pgm");
+
+ prop = hue_test(dir_iter->path().string(),
+ output.string(),
+ tmp.string(),
+ 20);
+
+ std::cout << prop << " ";
+
+// directory = (ANNOTATING_ICDAR_SAT_RET_PATH);
+ directory = (ANNOTATING_AFP_SAT_RET_PATH);
+ leaf = dir_iter->path().leaf();
+ output = change_extension(directory / leaf, ".sh");
+ tmp = change_extension(directory / leaf, ".pgm");
+
+ prop = saturation_test(dir_iter->path().string(),
+ output.string(),
+ tmp.string(),
+ 25);
+
+ std::cout << prop << " ";
+
+// directory = (ANNOTATING_ICDAR_VAL_RET_PATH);
+ directory = (ANNOTATING_AFP_VAL_RET_PATH);
+ leaf = dir_iter->path().leaf();
+ output = change_extension(directory / leaf, ".sh");
+ tmp = change_extension(directory / leaf, ".pgm");
+
+ prop = value_test(dir_iter->path().string(),
+ output.string(),
+ tmp.string(),
+ 15);
+
+ std::cout << prop << " ";
+ std::cout << "# " << dir_iter->path().leaf() << std::endl;
+ }
+ std::cout << "e" << std::endl;
+ }
+ }
+
+ return 0;
+}
--
1.5.6.5
1
0