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
September 2009
- 9 participants
- 188 discussions
14 Sep '09
* neighb2d.i: Wrap base class internal::neighb_base<W, neighb<W> >.
---
swilena/ChangeLog | 6 ++++++
swilena/neighb2d.i | 7 +++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/swilena/ChangeLog b/swilena/ChangeLog
index 3c34236..82b1467 100644
--- a/swilena/ChangeLog
+++ b/swilena/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-12 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Fix Swilena w.r.t. mln::internal::neighb_base.
+
+ * neighb2d.i: Wrap base class internal::neighb_base<W, neighb<W> >.
+
2009-07-13 Roland Levillain <roland(a)lrde.epita.fr>
Fix the Swilena distribution.
diff --git a/swilena/neighb2d.i b/swilena/neighb2d.i
index 2dd478a..ebe2bbc 100644
--- a/swilena/neighb2d.i
+++ b/swilena/neighb2d.i
@@ -41,6 +41,7 @@
%include "mln/core/macros.hh"
%include "mln/core/concept/neighborhood.hh"
+%include "mln/core/internal/neighb_base.hh"
%include "mln/core/internal/neighborhood_base.hh"
%include "mln/core/neighb.hh"
@@ -81,6 +82,12 @@
mln::window < mln::dpoint<mln::grid::square, mln::def::coord > >
>
>;
+%template() mln::internal::neighb_base<
+ mln::window< mln::dpoint< mln::grid::square, mln::def::coord > >,
+ mln::neighb<
+ mln::window< mln::dpoint< mln::grid::square, mln::def::coord > >
+ >
+ >;
// Instantiate mln::neighb2d.
%template(neighb2d)
mln::neighb< mln::window < mln::dpoint<mln::grid::square, mln::def::coord > > >;
--
1.6.4.2
1
0
13 Sep '09
* green/mln/accu/stat/histo3d_hsl.hh :Update library file.
* green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc:Update unitary test.
---
trunk/milena/sandbox/ChangeLog | 18 ++-
.../sandbox/green/mln/accu/stat/histo3d_hsl.hh | 129 ++++++++++--------
.../tests/accu/stat/histo3d_hsl/histo3d_hsl.cc | 145 ++++++++++++--------
3 files changed, 176 insertions(+), 116 deletions(-)
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 41f171a..d76c826 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,4 +1,12 @@
-2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+2009-09-13 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Save work in progress for histo and hsl. Everything is updated.
+
+ * green/mln/accu/stat/histo3d_hsl.hh :Update library file.
+ * green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc:Update unitary test.
+
+
+2009-09-13 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Delete obsolete sources.
@@ -16,11 +24,11 @@
Save work in progress for histo and hsl.
- * green/mln/accu/stat/histo3d_hsl.hh : New library file.
+ * green/mln/accu/stat/histo3d_hsl.hh : New library file.
- * green/tests/accu/stat/histo3d_hsl : New directory.
- * green/tests/accu/stat/Makefile.am : New makefile.
- * green/tests/accu/stat/histo3d_hsl.cc : New source file.
+ * green/tests/accu/stat/histo3d_hsl : New directory.
+ * green/tests/accu/stat/histo3d_hsl/Makefile.am : New makefile.
+ * green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc : New source file.
2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
diff --git a/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh
index 40da72c..c8e71ac 100644
--- a/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh
+++ b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh
@@ -67,7 +67,7 @@
#include <mln/core/alias/point3d.hh>
#include <mln/core/alias/box3d.hh>
-#include <mln/core/value/int_u.hh>
+#include <mln/value/int_u.hh>
#include <mln/trait/value/comp.hh>
#include <mln/arith/plus.hh>
@@ -78,7 +78,7 @@
#include <mln/value/ops.hh>
// make hue cyclic
-#include <mln/fun/p2p/flod.hh>
+#include <mln/fun/p2p/fold.hh>
#include <mln/core/image/dmorph/transformed_image.hh>
namespace mln
@@ -91,7 +91,7 @@ namespace mln
{
// Forward declaration
- template <typename V>
+ template <unsigned q, typename V>
struct histo3d_hsl;
} // end of namespace mln::accu::stat
@@ -102,8 +102,8 @@ namespace mln
namespace trait
{
- template <typename V>
- struct accumulator_< mln::accu::stat::histo3d_hsl<V> >
+ template <unsigned q, typename V>
+ struct accumulator_< mln::accu::stat::histo3d_hsl<q,V> >
{
typedef accumulator::has_untake::no has_untake;
typedef accumulator::has_set_value::no has_set_value;
@@ -111,10 +111,10 @@ namespace mln
typedef accumulator::when_pix::use_v when_pix;
};
- template <typename V>
+ template <unsigned q, typename V>
struct set_precise_binary_<op::eq,
- accu::stat::histo3d_hsl<V>,
- accu::stat::histo3d_hsl<V> >
+ accu::stat::histo3d_hsl<q,V>,
+ accu::stat::histo3d_hsl<q,V> >
{
typedef bool ret;
};
@@ -141,9 +141,9 @@ namespace mln
/// q is the number of bins per axe because quantification info are died.
/// we assume that V is a kind of hsl_<float,float,float>
- template <typename q, typename V>
+ template <unsigned q, typename V>
struct histo3d_hsl :
- public mln::accu::internal::base<image3d<unsigned>, histo3d_hsl<V> >
+ public mln::accu::internal::base<image3d<unsigned>, histo3d_hsl<q,V> >
{
typedef V argument;
typedef image3d<unsigned> result;
@@ -179,7 +179,7 @@ namespace mln
/// \brief Update the histogram with an other histogram.
/// \param[in] other the other histogram.
- void take(const histo3d_hsl<V>& other);
+ void take(const histo3d_hsl<q,V>& other);
/// \}
/// Accessors.
@@ -199,6 +199,15 @@ namespace mln
bool is_valid() const;
protected:
+ const float min_hue;
+ const float max_hue;
+ float step_hue;
+ const float min_lum;
+ const float max_lum;
+ float step_lum;
+ const float min_sat;
+ const float max_sat;
+ float step_sat;
result count_;
};
@@ -208,53 +217,56 @@ namespace mln
///
/// The operator compare all the bins from the two histogram.
- template <typename V>
- bool operator==(const histo3d_hsl<V>& histo1,
- const histo3d_hsl<V>& histo2);
+ template <unsigned q, typename V>
+ bool operator==(const histo3d_hsl<q,V>& histo1,
+ const histo3d_hsl<q,V>& histo2);
#ifndef MLN_INCLUDE_ONLY
- template <typename V>
+ template <unsigned q, typename V>
inline
- histo3d_hsl<V>::histo3d_hsl()
+ histo3d_hsl<q,V>::histo3d_hsl() : min_hue(0.0), max_hue(360.0),
+ min_lum(0.0), max_lum(1.0),
+ min_sat(0.0), max_sat(1.0)
{
- trace::entering("mln::accu::stat::histo3d_hsl<V>::histo3d_hsl");
+ trace::entering("mln::accu::stat::histo3d_hsl<q,V>::histo3d_hsl");
// As there is no info about preceding color space
// we ask the end user to specify the quantification he's looking for.
- count_.init_(box3d(point3d(mln_min(int_u<q>),
- mln_min(int_u<q>),
- mln_min(int_u<q>)),
- point3d(mln_max(int_u<q>),
- mln_max(int_u<q>),
- mln_max(int_u<q>))));
+ count_.init_(box3d(point3d(mln_min(value::int_u<q>),
+ mln_min(value::int_u<q>),
+ mln_min(value::int_u<q>)),
+ point3d(mln_max(value::int_u<q>),
+ mln_max(value::int_u<q>),
+ mln_max(value::int_u<q>))));
// Make the hue domain cyclic
fun::p2p::fold<point3d,1,0,0> fold_(count_.domain());
transform_domain(count_, fold_);
- // Build the interpolate ??
- // cf code igr
-
- trace::exiting("mln::accu::stat::histo3d_hsl<V>::histo3d_hsl");
+ step_hue = (max_hue - min_hue)/q;
+ step_lum = (max_lum - min_lum)/q;
+ step_sat = (max_sat - min_sat)/q;
+
+ trace::exiting("mln::accu::stat::histo3d_hsl<q,V>::histo3d_hsl");
}
- template <typename V>
+ template <unsigned q, typename V>
inline
- void histo3d_hsl<V>::init()
+ void histo3d_hsl<q,V>::init()
{
- trace::entering("mln::accu::stat::histo3d_hsl<V>::init");
+ trace::entering("mln::accu::stat::histo3d_hsl<q,V>::init");
data::fill(count_, 0);
- trace::exiting("mln::accu::stat::histo3d_hsl<V>::init");
+ trace::exiting("mln::accu::stat::histo3d_hsl<q,V>::init");
}
- template <typename V>
+ template <unsigned q, typename V>
inline
- void histo3d_hsl<V>::take(const argument& t)
+ void histo3d_hsl<q,V>::take(const argument& t)
{
- trace::entering("mln::accu::stat::histo3d_hsl<V>::take");
+ trace::entering("mln::accu::stat::histo3d_hsl<q,V>::take");
// Just convert a greyscale value (int_u8 like) to a position for an
// iterator on the resulting image.
@@ -264,57 +276,64 @@ namespace mln
// Technical way to access i° component without kwnowing the name
// mln::trait::value_<argument>::get_comp_0(t);
- ++count_(point3d(t.hue(), t.sat(), t.lum()));
+ // is def::coord1d the type of x, y, z ??
+ unsigned x = (t.hue() - min_hue)/q;
+ unsigned y = (t.lum() - min_lum)/q;
+ unsigned z = (t.sat() - min_sat)/q;
+
+ // faire attention avec les histoires de points et leurs coordonnées
+ ++count_(point3d(z, x, y));
+ //++count_(point3d(t.hue(), t.sat(), t.lum()));
- trace::exiting("mln::accu::stat::histo3d_hsl<V>::take");
+ trace::exiting("mln::accu::stat::histo3d_hsl<q,V>::take");
}
- template <typename V>
+ template <unsigned q, typename V>
inline
- void histo3d_hsl<V>::take(const histo3d_hsl<V>& other)
+ void histo3d_hsl<q,V>::take(const histo3d_hsl<q,V>& other)
{
- trace::entering("mln::accu::stat::histo3d_hsl<V>::take");
+ trace::entering("mln::accu::stat::histo3d_hsl<q,V>::take");
count_ += other.count_;
- trace::exiting("mln::accu::stat::histo3d_hsl<V>::take");
+ trace::exiting("mln::accu::stat::histo3d_hsl<q,V>::take");
}
- template <typename V>
+ template <unsigned q, typename V>
inline
- typename histo3d_hsl<V>::result histo3d_hsl<V>::to_result() const
+ typename histo3d_hsl<q,V>::result histo3d_hsl<q,V>::to_result() const
{
- trace::entering("mln::accu::stat::histo3d_hsl<V>::to_result");
+ trace::entering("mln::accu::stat::histo3d_hsl<q,V>::to_result");
- trace::exiting("mln::accu::stat::histo3d_hsl<V>::to_result");
+ trace::exiting("mln::accu::stat::histo3d_hsl<q,V>::to_result");
return count_;
}
- template <typename V>
+ template <unsigned q, typename V>
inline
- histo3d_hsl<V>::operator result() const
+ histo3d_hsl<q,V>::operator result() const
{
- trace::entering("mln::accu::stat::histo3d_rgb<V>::operator result");
+ trace::entering("mln::accu::stat::histo3d_rgb<q,V>::operator result");
- trace::exiting("mln::accu::stat::histo3d_rgb<V>::operator result");
+ trace::exiting("mln::accu::stat::histo3d_rgb<q,V>::operator result");
return count_;
}
- template <typename V>
+ template <unsigned q, typename V>
inline
- bool histo3d_hsl<V>::is_valid() const
+ bool histo3d_hsl<q,V>::is_valid() const
{
- trace::entering("mln::accu::stat::histo3d_hsl<V>::is_valid");
+ trace::entering("mln::accu::stat::histo3d_hsl<q,V>::is_valid");
bool result = count_.is_valid();
- trace::exiting("mln::accu::stat::histo3d_hsl<V>::is_valid");
+ trace::exiting("mln::accu::stat::histo3d_hsl<q,V>::is_valid");
return result;
}
- template <typename V>
- bool operator==(const histo3d_hsl<V>& histo1,
- const histo3d_hsl<V>& histo2)
+ template <unsigned q, typename V>
+ bool operator==(const histo3d_hsl<q,V>& histo1,
+ const histo3d_hsl<q,V>& histo2)
{
trace::entering("mln::accu::stat::operator==");
diff --git a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc
index 6d8f0b8..27a6b64 100644
--- a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc
+++ b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc
@@ -57,29 +57,34 @@
#include <mln/trait/image/print.hh>
#include <mln/trait/value_.hh>
+#include <mln/core/concept/function.hh>
+
-/*
template <unsigned n>
void test_operator_equal()
{
using namespace mln::accu::stat;
- typedef mln::value::rgb<n> rgbn;
- mln::accu::stat::histo3d_rgb<rgbn> histo1;
- mln::accu::stat::histo3d_rgb<rgbn> histo2;
- rgbn val(3,3,3);
+ typedef mln::value::rgb<n> rgbn;
+ typedef mln::value::hsl_f hsl_f;
+ typedef mln::fun::v2v::f_rgb_to_hsl_<hsl_f> rgb_to_hsl_f;
+ rgb_to_hsl_f convert;
+ mln::accu::stat::histo3d_hsl<n,hsl_f> histo1;
+ mln::accu::stat::histo3d_hsl<n,hsl_f> histo2;
+ rgbn val_rgb(n,n,n);
+ hsl_f val_hsl = convert(val_rgb);
histo1.init();
histo2.init();
mln_assertion(histo1 == histo2);
- histo1.take(val);
+ histo1.take(val_hsl);
/// FIXME mln_assertion(histo1 != histo2); doesn't work!!
mln_assertion(!(histo1 == histo2));
- histo2.take(val);
+ histo2.take(val_hsl);
mln_assertion(histo1 == histo2);
@@ -90,8 +95,9 @@ template <unsigned n>
void test_instantiation_without_argument()
{
typedef mln::value::rgb<n> rgbn;
- typedef mln_trait_value_comp(rgbn,0) comp;
- const mln::accu::stat::histo3d_rgb<rgbn> histo;
+ typedef mln::value::hsl_f hsl_f;
+ typedef mln::value::int_u<n> comp;
+ const mln::accu::stat::histo3d_hsl<n,hsl_f>histo;
const mln::image3d<unsigned>& res = histo.to_result();
const mln::point3d& min =mln::point3d(mln_min(comp),
mln_min(comp),
@@ -110,11 +116,11 @@ void test_instantiation_without_argument()
template <unsigned n>
void test_initialization()
{
- typedef mln::value::int_u<n> int_un;
- typedef mln::value::rgb<n> rgbn;
- mln::accu::stat::histo3d_rgb<rgbn> histo;
- mln::image3d<unsigned> img_res = histo.to_result();
- mln::image3d<unsigned> img_ref;
+ typedef mln::value::int_u<n> int_un;
+ typedef mln::value::hsl_f hsl_f;
+ mln::accu::stat::histo3d_hsl<n, hsl_f> histo;
+ mln::image3d<unsigned> img_res = histo.to_result();
+ mln::image3d<unsigned> img_ref;
mln::initialize(img_ref, img_res);
mln::data::fill(img_ref, 0);
@@ -131,11 +137,11 @@ void test_initialization()
template <unsigned n>
void test_take_argument()
{
- typedef mln::value::int_u<n> int_un;
- typedef mln::value::rgb<n> rgbn;
- mln::accu::stat::histo3d_rgb<rgbn> histo1;
- mln::accu::stat::histo3d_rgb<rgbn> histo2;
- rgbn val(3,3,3);
+ typedef mln::value::int_u<n> int_un;
+ typedef mln::value::hsl_f hsl_f;
+ mln::accu::stat::histo3d_hsl<n,hsl_f> histo1;
+ mln::accu::stat::histo3d_hsl<n,hsl_f> histo2;
+ hsl_f val(0.0,0.0,0.0);
histo1.init();
histo2.init();
@@ -148,7 +154,7 @@ void test_take_argument()
const unsigned ref = mln::data::compute(mln::accu::math::sum<int_un>(), img2);
mln_assertion(ref == res-1);
- mln_assertion(1 == img1(mln::point3d(val.red(), val.green(), val.blue())));
+ mln_assertion(1 == img1(mln::point3d(0, 0, 0)));
std::cout << "(" << n << " bits) histo.take(argument) : ok" << std::endl;
}
@@ -156,11 +162,11 @@ void test_take_argument()
template <unsigned n>
void test_take_other()
{
- typedef mln::value::rgb<n> rgbn;
- mln::accu::stat::histo3d_rgb<rgbn> histo1;
- mln::accu::stat::histo3d_rgb<rgbn> histo2;
- mln::accu::stat::histo3d_rgb<rgbn> histo3;
- rgbn val(3,3,3);
+ typedef mln::value::hsl_f hsl_f;
+ mln::accu::stat::histo3d_hsl<n,hsl_f> histo1;
+ mln::accu::stat::histo3d_hsl<n,hsl_f> histo2;
+ mln::accu::stat::histo3d_hsl<n,hsl_f> histo3;
+ hsl_f val(0.0,0.0,0.0);
histo1.init();
histo2.init();
@@ -269,31 +275,65 @@ mln::algebra::mat<3,3,float> var_histo2(const mln::image3d<unsigned>& img)
return result;
}
+struct hslf_2_vec3f : public mln::Function_v2v< hslf_2_vec3f >
+{
+ typedef mln::algebra::vec<3,float> result;
+ result operator()(const mln::value::hsl_f& hsl) const;
+};
+
+mln::algebra::vec<3,float>
+hslf_2_vec3f::operator()(const mln::value::hsl_f& hsl) const
+{
+ return mln::make::vec(hsl.hue(), hsl.lum(), hsl.sat());
+}
+
+
+template <typename A, typename I, typename F>
+mln_result(A)
+compute(mln::Accumulator<A>& a_,
+ const mln::Image<I>& input_,
+ const mln::Function_v2v<F>& fn_)
+{
+ A& a = exact(a_);
+ const I& input = exact(input_);
+ const F& fn = exact(fn_);
+
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ a.take(fn(input(p)));
+
+ return a.result();
+}
+
+
template <unsigned n>
void test_integration()
{
- typedef mln::value::rgb8 rgb8;
- typedef mln::value::rgb<n> rgbn;
- typedef mln::algebra::vec<3,float> vec3f;
- typedef mln::algebra::mat<3,3,float> mat3f;
- typedef mln::accu::math::count<rgbn> count;
- typedef mln::accu::math::sum<rgbn,vec3f> sum;
- typedef mln::accu::stat::mean<rgbn,vec3f,vec3f> mean;
- typedef mln::accu::stat::var<vec3f> var;
+ typedef mln::value::rgb8 rgb8;
+ typedef mln::value::rgb<n> rgbn;
+ typedef mln::value::hsl_f hsl_f;
+ typedef mln::algebra::vec<3,float> vec3f;
+ typedef mln::algebra::mat<3,3,float> mat3f;
+ typedef mln::accu::math::count<hsl_f> count;
+ typedef mln::accu::math::sum<hsl_f,vec3f> sum;
+ typedef mln::accu::stat::mean<hsl_f,vec3f,vec3f> mean;
+ typedef mln::accu::stat::var<vec3f> var;
mln::image2d<rgb8> img_fst;
- mln::image2d<rgbn> img_ref;
+ mln::image2d<rgbn> img_sec;
+ mln::image2d<hsl_f> img_ref;
mln::image3d<unsigned> img_res;
mln::io::ppm::load(img_fst, OLENA_IMG_PATH"/lena.ppm");
- img_ref = mln::data::transform(img_fst, mln::fun::v2v::rgb8_to_rgbn<n>());
+ img_sec = mln::data::transform(img_fst, mln::fun::v2v::rgb8_to_rgbn<n>());
+ img_ref = mln::data::transform(img_sec,mln::fun::v2v::f_rgb_to_hsl_<hsl_f>());
- const double count_ref = mln::data::compute(count(), img_ref);
- const vec3f sum_ref = mln::data::compute(sum(), img_ref);
- const vec3f mean_ref = mln::data::compute(mean(), img_ref);
- const mat3f var_ref = mln::data::compute(var(), img_ref);
+ const double count_ref = compute(count(), img_ref, hslf_2_vec3f());
+ // const vec3f sum_ref = mln::data::compute(sum(), img_ref);
+ const vec3f mean_ref = compute(mean(), img_ref, hslf_2_vec3f());
+ const mat3f var_ref = compute(var(), img_ref, hslf_2_vec3f());
- img_res = mln::data::compute(mln::accu::stat::histo3d_rgb<rgbn>(), img_ref);
+ img_res = mln::data::compute(mln::accu::stat::histo3d_hsl<n,hsl_f>(),img_ref);
const double count_res = count_histo(img_res);
@@ -310,7 +350,7 @@ void test_integration()
mln_assertion(count_ref == count_res);
-
+ /*
mln_assertion(0.0001 > abs(mean_ref[0] - mean_res[0]));
mln_assertion(0.0001 > abs(mean_ref[1] - mean_res[1]));
mln_assertion(0.0001 > abs(mean_ref[2] - mean_res[2]));
@@ -327,12 +367,10 @@ void test_integration()
mln_assertion(0.0001 > abs(var_ref(2,2) - var_res(2,2)));
mln_assertion(0.0001 > abs(var_ref(2,1) - var_res(2,1)));
mln_assertion(0.0001 > abs(var_ref(1,2) - var_res(1,2)));
-
+ */
std::cout << "(" << n << " bits) test integration : ok" << std::endl;
}
-*/
-
void test()
{
typedef mln::value::rgb8 rgb8;
@@ -358,18 +396,13 @@ void test()
int main()
{
- /*
- test_operator_equal<8>();
- test_instantiation_without_argument<8>();
- test_initialization<8>();
- test_take_argument<8>();
- test_take_other<8>();
- test_integration<8>();
- */
-
- // p2p/fold+transform_domain for hcv
-
- test();
+ test_operator_equal<3>();
+ test_instantiation_without_argument<3>();
+ test_initialization<3>();
+ test_take_argument<3>();
+ test_take_other<3>();
+ test_integration<3>();
+
return 0;
}
--
1.5.6.5
1
0
* green/mln/fun/x2v/sampler.hh : Delete obsolete library file.
* green/mln/fun/x2v : Delete directory.
---
trunk/milena/sandbox/ChangeLog | 7 ++
trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh | 107 ---------------------
2 files changed, 7 insertions(+), 107 deletions(-)
delete mode 100644 trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index be92af7..41f171a 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,5 +1,12 @@
2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Delete obsolete sources.
+
+ * green/mln/fun/x2v/sampler.hh : Delete obsolete library file.
+ * green/mln/fun/x2v : Delete directory.
+
+2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Save work in progress for histo and hsl (interpolation part).
* green/mln/fun/x2v : New directory.
diff --git a/trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh b/trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh
deleted file mode 100644
index 10b482b..0000000
--- a/trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh
+++ /dev/null
@@ -1,107 +0,0 @@
-// 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_X2V_SAMPLER_HH
-# define MLN_FUN_X2V_SAMPLER_HH
-
-# include <mln/core/image/image2d.hh>
-# include <mln/core/concept/function.hh>
-# include <mln/fun/internal/selector.hh>
-# include <mln/convert/to.hh>
-# include <mln/algebra/vec.hh>
-
-/// \file
-///
-/// Define a sampling process to attach real coordonnates to discrete ones.
-
-namespace mln
-{
-
- namespace fun
- {
-
- namespace x2v
- {
-
- /// Define a sampling process to attach real coordonnates to a discrete
- /// grid.
-
- // min | | | | | | | | max
- //
- // h = (max-min)/q (division reelle)
- // i = (val-min)/h (division entiere)
- //
- //
- // Hue [0,360°], q = 8 bits ==> h = 45° , 0/45/90/135/180/225/270/315/360
- // Sat [0,1] , q = 8 bits ==> h = 0.125
- // Lum [0,1] , q = 8 bits ==> h = 0.125
-
- template < typename I >
- struct sampler : public Function_v2v< sampler<I> >
- {
- typedef mln_value(I) result;
-
- sampler(const I& ima);
-
- /// Bilinear filtering on 2d images.
- template <typename T>
- mln_value(I)
- operator()(const algebra::vec<2,T>& v) const;
-
- template <typename T>
- mln_value(I)
- operator()(const algebra::vec<3,T>& v) const;
-
- const I& ima;
- };
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename I>
- bilinear<I>::bilinear(const I& ima) : ima(ima)
- {
- mlc_bool(I::psite::dim == 3)::check();
- }
-
- template <typename I>
- template <typename T>
- mln_value(I)
- sampler<I>::operator()(const algebra::vec<3,T>& v) const
- {
-
- return convert::to<mln_value(I)>(res);
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::fun::x2v
-
- } // end of namespace mln::fun
-
-} // end of namespace mln
-
-
-#endif // ! MLN_FUN_X2V_SAMPLER_HH
--
1.5.6.5
1
0
11 Sep '09
* green/mln/fun/x2v : New directory.
* green/mln/fun/x2v/sampler.hh : New library file.
---
trunk/milena/sandbox/ChangeLog | 7 ++
trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh | 107 +++++++++++++++++++++
2 files changed, 114 insertions(+), 0 deletions(-)
create mode 100644 trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 2530228..be92af7 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,5 +1,12 @@
2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Save work in progress for histo and hsl (interpolation part).
+
+ * green/mln/fun/x2v : New directory.
+ * green/mln/fun/x2v/sampler.hh : New library file.
+
+2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Save work in progress for histo and hsl.
* green/mln/accu/stat/histo3d_hsl.hh : New library file.
diff --git a/trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh b/trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh
new file mode 100644
index 0000000..10b482b
--- /dev/null
+++ b/trunk/milena/sandbox/green/mln/fun/x2p/sampler.hh
@@ -0,0 +1,107 @@
+// 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_X2V_SAMPLER_HH
+# define MLN_FUN_X2V_SAMPLER_HH
+
+# include <mln/core/image/image2d.hh>
+# include <mln/core/concept/function.hh>
+# include <mln/fun/internal/selector.hh>
+# include <mln/convert/to.hh>
+# include <mln/algebra/vec.hh>
+
+/// \file
+///
+/// Define a sampling process to attach real coordonnates to discrete ones.
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace x2v
+ {
+
+ /// Define a sampling process to attach real coordonnates to a discrete
+ /// grid.
+
+ // min | | | | | | | | max
+ //
+ // h = (max-min)/q (division reelle)
+ // i = (val-min)/h (division entiere)
+ //
+ //
+ // Hue [0,360°], q = 8 bits ==> h = 45° , 0/45/90/135/180/225/270/315/360
+ // Sat [0,1] , q = 8 bits ==> h = 0.125
+ // Lum [0,1] , q = 8 bits ==> h = 0.125
+
+ template < typename I >
+ struct sampler : public Function_v2v< sampler<I> >
+ {
+ typedef mln_value(I) result;
+
+ sampler(const I& ima);
+
+ /// Bilinear filtering on 2d images.
+ template <typename T>
+ mln_value(I)
+ operator()(const algebra::vec<2,T>& v) const;
+
+ template <typename T>
+ mln_value(I)
+ operator()(const algebra::vec<3,T>& v) const;
+
+ const I& ima;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ bilinear<I>::bilinear(const I& ima) : ima(ima)
+ {
+ mlc_bool(I::psite::dim == 3)::check();
+ }
+
+ template <typename I>
+ template <typename T>
+ mln_value(I)
+ sampler<I>::operator()(const algebra::vec<3,T>& v) const
+ {
+
+ return convert::to<mln_value(I)>(res);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::x2v
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_X2V_SAMPLER_HH
--
1.5.6.5
1
0
* green/mln/accu/stat/histo3d_hsl.hh : New library file.
* green/tests/accu/stat/histo3d_hsl : New directory.
* green/tests/accu/stat/Makefile.am : New makefile.
* green/tests/accu/stat/histo3d_hsl.cc : New source file.
---
trunk/milena/sandbox/ChangeLog | 10 +
.../sandbox/green/mln/accu/stat/histo3d_hsl.hh | 347 ++++++++++++++++++
.../green/tests/accu/stat/histo3d_hsl/Makefile.am | 148 ++++++++
.../tests/accu/stat/histo3d_hsl/histo3d_hsl.cc | 375 ++++++++++++++++++++
4 files changed, 880 insertions(+), 0 deletions(-)
create mode 100644 trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh
create mode 100644 trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/Makefile.am
create mode 100644 trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 00a840e..2530228 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,5 +1,15 @@
2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Save work in progress for histo and hsl.
+
+ * green/mln/accu/stat/histo3d_hsl.hh : New library file.
+
+ * green/tests/accu/stat/histo3d_hsl : New directory.
+ * green/tests/accu/stat/Makefile.am : New makefile.
+ * green/tests/accu/stat/histo3d_hsl.cc : New source file.
+
+2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Do some refactoring in green's sandbox.
* green/doc/examples : New directory.
diff --git a/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh
new file mode 100644
index 0000000..40da72c
--- /dev/null
+++ b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh
@@ -0,0 +1,347 @@
+// 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_ACCU_STAT_HISTO3D_HSL_HH
+#define MLN_ACCU_STAT_HISTO3D_HSL_HH
+
+/// \file
+///
+/// \brief Define a histogram as an accumulator which returns an image1d .
+///
+/// This source implements the discrete histogram version. The number of beans
+/// is infer from the number of greylevels. A typical int_u8 image has got
+/// 256 bins. An int_u16 image has got 65535 bins.
+/// The following sample is a typical use of the histogram.
+///
+/// #include <mln/value/int_u8.hh>
+/// #include <mln/core/image/image1d.hh>
+/// #include <mln/core/image/image2d.hh>
+/// #include <mln/io/pgm/load.hh>
+/// #include <mln/accu/stat/histo1d.hh>
+/// #include <mln/data/compute.hh>
+/// #include <mln/io/plot/save_histo_sh.hh>
+///
+/// #define OLENA_LENA "/usr/local/share/olena/images/lena.pgm"
+///
+/// void test()
+/// {
+/// typedef mln::value::int_u8 int_u8;
+/// mln::image2d<int_u8> img_ref;
+/// mln::image1d<unsigned> img_res;
+///
+/// mln::io::pgm::load(img_ref, OLENA_LENA);
+/// img_res = mln::data::compute(mln::accu::stat::histo1d<int_u8>(), img_ref);
+/// }
+
+
+#include <iostream>
+
+#include <mln/accu/internal/base.hh>
+
+#include <mln/core/macros.hh>
+#include <mln/core/image/image3d.hh>
+#include <mln/core/alias/point3d.hh>
+#include <mln/core/alias/box3d.hh>
+
+#include <mln/core/value/int_u.hh>
+#include <mln/trait/value/comp.hh>
+
+#include <mln/arith/plus.hh>
+
+#include <mln/trace/entering.hh>
+#include <mln/trace/exiting.hh>
+
+#include <mln/value/ops.hh>
+
+// make hue cyclic
+#include <mln/fun/p2p/flod.hh>
+#include <mln/core/image/dmorph/transformed_image.hh>
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace stat
+ {
+
+ // Forward declaration
+ template <typename V>
+ struct histo3d_hsl;
+
+ } // end of namespace mln::accu::stat
+
+ } // end of namespace mln::accu
+
+
+ namespace trait
+ {
+
+ template <typename V>
+ struct accumulator_< mln::accu::stat::histo3d_hsl<V> >
+ {
+ typedef accumulator::has_untake::no has_untake;
+ typedef accumulator::has_set_value::no has_set_value;
+ typedef accumulator::has_stop::no has_stop;
+ typedef accumulator::when_pix::use_v when_pix;
+ };
+
+ template <typename V>
+ struct set_precise_binary_<op::eq,
+ accu::stat::histo3d_hsl<V>,
+ accu::stat::histo3d_hsl<V> >
+ {
+ typedef bool ret;
+ };
+
+ } // end of namespace mln::trait
+
+ namespace accu
+ {
+
+ namespace stat
+ {
+
+ /// \brief Define an histogram which returns an image1d .
+ ///
+ /// Param V defines the space in which we count the values.
+ /// For instance, this histogram works image2d<int_u8> or
+ /// image1d<int_u16>. The histogram count the occurrence of each value.
+ /// The number of bins depends of the greyscale values, for 8 bits there
+ /// is 256 bins, for 16 bits there is 65536 bins. Note that over
+ /// quantification works too.
+ ///
+ /// \ingroup modaccuvalues
+
+ /// q is the number of bins per axe because quantification info are died.
+ /// we assume that V is a kind of hsl_<float,float,float>
+
+ template <typename q, typename V>
+ struct histo3d_hsl :
+ public mln::accu::internal::base<image3d<unsigned>, histo3d_hsl<V> >
+ {
+ typedef V argument;
+ typedef image3d<unsigned> result;
+ typedef result q_result;
+
+ /// Constructors
+ /// \{
+ /// \brief Initialize the size of the resulting image1d.
+ ///
+ /// Initialize the size the resulting image from the theorical dynamic
+ /// of the greylevel values (Use V to manage it).
+ histo3d_hsl();
+ /// \}
+
+
+ /// 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
+ /// density.
+ void init();
+
+
+ /// \brief Update the histogram with the RGB pixel t.
+ /// \param[in] t a greylevel pixel of type V.
+ ///
+ /// The end user shouldn't call this method. In place of it, he can
+ /// go through the data compute interface.
+ void take(const argument& t);
+
+
+ /// \brief Update the histogram with an other histogram.
+ /// \param[in] other the other histogram.
+ void take(const histo3d_hsl<V>& other);
+ /// \}
+
+ /// Accessors.
+ /// \{
+ /// \brief Return the histogram as an image1d.
+ ///
+ /// This is the machinery to communicate with data compute interface.
+ /// The end user should'nt use it.
+ result to_result() const;
+ operator result () const;
+ /// \}
+
+ /// \brief Check whethever this accumulator is able to return a result.
+ ///
+ /// Depends if the resulting image1d is valid. We can assume it is quite
+ /// always the case.
+ bool is_valid() const;
+
+ protected:
+ result count_;
+ };
+
+ /// \brief Check wethever an histogram is equal to an other one.
+ /// \param[in] histo1 the first histogram to compare with.
+ /// \param[in] histo2 the second histogram.
+ ///
+ /// The operator compare all the bins from the two histogram.
+
+ template <typename V>
+ bool operator==(const histo3d_hsl<V>& histo1,
+ const histo3d_hsl<V>& histo2);
+
+#ifndef MLN_INCLUDE_ONLY
+
+ template <typename V>
+ inline
+ histo3d_hsl<V>::histo3d_hsl()
+ {
+ trace::entering("mln::accu::stat::histo3d_hsl<V>::histo3d_hsl");
+
+ // As there is no info about preceding color space
+ // we ask the end user to specify the quantification he's looking for.
+
+ count_.init_(box3d(point3d(mln_min(int_u<q>),
+ mln_min(int_u<q>),
+ mln_min(int_u<q>)),
+ point3d(mln_max(int_u<q>),
+ mln_max(int_u<q>),
+ mln_max(int_u<q>))));
+
+ // Make the hue domain cyclic
+ fun::p2p::fold<point3d,1,0,0> fold_(count_.domain());
+ transform_domain(count_, fold_);
+
+ // Build the interpolate ??
+ // cf code igr
+
+ trace::exiting("mln::accu::stat::histo3d_hsl<V>::histo3d_hsl");
+ }
+
+ template <typename V>
+ inline
+ void histo3d_hsl<V>::init()
+ {
+ trace::entering("mln::accu::stat::histo3d_hsl<V>::init");
+
+ data::fill(count_, 0);
+ trace::exiting("mln::accu::stat::histo3d_hsl<V>::init");
+ }
+
+ template <typename V>
+ inline
+ void histo3d_hsl<V>::take(const argument& t)
+ {
+ trace::entering("mln::accu::stat::histo3d_hsl<V>::take");
+
+ // Just convert a greyscale value (int_u8 like) to a position for an
+ // iterator on the resulting image.
+ //++count_(point3d(t.red(), t.green(), t.blue()));
+
+
+ // Technical way to access i° component without kwnowing the name
+ // mln::trait::value_<argument>::get_comp_0(t);
+
+ ++count_(point3d(t.hue(), t.sat(), t.lum()));
+
+ trace::exiting("mln::accu::stat::histo3d_hsl<V>::take");
+ }
+
+
+ template <typename V>
+ inline
+ void histo3d_hsl<V>::take(const histo3d_hsl<V>& other)
+ {
+ trace::entering("mln::accu::stat::histo3d_hsl<V>::take");
+
+ count_ += other.count_;
+
+ trace::exiting("mln::accu::stat::histo3d_hsl<V>::take");
+ }
+
+ template <typename V>
+ inline
+ typename histo3d_hsl<V>::result histo3d_hsl<V>::to_result() const
+ {
+ trace::entering("mln::accu::stat::histo3d_hsl<V>::to_result");
+
+ trace::exiting("mln::accu::stat::histo3d_hsl<V>::to_result");
+ return count_;
+ }
+
+ template <typename V>
+ inline
+ histo3d_hsl<V>::operator result() const
+ {
+ trace::entering("mln::accu::stat::histo3d_rgb<V>::operator result");
+
+ trace::exiting("mln::accu::stat::histo3d_rgb<V>::operator result");
+ return count_;
+ }
+
+ template <typename V>
+ inline
+ bool histo3d_hsl<V>::is_valid() const
+ {
+ trace::entering("mln::accu::stat::histo3d_hsl<V>::is_valid");
+ bool result = count_.is_valid();
+
+ trace::exiting("mln::accu::stat::histo3d_hsl<V>::is_valid");
+ return result;
+ }
+
+ template <typename V>
+ bool operator==(const histo3d_hsl<V>& histo1,
+ const histo3d_hsl<V>& histo2)
+ {
+ trace::entering("mln::accu::stat::operator==");
+
+ bool result = true;
+ const image3d<unsigned>& res1 = histo1.to_result();
+ const image3d<unsigned>& res2 = histo2.to_result();
+
+ mln_precondition(res1.is_valid());
+ mln_precondition(res2.is_valid());
+
+ mln_piter(image3d<unsigned>) p1(res1.domain());
+ mln_piter(image3d<unsigned>) p2(res2.domain());
+
+ for_all_2(p1, p2)
+ result &= (res1(p1) == res2(p2));
+
+ trace::exiting("mln::accu::stat::operator==");
+ return result;
+ }
+
+#endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::accu::stat
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+#endif // ! MLN_ACCU_STAT_HISTO3D_RGB_HH
diff --git a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/Makefile.am b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/Makefile.am
new file mode 100644
index 0000000..d970989
--- /dev/null
+++ b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/Makefile.am
@@ -0,0 +1,148 @@
+#
+# Generic Makefile
+#
+
+#########
+# TOOLS #
+#########
+
+INCLUDES= -I$(HOME)/svn/oln/trunk/milena/sandbox/green
+CXXFLAGS= -ggdb -O0 -Wall -W -pedantic -ansi -pipe $(INCLUDES)
+ECHO= echo
+RM= rm
+MKDIR= mkdir -p
+CP= cp
+
+SOURCE_PATTERN= green/tests
+BUILD__PATTERN= green/build/tests
+
+
+ifeq ($(findstring $(BUILD__PATTERN),$(PWD)), $(BUILD__PATTERN))
+# Case where make is done from build directory.
+SOURCE_DIR= $(subst $(BUILD__PATTERN),$(SOURCE_PATTERN),$(PWD))
+BUILD__DIR= $(PWD)
+else
+# Case where make is done from source directory.
+SOURCE_DIR= $(PWD)
+BUILD__DIR= $(subst $(SOURCE_PATTERN),$(BUILD__PATTERN),$(PWD))
+endif
+
+SRC= $(notdir $(wildcard $(SOURCE_DIR)/*.cc))
+OLD= $(notdir $(wildcard $(SOURCE_DIR)/*~))
+OBJ= $(patsubst %.cc,%.o,$(SRC))
+SOURCE_MAKEFILE=Makefile.am
+BUILD__MAKEFILE=Makefile
+TARGET_FILE= $(notdir $(PWD))
+SOURCE_FILES= $(notdir $(wildcard $(SOURCE_DIR)/*.*))
+BUILD__FILES= $(filter-out $(SRC) $(SOURCE_MAKEFILE), $(SOURCE_FILES))
+
+BUILD__F_PATH= $(addprefix $(BUILD__DIR)/,$(BUILD__FILES))
+SOURCE_F_PATH= $(addprefix $(SOURCE_DIR)/,$(SOURCE_FILES))
+
+BUILD__M_PATH= $(addprefix $(BUILD__DIR)/,$(BUILD__MAKEFILE))
+SOURCE_M_PATH= $(addprefix $(SOURCE_DIR)/,$(SOURCE_MAKEFILE))
+
+TARGET_F_PATH= $(addprefix $(BUILD__DIR)/,$(TARGET_FILE))
+OBJ_F_PATH= $(addprefix $(BUILD__DIR)/,$(OBJ))
+SRC_F_PATH= $(addprefix $(SOURCE_DIR)/,$(SRC))
+OLD_F_PATH= $(addprefix $(SOURCE_DIR)/,$(OLD))
+
+#############
+# BOOTSTRAP #
+#############
+
+
+bootstrap: $(BUILD__DIR) $(BUILD__F_PATH) $(BUILD__M_PATH)
+
+# Create, if nessary, the destination directory
+$(BUILD__DIR):
+ $(MKDIR) $(BUILD__DIR)
+
+# Copy, if nessary, all the files, except the Makefile.am
+$(BUILD__F_PATH): $(SOURCE_F_PATH)
+ $(CP) $(addprefix $(SOURCE_DIR)/,$(@F)) $@
+
+# Copy if nessary, the Makefile.am into Makefile
+$(BUILD__M_PATH): $(SOURCE_M_PATH)
+ $(CP) $(SOURCE_M_PATH) $(BUILD__M_PATH)
+
+
+#######
+# ALL #
+#######
+
+# We assume that the call is done from the build directory.
+# With the directive vpath, hidden files are found in the source directory.
+
+all: $(TARGET_F_PATH)
+
+
+$(TARGET_F_PATH): $(OBJ_F_PATH)
+ $(LINK.cc) $< $(LOADLIBES) $(LDLIBS) -o $@
+
+$(OBJ_F_PATH):$(SRC_F_PATH)
+ $(COMPILE.cc) $(OUTPUT_OPTION) $<
+
+
+#########
+# CLEAN #
+#########
+
+# Force every time the deletion
+clean: clean_target clean_obj clean_dst clean_old #clean_make
+
+
+clean_target:
+ -@$(RM) $(TARGET_F_PATH) &> /dev/null
+
+clean_obj:
+ -@$(RM) $(OBJ_F_PATH) &> /dev/null
+
+clean_dst:
+ -@$(RM) $(BUILD_F_PATH) &> /dev/null
+
+clean_make:
+ -@$(RM) $(BUILD_M_PATH) &> /dev/null
+
+clean_old:
+ -@$(RM) $(OLD_F_PATH) &> /dev/null
+
+
+#########
+# PRINT #
+#########
+
+print: print_tools print_bootstrap
+
+print_tools:
+ @$(ECHO) "HOME = $(HOME)"
+ @$(ECHO) "INCLUDES = $(INCLUDES)"
+ @$(ECHO) "CXXFLAGS = $(CXXFLAGS)"
+ @$(ECHO) "ECHO = $(ECHO)"
+ @$(ECHO) "RM = $(RM)"
+ @$(ECHO) "MKDIR = $(MKDIR)"
+ @$(ECHO) "CP = $(CP)"
+ @$(ECHO)
+
+print_bootstrap:
+ @$(ECHO) "PWD = $(PWD)"
+ @$(ECHO) "SOURCE_PATTERN = $(SOURCE_PATTERN)"
+ @$(ECHO) "BUILD__PATTERN = $(BUILD__PATTERN)"
+ @$(ECHO) "SOURCE_DIR = $(SOURCE_DIR)"
+ @$(ECHO) "BUILD__DIR = $(BUILD__DIR)"
+ @$(ECHO) "SOURCE_MAKEFILE = $(SOURCE_MAKEFILE)"
+ @$(ECHO) "BUILD__MAKEFILE = $(BUILD__MAKEFILE)"
+ @$(ECHO) "TARGET_FILE = $(TARGET_FILE)"
+ @$(ECHO) "SOURCE_FILES = $(SOURCE_FILES)"
+ @$(ECHO) "SOURCE_F_PATH = $(SOURCE_F_PATH)"
+ @$(ECHO) "BUILD__FILES = $(BUILD__FILES)"
+ @$(ECHO) "BUILD__F_PATH = $(BUILD__F_PATH)"
+ @$(ECHO) "BUILD__M_PATH = $(BUILD__M_PATH)"
+ @$(ECHO) "SOURCE_M_PATH = $(SOURCE_M_PATH)"
+ @$(ECHO) "SRC = $(SRC)"
+ @$(ECHO) "OBJ = $(OBJ)"
+ @$(ECHO) "OLD = $(OLD)"
+ @$(ECHO) "SRC_F_PATH = $(SRC_F_PATH)"
+ @$(ECHO) "OBJ_F_PATH = $(OBJ_F_PATH)"
+ @$(ECHO) "OLD_F_PATH = $(OLD_F_PATH)"
+ @$(ECHO)
diff --git a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc
new file mode 100644
index 0000000..6d8f0b8
--- /dev/null
+++ b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc
@@ -0,0 +1,375 @@
+/// TEST HISTO3D_HSL
+
+#include <mln/img_path.hh>
+
+#include <mln/io/plot/save_histo_sh.hh>
+#include <mln/accu/stat/histo3d_hsl.hh>
+#include <mln/fun/v2v/rgb8_to_rgbn.hh>
+#include <mln/fun/v2v/rgb_to_hsl.hh>
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/ppm/save.hh>
+#include <mln/io/plot/save.hh>
+
+#include <mln/data/compute.hh>
+#include <mln/data/transform.hh>
+#include <mln/data/fill.hh>
+
+#include <mln/value/label_8.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/value/hsl.hh>
+#include <mln/value/rgb.hh>
+#include <mln/value/int_u.hh>
+
+#include <mln/core/alias/neighb3d.hh>
+#include <mln/core/alias/box3d.hh>
+#include <mln/core/alias/point3d.hh>
+
+#include <mln/core/routine/initialize.hh>
+#include <mln/core/contract.hh>
+#include <mln/core/grids.hh>
+
+#include <mln/accu/math/sum.hh>
+#include <mln/accu/math/count.hh>
+#include <mln/accu/stat/mean.hh>
+#include <mln/accu/stat/variance.hh>
+#include <mln/accu/stat/var.hh>
+
+#include <mln/morpho/watershed/flooding.hh>
+#include <mln/morpho/elementary/dilation.hh>
+#include <mln/morpho/elementary/closing.hh>
+
+#include <mln/literal/zero.hh>
+#include <mln/linear/convolve.hh>
+#include <mln/linear/gaussian.hh>
+#include <mln/labeling/regional_maxima.hh>
+#include <mln/labeling/colorize.hh>
+#include <mln/labeling/mean_values.hh>
+
+#include <mln/make/w_window3d.hh>
+
+#include <mln/math/sqr.hh>
+#include <mln/math/pi.hh>
+#include <mln/math/abs.hh>
+
+#include <mln/core/image/dmorph/image_if.hh>
+#include <mln/pw/value.hh>
+
+#include <mln/trait/image/print.hh>
+#include <mln/trait/value_.hh>
+
+/*
+template <unsigned n>
+void test_operator_equal()
+{
+ using namespace mln::accu::stat;
+
+ typedef mln::value::rgb<n> rgbn;
+ mln::accu::stat::histo3d_rgb<rgbn> histo1;
+ mln::accu::stat::histo3d_rgb<rgbn> histo2;
+ rgbn val(3,3,3);
+
+ histo1.init();
+ histo2.init();
+
+ mln_assertion(histo1 == histo2);
+
+ histo1.take(val);
+
+ /// FIXME mln_assertion(histo1 != histo2); doesn't work!!
+ mln_assertion(!(histo1 == histo2));
+
+ histo2.take(val);
+
+ mln_assertion(histo1 == histo2);
+
+ std::cout << "(" << n << " bits) histo == histo : ok" << std::endl;
+}
+
+template <unsigned n>
+void test_instantiation_without_argument()
+{
+ typedef mln::value::rgb<n> rgbn;
+ typedef mln_trait_value_comp(rgbn,0) comp;
+ const mln::accu::stat::histo3d_rgb<rgbn> histo;
+ const mln::image3d<unsigned>& res = histo.to_result();
+ const mln::point3d& min =mln::point3d(mln_min(comp),
+ mln_min(comp),
+ mln_min(comp));
+ const mln::point3d& max =mln::point3d(mln_max(comp),
+ mln_max(comp),
+ mln_max(comp));
+ const mln::box3d& ref = mln::box3d(min, max);
+
+ mln_assertion(ref == res.domain());
+ mln_assertion(res.is_valid());
+
+ std::cout << "(" << n << " bits) histo<T> histo : ok" << std::endl;
+}
+
+template <unsigned n>
+void test_initialization()
+{
+ typedef mln::value::int_u<n> int_un;
+ typedef mln::value::rgb<n> rgbn;
+ mln::accu::stat::histo3d_rgb<rgbn> histo;
+ mln::image3d<unsigned> img_res = histo.to_result();
+ mln::image3d<unsigned> img_ref;
+
+ mln::initialize(img_ref, img_res);
+ mln::data::fill(img_ref, 0);
+ histo.init();
+
+ unsigned res = mln::data::compute(mln::accu::math::sum<int_un>(), img_res);
+ unsigned ref = mln::data::compute(mln::accu::math::sum<int_un>(), img_ref);
+
+ mln_assertion(ref == res);
+
+ std::cout << "(" << n << " bits) histo.init() : ok" << std::endl;
+}
+
+template <unsigned n>
+void test_take_argument()
+{
+ typedef mln::value::int_u<n> int_un;
+ typedef mln::value::rgb<n> rgbn;
+ mln::accu::stat::histo3d_rgb<rgbn> histo1;
+ mln::accu::stat::histo3d_rgb<rgbn> histo2;
+ rgbn val(3,3,3);
+
+ histo1.init();
+ histo2.init();
+ histo1.take(val);
+
+ const mln::image3d<unsigned> img1 = histo1.to_result();
+ const mln::image3d<unsigned> img2 = histo2.to_result();
+
+ const unsigned res = mln::data::compute(mln::accu::math::sum<int_un>(), img1);
+ const unsigned ref = mln::data::compute(mln::accu::math::sum<int_un>(), img2);
+
+ mln_assertion(ref == res-1);
+ mln_assertion(1 == img1(mln::point3d(val.red(), val.green(), val.blue())));
+
+ std::cout << "(" << n << " bits) histo.take(argument) : ok" << std::endl;
+}
+
+template <unsigned n>
+void test_take_other()
+{
+ typedef mln::value::rgb<n> rgbn;
+ mln::accu::stat::histo3d_rgb<rgbn> histo1;
+ mln::accu::stat::histo3d_rgb<rgbn> histo2;
+ mln::accu::stat::histo3d_rgb<rgbn> histo3;
+ rgbn val(3,3,3);
+
+ histo1.init();
+ histo2.init();
+ histo3.init();
+
+ histo1.take(val);
+ histo1.take(val);
+ histo3.take(val);
+ histo2.take(val);
+ histo2.take(histo3);
+
+ mln_assertion(histo1 == histo2);
+
+ std::cout << "(" << n << " bits) histo.take(other) : ok" << std::endl;
+}
+
+double count_histo(const mln::image3d<unsigned>& img)
+{
+ mln_precondition(img.is_valid());
+
+ double result = 0.0;
+ mln_piter_(mln::image3d<unsigned>) p(img.domain());
+
+ for_all(p)
+ result += img(p);
+
+ return result;
+}
+
+mln::algebra::vec<3,float> conv(const mln::algebra::vec<3,float>& vec)
+{
+ mln::algebra::vec<3,float> result;
+
+ result[0] = vec[2];
+ result[1] = vec[0];
+ result[2] = vec[1];
+
+ return result;
+}
+
+mln::algebra::vec<3,float> mean_histo(const mln::image3d<unsigned>& img)
+{
+ mln_precondition(img.is_valid());
+ typedef mln::algebra::vec<3,float> vec3f;
+ double count = 0.0;
+ vec3f sum = mln::literal::zero;
+ vec3f result;
+
+ mln_piter_(mln::image3d<unsigned>) p(img.domain());
+
+ for_all(p)
+ {
+ count += img(p);
+ sum += conv((vec3f)p) * img(p);
+ }
+
+ result = sum / count;
+
+ return result;
+}
+
+
+double var_histo(const mln::image3d<unsigned>& img)
+{
+ mln_precondition(img.is_valid());
+ typedef mln::algebra::vec<3,float> vec3f;
+ typedef mln::algebra::mat<3,3,float> mat3f;
+ double count = 0.0;
+ double sum = 0.0;
+ double sum2 = 0.0;
+ double result = 0.0;
+ mln_piter_(mln::image3d<unsigned>) p(img.domain());
+
+ for_all(p)
+ {
+ count += img(p);
+ sum += p[0] * img(p);
+ sum2 += p[0] * p[0] * img(p);
+ }
+
+ result = sum2 / count - (sum / count) * (sum / count);
+
+ return result;
+}
+
+mln::algebra::mat<3,3,float> var_histo2(const mln::image3d<unsigned>& img)
+{
+ mln_precondition(img.is_valid());
+ typedef mln::algebra::vec<3,float> vec3f;
+ typedef mln::algebra::mat<3,3,float> mat3f;
+
+ double count = count_histo(img);
+ vec3f mean = mean_histo(img);
+ vec3f point;
+ mat3f result = mln::literal::zero;
+ mln_piter_(mln::image3d<unsigned>) p(img.domain());
+
+ for_all(p)
+ {
+ point = conv((vec3f)p) - mean;
+ result += img(p) * (point * point.t());
+ }
+
+ result /= count;
+
+ return result;
+}
+
+template <unsigned n>
+void test_integration()
+{
+ typedef mln::value::rgb8 rgb8;
+ typedef mln::value::rgb<n> rgbn;
+ typedef mln::algebra::vec<3,float> vec3f;
+ typedef mln::algebra::mat<3,3,float> mat3f;
+ typedef mln::accu::math::count<rgbn> count;
+ typedef mln::accu::math::sum<rgbn,vec3f> sum;
+ typedef mln::accu::stat::mean<rgbn,vec3f,vec3f> mean;
+ typedef mln::accu::stat::var<vec3f> var;
+
+ mln::image2d<rgb8> img_fst;
+ mln::image2d<rgbn> img_ref;
+ mln::image3d<unsigned> img_res;
+
+ mln::io::ppm::load(img_fst, OLENA_IMG_PATH"/lena.ppm");
+ img_ref = mln::data::transform(img_fst, mln::fun::v2v::rgb8_to_rgbn<n>());
+
+ const double count_ref = mln::data::compute(count(), img_ref);
+ const vec3f sum_ref = mln::data::compute(sum(), img_ref);
+ const vec3f mean_ref = mln::data::compute(mean(), img_ref);
+ const mat3f var_ref = mln::data::compute(var(), img_ref);
+
+ img_res = mln::data::compute(mln::accu::stat::histo3d_rgb<rgbn>(), img_ref);
+
+
+ const double count_res = count_histo(img_res);
+ const vec3f mean_res = mean_histo(img_res);
+ const mat3f var_res = var_histo2(img_res);
+
+ std::cout << "count_ref : " << count_ref << std::endl;
+ std::cout << "mean_ref : " << mean_ref << std::endl;
+ std::cout << "var_ref : " << var_ref << std::endl;
+
+ std::cout << "count_res : " << count_res << std::endl;
+ std::cout << "mean_res : " << mean_res << std::endl;
+ std::cout << "var_res : " << var_res << std::endl;
+
+
+ mln_assertion(count_ref == count_res);
+
+ mln_assertion(0.0001 > abs(mean_ref[0] - mean_res[0]));
+ mln_assertion(0.0001 > abs(mean_ref[1] - mean_res[1]));
+ mln_assertion(0.0001 > abs(mean_ref[2] - mean_res[2]));
+
+ mln_assertion(0.0001 > abs(var_ref(0,0) - var_res(0,0)));
+ mln_assertion(0.0001 > abs(var_ref(0,1) - var_res(0,1)));
+ mln_assertion(0.0001 > abs(var_ref(1,0) - var_res(1,0)));
+
+ mln_assertion(0.0001 > abs(var_ref(1,1) - var_res(1,1)));
+ mln_assertion(0.0001 > abs(var_ref(0,2) - var_res(0,2)));
+ mln_assertion(0.0001 > abs(var_ref(2,0) - var_res(2,0)));
+
+
+ mln_assertion(0.0001 > abs(var_ref(2,2) - var_res(2,2)));
+ mln_assertion(0.0001 > abs(var_ref(2,1) - var_res(2,1)));
+ mln_assertion(0.0001 > abs(var_ref(1,2) - var_res(1,2)));
+
+ std::cout << "(" << n << " bits) test integration : ok" << std::endl;
+}
+
+*/
+
+void test()
+{
+ typedef mln::value::rgb8 rgb8;
+ typedef mln::value::hsl_f hsl_f;
+ typedef mln::fun::v2v::f_rgb_to_hsl_<hsl_f> rgb_to_hsl_f;
+ mln::image2d<rgb8> img_fst;
+ mln::image2d<hsl_f> img_ref;
+ rgb_to_hsl_f instance;
+ rgb8 rgb(255,127,0);
+ hsl_f hsl = instance(rgb);
+
+ std::cout << hsl.hue() << std::endl;
+ std::cout << hsl.lum() << std::endl;
+ std::cout << hsl.sat() << std::endl;
+
+
+ mln::io::ppm::load(img_fst, OLENA_IMG_PATH"/lena.ppm");
+ img_ref = mln::data::transform(img_fst, rgb_to_hsl_f());
+
+ //mln::accu::stat::histo3d_hsl<hsl_f>();
+
+}
+
+int main()
+{
+ /*
+ test_operator_equal<8>();
+ test_instantiation_without_argument<8>();
+ test_initialization<8>();
+ test_take_argument<8>();
+ test_take_other<8>();
+ test_integration<8>();
+ */
+
+ // p2p/fold+transform_domain for hcv
+
+ test();
+
+ return 0;
+}
--
1.5.6.5
1
0
* green/doc/examples : New directory.
Move hello_world directory in doc/examples.
* green/doc/examples/hello_world : New directory.
* green/doc/examples/hello_world/Makefile.am : Copy makefile.
* green/doc/examples/hello_world/hellow_world.cc : Copy source file.
* green/doc/examples/hello_world/print.cc : Copy source file.
* green/hello_world/hello_world.cc : Remove source file.
* green/hello_world/print.cc : Remove source file.
* green/hello_world/Makefile.am : Remove makefile.
* green/hello_world : Remove directory.
Move hello_milena directory in doc/examples.
* green/doc/exampleshello_milena : New directory.
* green/doc/exampleshello_milena/Makefile.am : Copy makefile.
* green/doc/examples/hello_milena/hello_milena.cc : Copy source file.
* green/hello_milena/hello_milena.cc : Remove source file.
* green/hello_milena/Makefile.am : Remove makefile.
* green/hello_milena : Remove directory.
Move learn_milena directory in doc/examples.
* green/doc/examples/learn_milena : New directory.
* green/doc/examples/learn_milena/Makefile.am : Copy makefile.
* green/doc/examples/learn_milena/learn_milena.cc : Copy source file.
* green/learn_milena/learn_milena.cc : Remove source file.
* green/learn_milena/Makefile.am : Remove makefile.
* green/learn_milena : Remove directory.
Move otsu directory in doc/examples.
* green/doc/examples/otsu : New directory.
* green/doc/examples/otsu/Makefile.am : Copy makefile.
* green/doc/examples/otsu/otsu.cc : Copy source file.
* green/otsu/otsu.cc : Remove source file.
* green/otsu/Makefile.am : Remove makefile.
* green/otsu : Remove directory.
Move fraction directory in doc/examples.
* green/doc/examples/fraction : Remove directory.
* green/doc/examples/fraction/Makefile.am : Remove makefile.
* green/doc/examples/fraction/frac.cc : Remove source file.
* green/doc/examples/fraction/frac.hh : Remove source file.
* green/doc/examples/fraction/sign_prod.hh : Remove source file.
* green/doc/examples/fraction/gcd.hh : Remove source file.
* green/fraction/frac.cc : Remove source file.
* green/fraction/frac.hh : Remove source file.
* green/fraction/sign_prod.hh : Remove source file.
* green/fraction/gcd.hh : Remove source file.
* green/fraction/Makefile.am : Remove makefile.
* green/fraction : Remove directory.
Add A new example in doc/examples.
* green/doc/examples/accu_color : New directory.
* green/doc/examples/accu_color/accu_color.cc : New source file.
---
trunk/milena/sandbox/ChangeLog | 70 ++++++
.../green/doc/examples/accu_color/accu_color.cc | 249 ++++++++++++++++++++
.../green/{ => doc/examples}/fraction/Makefile.am | 0
.../green/{ => doc/examples}/fraction/frac.cc | 0
.../green/{ => doc/examples}/fraction/frac.hh | 0
.../green/{ => doc/examples}/fraction/gcd.hh | 0
.../green/{ => doc/examples}/fraction/sign_prod.hh | 0
.../{ => doc/examples}/hello_milena/Makefile.am | 0
.../examples}/hello_milena/hello_milena.cc | 0
.../{ => doc/examples}/hello_world/Makefile.am | 0
.../{ => doc/examples}/hello_world/hello_world.cc | 0
.../green/{ => doc/examples}/hello_world/print.cc | 0
.../{ => doc/examples}/learn_milena/Makefile.am | 0
.../examples}/learn_milena/learn_milena.cc | 0
.../green/{ => doc/examples}/otsu/Makefile.am | 0
.../sandbox/green/{ => doc/examples}/otsu/otsu.cc | 0
16 files changed, 319 insertions(+), 0 deletions(-)
create mode 100644 trunk/milena/sandbox/green/doc/examples/accu_color/accu_color.cc
rename trunk/milena/sandbox/green/{ => doc/examples}/fraction/Makefile.am (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/fraction/frac.cc (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/fraction/frac.hh (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/fraction/gcd.hh (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/fraction/sign_prod.hh (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/hello_milena/Makefile.am (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/hello_milena/hello_milena.cc (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/hello_world/Makefile.am (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/hello_world/hello_world.cc (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/hello_world/print.cc (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/learn_milena/Makefile.am (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/learn_milena/learn_milena.cc (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/otsu/Makefile.am (100%)
rename trunk/milena/sandbox/green/{ => doc/examples}/otsu/otsu.cc (100%)
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 8bb5ec1..00a840e 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,5 +1,75 @@
2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Do some refactoring in green's sandbox.
+
+ * green/doc/examples : New directory.
+
+ Move hello_world directory in doc/examples.
+
+ * green/doc/examples/hello_world : New directory.
+ * green/doc/examples/hello_world/Makefile.am : Copy makefile.
+ * green/doc/examples/hello_world/hellow_world.cc : Copy source file.
+ * green/doc/examples/hello_world/print.cc : Copy source file.
+
+ * green/hello_world/hello_world.cc : Remove source file.
+ * green/hello_world/print.cc : Remove source file.
+ * green/hello_world/Makefile.am : Remove makefile.
+ * green/hello_world : Remove directory.
+
+ Move hello_milena directory in doc/examples.
+
+ * green/doc/exampleshello_milena : New directory.
+ * green/doc/exampleshello_milena/Makefile.am : Copy makefile.
+ * green/doc/examples/hello_milena/hello_milena.cc : Copy source file.
+
+ * green/hello_milena/hello_milena.cc : Remove source file.
+ * green/hello_milena/Makefile.am : Remove makefile.
+ * green/hello_milena : Remove directory.
+
+ Move learn_milena directory in doc/examples.
+
+ * green/doc/examples/learn_milena : New directory.
+ * green/doc/examples/learn_milena/Makefile.am : Copy makefile.
+ * green/doc/examples/learn_milena/learn_milena.cc : Copy source file.
+
+ * green/learn_milena/learn_milena.cc : Remove source file.
+ * green/learn_milena/Makefile.am : Remove makefile.
+ * green/learn_milena : Remove directory.
+
+ Move otsu directory in doc/examples.
+
+ * green/doc/examples/otsu : New directory.
+ * green/doc/examples/otsu/Makefile.am : Copy makefile.
+ * green/doc/examples/otsu/otsu.cc : Copy source file.
+
+ * green/otsu/otsu.cc : Remove source file.
+ * green/otsu/Makefile.am : Remove makefile.
+ * green/otsu : Remove directory.
+
+ Move fraction directory in doc/examples.
+
+ * green/doc/examples/fraction : Remove directory.
+ * green/doc/examples/fraction/Makefile.am : Remove makefile.
+ * green/doc/examples/fraction/frac.cc : Remove source file.
+ * green/doc/examples/fraction/frac.hh : Remove source file.
+ * green/doc/examples/fraction/sign_prod.hh : Remove source file.
+ * green/doc/examples/fraction/gcd.hh : Remove source file.
+
+ * green/fraction/frac.cc : Remove source file.
+ * green/fraction/frac.hh : Remove source file.
+ * green/fraction/sign_prod.hh : Remove source file.
+ * green/fraction/gcd.hh : Remove source file.
+ * green/fraction/Makefile.am : Remove makefile.
+ * green/fraction : Remove directory.
+
+ Add A new example in doc/examples.
+
+ * green/doc/examples/accu_color : New directory.
+ * green/doc/examples/accu_color/accu_color.cc : New source file.
+
+
+2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Remove trailing spaces.
* green/doc/formulae/formulae.tex : Correct file.
diff --git a/trunk/milena/sandbox/green/doc/examples/accu_color/accu_color.cc b/trunk/milena/sandbox/green/doc/examples/accu_color/accu_color.cc
new file mode 100644
index 0000000..6b2a088
--- /dev/null
+++ b/trunk/milena/sandbox/green/doc/examples/accu_color/accu_color.cc
@@ -0,0 +1,249 @@
+// Pour les flux d'entrées/sorties
+#include <iostream>
+
+// Pour les traces dans le code et le debuggage
+#include <mln/trace/entering.hh>
+#include <mln/trace/exiting.hh>
+
+// Pour les opérateurs statistiques sur une image
+#include <mln/accu/stat/min.hh>
+#include <mln/accu/stat/max.hh>
+#include <mln/accu/stat/mean.hh>
+#include <mln/accu/stat/variance.hh>
+#include <mln/accu/stat/var.hh>
+#include <mln/data/compute.hh>
+
+// Pour les chargements/sauvegardes des images
+#include <mln/io/ppm/load.hh>
+#include <mln/io/pgm/save.hh>
+#include <mln/io/pbm/save.hh>
+
+// Pour les types de base
+#include <mln/core/image/image2d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/value/lut_vec.hh>
+#include <mln/value/set.hh>
+#include <mln/literal/colors.hh>
+
+// Pour le seuillage d'une image
+#include <mln/binarization/threshold.hh>
+
+// Pour le mécanisme de restriction de domaine
+#include <mln/core/image/dmorph/image_if.hh>
+#include <mln/core/concept/meta_accumulator.hh>
+#include <mln/pw/value.hh>
+
+// Pour le copier/coller et le remplissage
+#include <mln/data/paste.hh>
+#include <mln/data/fill.hh>
+#include <mln/make/pix.hh>
+#include <mln/make/vec.hh>
+
+// Pour les macros basiques (affectation d'une image ...)
+#include <mln/core/var.hh>
+#include <mln/algebra/vec.hh>
+#include <mln/core/concept/function.hh>
+#include <mln/core/alias/box2d.hh>
+#include <mln/core/alias/point2d.hh>
+#include <mln/core/concept/value_set.hh>
+#include <mln/core/site_set/p_array.hh>
+#include <mln/trait/images.hh>
+
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/function.hh>
+# include <mln/value/set.hh>
+# include <mln/value/lut_vec.hh>
+# include <mln/opt/value.hh>
+//
+// DEFINITION D'UNE FONCTION COMPUTE POUR L'ACCUMULATOR MATRICE VARIANCE/COVARIANCE
+//
+namespace mln
+{
+ namespace usr
+ {
+ template<typename A, typename I, typename F>
+ A
+ compute(Accumulator<A>& a_, const Image<I>& input_, const Function_v2v<F>& fn_)
+ {
+ A& a = exact(a_);
+ const I& input = exact(input_);
+ const F& fn = exact(fn_);
+
+ // vérifier la concordance entre l'image et l'accumulateur
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ a.take(fn(input(p)));
+
+ return a;
+ }
+ } // namespace usr
+} // namespace mln
+
+
+//
+// DEFINTIION D'UNE FONCTION TRADUISANT UN PIXEL RGB EN VECTEUR 3D
+//
+namespace mln
+{
+ namespace fun
+ {
+ namespace usr
+ {
+ template<typename V, typename R>
+ struct rgb2vec : public Function_v2v< rgb2vec<V,R> >
+ {
+ typedef R result;
+ result operator()(const V& rgb) const;
+ };
+
+ template<typename V, typename R>
+ typename rgb2vec<V,R>::result
+ rgb2vec<V,R>::operator()(const V& rgb) const
+ {
+ // !!la dimension des objets doit être la même!!
+
+ return make::vec(rgb.red(), rgb.green(), rgb.blue());
+ }
+ } // namespace usr
+ } // namespace fun
+} // namespace mln
+
+
+//
+// DEFINTIION D'UNE FONCTION IMAGE EXISTANE ASSOCIANT UNE VALEUR A UN SITE
+//
+namespace mln
+{
+ namespace fun
+ {
+ namespace usr
+ {
+ template<typename I>
+ struct image_fun : public Function_v2v< image_fun<I> >, private mlc_is_a(I, Image)::check_t
+ {
+ typedef mln_value(I) result;
+ image_fun(mlc_const(I)& img);
+ result operator()(const mln_psite(I)& p) const;
+
+ private:
+ mlc_const(I) img_;
+ };
+
+ template<typename I>
+ image_fun<I>::image_fun(mlc_const(I)& img) : img_(img)
+ {
+ }
+
+ template<typename I>
+ typename image_fun<I>::result
+ image_fun<I>::operator()(const mln_psite(I)& p) const
+ {
+ return img_(p);
+ }
+ } // namespace usr
+ } // namespace fun
+} // namespace mln
+
+
+namespace mln{namespace fun{
+
+template<typename I, typename F>
+void test(Image<I>& input_, const Function_v2v<F>& f_)
+{
+ I& input = exact(input_);
+ const F& f = exact(f_);
+
+ value::lut_vec<mln_vset(I), mln_result(F)> lut(input.values_eligible(), f);
+
+ std::cout << lut;
+}
+}}
+
+template<typename V>
+void print(V v)
+{
+ using namespace mln;
+ using namespace std;
+
+ mln_trait_image_quant(image2d<value::rgb8>) quant;
+ cout << quant.name();
+}
+
+int main()
+{
+ using namespace mln;
+ using namespace std;
+
+ typedef algebra::vec<3,float> v3i;
+
+ image2d<value::rgb8> input;
+ io::ppm::load(input, "/usr/local/share/olena/images/small.ppm");
+
+ accu::stat::var<v3i> var;
+ value::rgb8 rgb(8,2,4);
+ fun::usr::rgb2vec< value::rgb8, v3i > fun;
+ v3i aVector;
+
+ //usr::compute2(accu::stat::var<v3i>(), input, fun::usr::rgb2vec< value::rgb8, v3i >());
+ //data::compute(accu::stat::var<v3i>(), input);
+ //cout << usr::compute(var, input, fun);
+
+ mln::fun::test(input, fun:v2v::inc());
+}
+
+/*
+int main2()
+{
+ using namespace mln;
+ using namespace std;
+
+// trace::quiet = false;
+ trace::entering("main");
+
+ // (1) Charger une image
+ image2d<value::rgb8> input;
+ io::ppm::load(input, "/usr/local/share/olena/images/small.ppm");
+
+ typedef algebra::vec<3,value::int_u8> v3i;
+
+ accu::stat::var<v3i> var;
+ value::rgb8 rgb(8,2,4);
+ fun::usr::rgb2vec< value::rgb8, v3i > fun;
+ v3i aVector;
+
+ aVector[0] = 8;
+ aVector[1] = 2;
+ aVector[2] = 4;
+
+ //var.take(aVector);
+ //var.take(make::vec(rgb.red(), rgb.green(), rgb.blue()));
+
+ //value::rgb8 purple = literal::purple;
+ value::rgb8 purple = aVector;
+
+ cout << "( " << purple.red() << " , " << purple.green() << " , " << purple.blue() << " )" << endl;
+
+
+ //usr::compute2(accu::stat::var<v3i>(), input, fun::usr::rgb2vec< value::rgb8, v3i >());
+ cout << usr::compute(var, input, fun);
+ // tester s'il peut trouver la fonction
+
+
+ // Essaie avec using namespace mln;
+ using namespace std;
+ //look up table pour les couleurs
+ fun::usr::image_fun< image2d<value::rgb8> > image_fun(input);
+
+ print<int>(3);
+ mln::fun::test(input, fun:v2v::inc());
+
+ //value::lut_vec<mln_vset(image2d<value::rgb8>), mln_result(fun::usr::image_fun< image2d<value::rgb8> >) > lut(input.values_eligible(), image_fun);
+
+ trace::exiting("main");
+
+ return 0;
+}
+*/
+
diff --git a/trunk/milena/sandbox/green/fraction/Makefile.am b/trunk/milena/sandbox/green/doc/examples/fraction/Makefile.am
similarity index 100%
rename from trunk/milena/sandbox/green/fraction/Makefile.am
rename to trunk/milena/sandbox/green/doc/examples/fraction/Makefile.am
diff --git a/trunk/milena/sandbox/green/fraction/frac.cc b/trunk/milena/sandbox/green/doc/examples/fraction/frac.cc
similarity index 100%
rename from trunk/milena/sandbox/green/fraction/frac.cc
rename to trunk/milena/sandbox/green/doc/examples/fraction/frac.cc
diff --git a/trunk/milena/sandbox/green/fraction/frac.hh b/trunk/milena/sandbox/green/doc/examples/fraction/frac.hh
similarity index 100%
rename from trunk/milena/sandbox/green/fraction/frac.hh
rename to trunk/milena/sandbox/green/doc/examples/fraction/frac.hh
diff --git a/trunk/milena/sandbox/green/fraction/gcd.hh b/trunk/milena/sandbox/green/doc/examples/fraction/gcd.hh
similarity index 100%
rename from trunk/milena/sandbox/green/fraction/gcd.hh
rename to trunk/milena/sandbox/green/doc/examples/fraction/gcd.hh
diff --git a/trunk/milena/sandbox/green/fraction/sign_prod.hh b/trunk/milena/sandbox/green/doc/examples/fraction/sign_prod.hh
similarity index 100%
rename from trunk/milena/sandbox/green/fraction/sign_prod.hh
rename to trunk/milena/sandbox/green/doc/examples/fraction/sign_prod.hh
diff --git a/trunk/milena/sandbox/green/hello_milena/Makefile.am b/trunk/milena/sandbox/green/doc/examples/hello_milena/Makefile.am
similarity index 100%
rename from trunk/milena/sandbox/green/hello_milena/Makefile.am
rename to trunk/milena/sandbox/green/doc/examples/hello_milena/Makefile.am
diff --git a/trunk/milena/sandbox/green/hello_milena/hello_milena.cc b/trunk/milena/sandbox/green/doc/examples/hello_milena/hello_milena.cc
similarity index 100%
rename from trunk/milena/sandbox/green/hello_milena/hello_milena.cc
rename to trunk/milena/sandbox/green/doc/examples/hello_milena/hello_milena.cc
diff --git a/trunk/milena/sandbox/green/hello_world/Makefile.am b/trunk/milena/sandbox/green/doc/examples/hello_world/Makefile.am
similarity index 100%
rename from trunk/milena/sandbox/green/hello_world/Makefile.am
rename to trunk/milena/sandbox/green/doc/examples/hello_world/Makefile.am
diff --git a/trunk/milena/sandbox/green/hello_world/hello_world.cc b/trunk/milena/sandbox/green/doc/examples/hello_world/hello_world.cc
similarity index 100%
rename from trunk/milena/sandbox/green/hello_world/hello_world.cc
rename to trunk/milena/sandbox/green/doc/examples/hello_world/hello_world.cc
diff --git a/trunk/milena/sandbox/green/hello_world/print.cc b/trunk/milena/sandbox/green/doc/examples/hello_world/print.cc
similarity index 100%
rename from trunk/milena/sandbox/green/hello_world/print.cc
rename to trunk/milena/sandbox/green/doc/examples/hello_world/print.cc
diff --git a/trunk/milena/sandbox/green/learn_milena/Makefile.am b/trunk/milena/sandbox/green/doc/examples/learn_milena/Makefile.am
similarity index 100%
rename from trunk/milena/sandbox/green/learn_milena/Makefile.am
rename to trunk/milena/sandbox/green/doc/examples/learn_milena/Makefile.am
diff --git a/trunk/milena/sandbox/green/learn_milena/learn_milena.cc b/trunk/milena/sandbox/green/doc/examples/learn_milena/learn_milena.cc
similarity index 100%
rename from trunk/milena/sandbox/green/learn_milena/learn_milena.cc
rename to trunk/milena/sandbox/green/doc/examples/learn_milena/learn_milena.cc
diff --git a/trunk/milena/sandbox/green/otsu/Makefile.am b/trunk/milena/sandbox/green/doc/examples/otsu/Makefile.am
similarity index 100%
rename from trunk/milena/sandbox/green/otsu/Makefile.am
rename to trunk/milena/sandbox/green/doc/examples/otsu/Makefile.am
diff --git a/trunk/milena/sandbox/green/otsu/otsu.cc b/trunk/milena/sandbox/green/doc/examples/otsu/otsu.cc
similarity index 100%
rename from trunk/milena/sandbox/green/otsu/otsu.cc
rename to trunk/milena/sandbox/green/doc/examples/otsu/otsu.cc
--
1.5.6.5
1
0
* green/doc/formulae/formulae.tex : Correct file
---
trunk/milena/sandbox/ChangeLog | 6 ++++++
.../milena/sandbox/green/doc/formulae/formulae.tex | 8 ++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 923875c..8bb5ec1 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,5 +1,11 @@
2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Remove trailing spaces.
+
+ * green/doc/formulae/formulae.tex : Correct file.
+
+2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Correct english writing in the documentation file.
* green/doc/formulae/formulae.tex : Correct file.
diff --git a/trunk/milena/sandbox/green/doc/formulae/formulae.tex b/trunk/milena/sandbox/green/doc/formulae/formulae.tex
index 655cb1a..43bfbf5 100644
--- a/trunk/milena/sandbox/green/doc/formulae/formulae.tex
+++ b/trunk/milena/sandbox/green/doc/formulae/formulae.tex
@@ -1084,7 +1084,7 @@ $
%%=================================================================
\subsection{MCO for eigenvalues}
-In 3d, it's difficult to extract the cubic roots from the characteristic
+In 3d, it's difficult to extract the cubic roots from the characteristic
polynomia. The difficulties disappear when we find one of the three roots.
A planar regression allows us to reach the equation of the plane. From the
equation, we can determine its normal vector $\bm{w}$. It satisfies the
@@ -1096,17 +1096,17 @@ the two others eigenvalues (just solve $\lambda^2 - (trace(A) - \lambda_3)
$\lambda_2$ let us find $\bm{u}$ and $\bm{v}$ by the equations $A\bm{u} =
\lambda_1\bm{u}$ and $A\bm{v} = \lambda_2\bm{v}$.
-Let's center the points by subtracting their center of mass. Now, we have
+Let's center the points by subtracting their center of mass. Now, we have
three equivalent ways to estimate the coefficients of the plane:
\begin{itemize}
\item if not $c = 0$, then $\frac{a}{c}x + \frac{b}{c}y + z = 0$,
\item if not $b = 0$, then $\frac{a}{b}x + y + \frac{c}{b}z = 0$,
\item if not $a = 0$, then $x + \frac{b}{a}y + \frac{c}{a}z = 0$.
\end{itemize}
-As we cannot decide which way is the best, may be we have to test the three
+As we cannot decide which way is the best, may be we have to test the three
ones.
-Let's choose the linear model of the major inertia plane
+Let's choose the linear model of the major inertia plane
($ax + by + cz + d = 0$). With not $c = 0$.
\begin{tabular}{lcl}
--
1.5.6.5
1
0
#216: Color artifacts in HQx
---------------------+------------------------------------------------------
Reporter: freling | Owner: freling
Type: defect | Status: new
Priority: minor | Milestone:
Component: Milena | Version: 1.0
Keywords: |
---------------------+------------------------------------------------------
HQx algorithms have some color artifacts.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/216>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
1
0
* green/doc/formulae/formulae.tex : Correct file.
---
trunk/milena/sandbox/ChangeLog | 6 +
.../milena/sandbox/green/doc/formulae/formulae.tex | 116 ++++++++++----------
2 files changed, 64 insertions(+), 58 deletions(-)
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 6572258..923875c 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-11 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Correct english writing in the documentation file.
+
+ * green/doc/formulae/formulae.tex : Correct file.
+
2009-09-10 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Try to fix order problem between points and vectors.
diff --git a/trunk/milena/sandbox/green/doc/formulae/formulae.tex b/trunk/milena/sandbox/green/doc/formulae/formulae.tex
index 52af7a7..655cb1a 100644
--- a/trunk/milena/sandbox/green/doc/formulae/formulae.tex
+++ b/trunk/milena/sandbox/green/doc/formulae/formulae.tex
@@ -41,7 +41,7 @@
\newcommand{\fm}[1]{\mathbb{#1}}
%% \df
-%% input : the set which the dim we are intering in
+%% input : the set whose dimension we are interested in
%%
\newcommand{\df}[1]{|{\mathbb{#1}}|}
@@ -65,20 +65,20 @@ in the development.
\section{Notations}
\begin{itemize}
- \item Use lowercase and normal font for the scalar variables.
- \item Use lowercase and bold font for the vector variables.
- \item Use uppercase and normal font for the matrix variables.
- \item Use uppercase and double font for the set variables.
+ \item Use lowercase and normal font for scalar variables.
+ \item Use lowercase and bold font for vector variables.
+ \item Use uppercase and normal font for matrix variables.
+ \item Use uppercase and double font for set variables.
\end {itemize}
%=================================================================
\subsection{Sets}
-There is three particular sets that we use every time:
+There are three particular sets that we use every time:
\begin{itemize}
- \item The color space $\fm{C}$ in which the pixels take their value.
- \item The dataset $\fm{P}$ which contains every pixel we take care.
- \item The group set $\fm{G}$ that define any splitting of the dataset.
+ \item The color space $\fm{C}$ in which the pixels take their values.
+ \item The dataset $\fm{P}$ which contains every pixel we care about.
+ \item The group set $\fm{G}$ that defines any splitting of the dataset.
\end{itemize}
\begin{tabular}{|c|l|l|c|c|}
@@ -98,15 +98,15 @@ There is three particular sets that we use every time:
%=================================================================
\subsection{Color space}
-We use the euclidian distance.
+We use the Euclidian distance.
-$$
+\[
d(a,b) =
\sqrt{\sum_{i=0}^q (a_i - b_i)^2} =
\sqrt{(a_x - b_x)^2 + (a_y - b_y)^2 + (a_z - b_z)^2}
-$$
+\]
-$$
+\[
d(a,b)^2 =
\left[\begin{array}{ccc}
a_x - b_x & a_y - b_y & a_z - b_z
@@ -117,13 +117,13 @@ d(a,b)^2 =
a_y - b_y \\
a_y - b_z
\end{array}\right]
-$$
+\]
%=================================================================
\subsection{Data points in $\mathbb{R}^3$}
We present the four points of the dataset with their vector representation.
-$$
+\[
\bm{a} =
\left[\begin{array}{c}
a_x \\
@@ -143,9 +143,9 @@ $$
p_{13}
\end{array}\right]
= \bm{p}_1
-$$
+\]
-$$
+\[
\bm{b} =
\left[\begin{array}{c}
b_x \\
@@ -187,9 +187,9 @@ $$
p_{33}
\end{array}\right]
= \bm{p}_3
-$$
+\]
-$$
+\[
\mbox{\boldmath$d$} =
\left[\begin{array}{c}
d_x \\
@@ -209,11 +209,11 @@ $$
p_{43}
\end{array}\right]
= \bm{p}_4
-$$
+\]
One may group the four points in one matrix P :
-$$
+\[
P =
\left[\begin{array}{c}
\bm{a}^t \\
@@ -249,12 +249,12 @@ P =
\bm{p}_3^t \\
\bm{p}_4^t
\end{array}\right]
-$$
+\]
%=================================================================
\subsection{The group}
-We can define the group set $\fm{G}$ in thow context:
+We can define the group set $\fm{G}$ in this context:
\begin{itemize}
\item First, the group set is a partition.
\item Second, the group set if a fuzzy set.
@@ -321,7 +321,7 @@ Let's have a look to the first three moments.
%=================================================================
\subsection{The mean}
-$$
+\[
\mbox{\boldmath$m$} =
\left[\begin{array}{c}
m_x \\
@@ -353,8 +353,8 @@ $$
\mbox{\boldmath$d$})
=
\frac{1}{4}\sum_{i=1}^{4}\mbox{\boldmath$p$}_i
-$$
-$$
+\]
+\[
\mbox{\boldmath$m$} =
\frac{1}{4}
\left[\begin{array}{cccc}
@@ -382,10 +382,10 @@ $$
\end{array}\right]
=
\frac{1}{4} P^t \mbox{\boldmath$ 1$}
-$$
+\]
The mean matrix:
-$$
+\[
M =
\left[\begin{array}{c}
\mbox{\boldmath$m$}^t \\
@@ -407,10 +407,10 @@ M =
m_1 & m_2 & m_3 \\
m_1 & m_2 & m_3
\end{array}\right]
-$$
+\]
We define the difference between a point $\mbox{\boldmath$p$}_i$ and the mean:
-$$
+\[
(\mbox{\boldmath$p$}_i - \mbox{\boldmath$m$}) =
\left[\begin{array}{c}
p_{ix} - m_x \\
@@ -423,11 +423,11 @@ $$
p_{i2} - m_2 \\
p_{i3} - m_3
\end{array}\right]
-$$
+\]
And for all the dataset:
-$$
+\[
(P - M) =
\left[\begin{array}{ccc}
a_x & a_y & a_z \\
@@ -449,12 +449,12 @@ $$
c_x - m_x & c_y - m_y & c_z - m_z \\
d_x - m_x & d_y - m_y & d_z - m_z
\end{array}\right]
-$$
+\]
%=================================================================
\subsection{The variance}
-$$
+\[
\begin{array}{lcl}
V & = &
\left[\begin{array}{ccc}
@@ -501,12 +501,12 @@ V & = &
\frac{1}{4}
(P - M)^t (P - M)
\end{array}
-$$
+\]
%#################################################################
\section{Splitting into groups}
-When we study some mixed population, the total variance can be splitted in the
-the variance between the groups and in the variance whithin each group.
+When we study some mixed population, the total variance can be split in
+the variance between the groups and in the variance within each group.
We define two groups in the population. Each group owns its moments of the
second order.
@@ -514,51 +514,51 @@ second order.
%=================================================================
\subsection{Decomposing the count}
-$$
+\[
\begin{array}{lcl}
n_t & = & n_1 + n_2 \\
& = & \sum_{i=1}^{2} n_i
\end{array}
-$$
+\]
%=================================================================
\subsection{Decomposing the mean}
-$$
+\[
\begin{array}{lcl}
\mbox{\boldmath$m_t$} & = &
\frac{1}{n_t}(n_1 \mbox{\boldmath$m_1$} + n_2 \mbox{\boldmath$m_2$}) \\
& = &
\frac{1}{n_t}\sum_{i=1}^{2} n_i \mbox{\boldmath$m_i$}
\end{array}
-$$
+\]
%=================================================================
\subsection{Decomposing the variance}
-When we study some mixed population, the total variance can be splitted in the
-the variance between the groups and in the variance whithin each group.
+When we study some mixed population, the total variance can be split in
+the variance between the groups and in the variance within each group.
-$$
+\[
V_t = V_i + V_b
-$$
+\]
-$$
+\[
\begin{array}{lcl}
V_i & = & \frac{1}{n_t}(n_1 V_1 + n_2 V_2) \\
& = & \frac{1}{n_t}\sum_{i=1}^2 n_i V_i
\end{array}
-$$
+\]
-$$
+\[
\begin{array}{lcl}
V_b & = & \frac{1}{n_t}(n_1 (\mbox{\boldmath$m_1$} - \mbox{\boldmath$m_t$})^2 +
n_2 (\mbox{\boldmath$m_2$} - \mbox{\boldmath$m_t$})^2 \\
& = & \frac{1}{n_t} \sum_{i=1}^2 n_i
(\mbox{\boldmath$m_i$} - \mbox{\boldmath$m_t$})^2
\end{array}
-$$
+\]
%#################################################################
\section{Basis}
@@ -566,7 +566,7 @@ $$
%%=================================================================
\subsection{Determinant of a square matrix 3x3}
-$$
+\[
\det{V} =
\left|\begin{array}{ccc}
v_{11} & v_{12} & v_{13} \\
@@ -577,12 +577,12 @@ $$
v_{11}(v_{22}v_{33} - v_{32}v_{23})
- v_{12}(v_{21}v_{33} - v_{31}v_{23})
+ v_{13}(v_{21}v_{32} - v_{31}v_{22})
-$$
+\]
%%=================================================================
\subsection{Transpose}
-$
+\[
V^t =
\left[\begin{array}{ccc}
v_{11} & v_{12} & v_{13} \\
@@ -595,7 +595,7 @@ V^t =
v_{12} & v_{22} & v_{32} \\
v_{13} & v_{23} & v_{33}
\end{array}\right]
-$
+\]
%%=================================================================
\subsection{Inverse of a square matrix 3x3}
@@ -759,8 +759,8 @@ $$
%%=================================================================
\subsection{Eigenvalues and eigenvectors}
-We assume that we work on variance/covariance matrix which is real and symetric.
-In this case, all the three eigen values are real.
+We assume that we work on a variance/covariance matrix which is real and
+symmetric. In this case, all the three eigenvalues are real.
$$
V \bm{x} = \lambda \bm{x}
@@ -1089,14 +1089,14 @@ polynomia. The difficulties disappear when we find one of the three roots.
A planar regression allows us to reach the equation of the plane. From the
equation, we can determine its normal vector $\bm{w}$. It satisfies the
following equation $A\bm{w} = \lambda_3\bm{w}$. Thus we know $\lambda_3$.
-By the way, as far as $trace(A) = \lambda_1 + \lambda_2 + \lambda_3$ and
-$det(A) = \lambda_1 \lambda_2 \lambda_3$, then we can access to the value of
+By the way, $trace(A) = \lambda_1 + \lambda_2 + \lambda_3$ and
+$det(A) = \lambda_1 \lambda_2 \lambda_3$, then we can determine the value of
the two others eigenvalues (just solve $\lambda^2 - (trace(A) - \lambda_3)
\lambda + \frac{det(A)}{\lambda_3} = 0$). The knowledge of $\lambda_1$ and
$\lambda_2$ let us find $\bm{u}$ and $\bm{v}$ by the equations $A\bm{u} =
\lambda_1\bm{u}$ and $A\bm{v} = \lambda_2\bm{v}$.
-Let's center the points by susbtracting their center of mass. Now, we have
+Let's center the points by subtracting their center of mass. Now, we have
three equivalent ways to estimate the coefficients of the plane:
\begin{itemize}
\item if not $c = 0$, then $\frac{a}{c}x + \frac{b}{c}y + z = 0$,
--
1.5.6.5
1
0
* green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc
(var_histo, mean_histo) : Comment p.to_vec code.
---
trunk/milena/sandbox/ChangeLog | 7 +++++++
.../tests/accu/stat/histo3d_rgb/histo3d_rgb.cc | 2 ++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 8b4d62c..6572258 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,5 +1,12 @@
2009-09-10 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Try to fix order problem between points and vectors.
+
+ * green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc
+ (var_histo, mean_histo) : Comment p.to_vec code.
+
+2009-09-10 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Write down the basis of the quick tour summary documentation.
* green/doc/quick_tour : New specific directory.
diff --git a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc
index 37645ef..114a52d 100644
--- a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc
+++ b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc
@@ -215,6 +215,7 @@ mln::algebra::vec<3,float> mean_histo(const mln::image3d<unsigned>& img)
*/
count += img(p);
sum += conv((vec3f)p) * img(p);
+ // sum += p.to_vec() * img(p);
}
result = sum / count;
@@ -260,6 +261,7 @@ mln::algebra::mat<3,3,float> var_histo2(const mln::image3d<unsigned>& img)
for_all(p)
{
+ // point = p.to_vec() - mean;
point = conv((vec3f)p) - mean;
result += img(p) * (point * point.t());
}
--
1.5.6.5
1
0