* 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