[PATCH 5/8] Start a new experiment for Laurent.

* levillain/.gitignore: Add constrained-connectivity. * levillain/alexandre: New symlink to abraham/mln/morpho. * levillain/theo: New symlink to theo/esiee/laurent/ismm09. * levillain/constrained-connectivity.cc: New. --- milena/sandbox/ChangeLog | 9 ++ milena/sandbox/levillain/.gitignore | 1 + milena/sandbox/levillain/alexandre | 1 + .../sandbox/levillain/constrained-connectivity.cc | 98 ++++++++++++++++++++ milena/sandbox/levillain/theo | 1 + 5 files changed, 110 insertions(+), 0 deletions(-) create mode 120000 milena/sandbox/levillain/alexandre create mode 100644 milena/sandbox/levillain/constrained-connectivity.cc create mode 120000 milena/sandbox/levillain/theo diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog index 83ef8c3..673d4d8 100644 --- a/milena/sandbox/ChangeLog +++ b/milena/sandbox/ChangeLog @@ -1,5 +1,14 @@ 2009-09-03 Roland Levillain <roland@lrde.epita.fr> + Start a new experiment for Laurent. + + * levillain/.gitignore: Add constrained-connectivity. + * levillain/alexandre: New symlink to abraham/mln/morpho. + * levillain/theo: New symlink to theo/esiee/laurent/ismm09. + * levillain/constrained-connectivity.cc: New. + +2009-09-03 Roland Levillain <roland@lrde.epita.fr> + * theo/esiee/laurent/ismm09/cplx2d.hh: Include mln/core/var.hh. 2009-09-03 Roland Levillain <roland@lrde.epita.fr> diff --git a/milena/sandbox/levillain/.gitignore b/milena/sandbox/levillain/.gitignore index 627984b..e55cea5 100644 --- a/milena/sandbox/levillain/.gitignore +++ b/milena/sandbox/levillain/.gitignore @@ -1,2 +1,3 @@ +constrained-connectivity double min-max diff --git a/milena/sandbox/levillain/alexandre b/milena/sandbox/levillain/alexandre new file mode 120000 index 0000000..5edb140 --- /dev/null +++ b/milena/sandbox/levillain/alexandre @@ -0,0 +1 @@ +../abraham/mln/morpho/ \ No newline at end of file diff --git a/milena/sandbox/levillain/constrained-connectivity.cc b/milena/sandbox/levillain/constrained-connectivity.cc new file mode 100644 index 0000000..d740956 --- /dev/null +++ b/milena/sandbox/levillain/constrained-connectivity.cc @@ -0,0 +1,98 @@ +/* The Work: + + - Prendre une image 2d + - En doubler les pixels (un pixel -> un carré de quatre pixels) + - En calculer un graphe d'arrête (passage en complexe cubique) + - Valuer les arrêtes avec une magnitude de gradient (|v1 - v2|) + - Calculer une LPE topo sur ce gradient + - Seuiller les valeurs de cette LPE doit être équivalent aux + alpha-CC de Pierre Soille (hypothèse de Laurent) + + - Puis, sur l'arbre des coupes (correspondant à la LPE topo + calculée ci-avant), calculer pour chaque arrête `e' un attribut + initialisé tel que `a(e) = (min(v1,v2), max(v1,v2))' (couple) où + `v1' et `v2' sont adjacents à `e', et propager ce min et ce max + sur tous les noeuds. + - Il doit normalement être possible d'obtenir les (alpha, + omega)-CC de Pierre Soille en filtrant cet arbre. */ + + +#include <cstdio> + +#include <set> +#include <iostream> + +#include <mln/value/int_u8.hh> +#include <mln/core/image/image2d.hh> + +#include <mln/pw/all.hh> + +#include <mln/io/pgm/load.hh> +#include <mln/debug/println.hh> + +// From Théo's sandbox. +#include <theo/cplx2d.hh> + +// From Alexandre Abraham's sandbox. +#include <alexandre/topo_wst.hh> + + +int main(int argc, char* argv[]) +{ + if (argc != 2) + { + std::cerr << "Usage: " << argv[0] << " input.pbm" << std::endl; + std::exit(1); + } + + using namespace mln; + using mln::value::int_u8; + + // Load an image. + image2d<int_u8> ima; + io::pgm::load(ima, argv[1]); + + // Double its resolution. + image2d<int_u8> ima_x2 (10, 10); + mln_piter_(image2d<int_u8>) p(ima_x2.domain()); + for_all(p) + { + /* This conversion from ``piter'' to ``point'' is required, since + an iterator does not expose the interface of the underlying + point (among which the methods row(), col(), etc.). */ + point2d p_ = p; + point2d q(p_.row() / 2, p_.col() / 2); + ima_x2(p) = ima(q); + } + debug::println(ima_x2); + + // Compute the associated line graph gradient. + mln_VAR(g, cplx2d::f_to_g(ima_x2) ); + debug::println("g:", g); + + // Compute a topological watershed transform on this gradient. + morpho::topo_wst<g_t, cplx2d::dbl_neighb2d> tree(g, cplx2d::e2e()); + tree.go(); + mln_VAR(w, morpho::topo_watershed(tree)); + debug::println("w:", w); + + // Computing the set of values of W. + // FIXME: Milena may provide something simpler than this. + std::set<int_u8> values; + mln_piter_(w_t) p2(w.domain()); + for_all(p2) + values.insert (w(p2)); + + // Thresholding for each value of W. + for (std::set<int_u8>::iterator alpha = values.begin(); + alpha != values.end(); ++alpha) + { + mln_VAR(alpha_cc, w | (pw::value(w) > pw::cst(*alpha))); + /* FIXME: There should be variants of debug::println allowing + the user to pass an optional ``support'' larger than the + actual domain of the image. For now, use a low-level routine + as a workaround. */ + std::cout << *alpha << "-cc:" << std::endl; + debug::impl::println(w.unmorph_().domain(), alpha_cc); + } +} diff --git a/milena/sandbox/levillain/theo b/milena/sandbox/levillain/theo new file mode 120000 index 0000000..7612684 --- /dev/null +++ b/milena/sandbox/levillain/theo @@ -0,0 +1 @@ +../theo/esiee/laurent/ismm09 \ No newline at end of file -- 1.6.4.2
participants (1)
-
Roland Levillain