
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena/sandbox Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Update morpho classif for LN. * geraud/laurent/classif.cc: Update. classif.cc | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) Index: geraud/laurent/classif.cc --- geraud/laurent/classif.cc (revision 2683) +++ geraud/laurent/classif.cc (working copy) @@ -58,6 +58,8 @@ #include <mln/norm/l2.hh> #include <mln/morpho/closing_area.hh> +#include <mln/morpho/closing_volume.hh> +#include <mln/morpho/closing_height.hh> #include <mln/morpho/meyer_wst.hh> @@ -116,9 +118,17 @@ } +void usage(char* argv[]) +{ + std::cerr << argv[0] << " lambda" << std::endl; + abort(); +} -int main() +int main(int argc, char* argv[]) { + if (argc != 2) + usage(argv); + using namespace mln; using mln::value::int_u8; @@ -156,7 +166,20 @@ unsigned nlabels; image2d<unsigned> label = labeling::blobs(seeds, c4(), nlabels); + + std::cout << "n seeds = " << nlabels << std::endl; + { + image2d<int_u8> lab(label.domain()); + level::paste(label, lab); + io::pgm::save(lab, "label.pgm"); + } + image2d<unsigned> iz = influence_zones(label, c4()); + { + image2d<int_u8> IZ(iz.domain()); + level::paste(iz, IZ); + io::pgm::save(IZ, "iz.pgm"); + } // debug::println( (pw::value(iz) - pw::cst(1)) | iz.domain() ); @@ -217,6 +240,8 @@ } } + std::cout << "v size = " << v.size() << std::endl; + // 1-faces (edges). std::vector<edge> e; { @@ -226,6 +251,8 @@ e.push_back( c.add_face(-v[l-1] + v[ll-1]) ); } + std::cout << "e size = " << e.size() << std::endl; + } @@ -284,7 +311,7 @@ v.next(); mln_invariant(!v.is_valid()); - dist_ima(e) = norm::l2_distance(p1.to_vec(), p2.to_vec()); + dist_ima(e) = norm::l2_distance(p1.to_vec(), p2.to_vec()) / 2; dist_max.take(dist_ima(e)); draw::line(canvas, p1, p2, dist_ima(e)); @@ -332,7 +359,7 @@ // Currently, does nothing (lambda = 1). dist_ima_t closed_dist_ima (dist_ima.domain()); - morpho::closing_area(dist_ima, nbh, 1, closed_dist_ima); + morpho::closing_height(dist_ima, nbh, atoi(argv[1]), closed_dist_ima); /*------. | WST. |