https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Update n_cmpt3.
* jardonnet/n_cmpt/n_cmpt3.hh: Minor change.
* jardonnet/n_cmpt/test3.cc: Display output image.
* jardonnet/igr/src/igr.cc: Fix call to closing.
igr/src/igr.cc | 3 +--
n_cmpt/n_cmpt3.hh | 31 +++++++++----------------------
n_cmpt/test3.cc | 10 ++++++++--
3 files changed, 18 insertions(+), 26 deletions(-)
Index: jardonnet/n_cmpt/n_cmpt3.hh
--- jardonnet/n_cmpt/n_cmpt3.hh (revision 2983)
+++ jardonnet/n_cmpt/n_cmpt3.hh (working copy)
@@ -81,6 +81,7 @@
{
unsigned label;
+ std::cout << "/ima/" << std::endl;
debug::println(ima);
// get /ima/ regional minima
@@ -97,6 +98,7 @@
morpho::tree::data<I,S> t(ima, sp, nbh);
V volume = morpho::tree::compute_attribute_image(A(), t);
sp = level::sort_psites_increasing(volume);
+ std::cout << "/volume/" << std::endl;
debug::println(volume);
// get /volume/ regional minima
@@ -140,6 +142,8 @@
mln_niter(N) n(nbh, p);
for_all(p)
{
+ //if (volume(p) > lambda)
+ // goto step2;
for_all(n)
{
if (volume.domain().has(n) && deja_vu(n))
@@ -148,28 +152,6 @@
P r = find_root(parent, n);
if (r != p)
{
- if (volume(p) > lambda)
- goto step2;
-// if (volume(r) != volume(p) && (data(p).to_result() > lambda))
-// {
-// data(p).set_value(lambda);
-// continue;
-// }
-
-// if (volume(r) != volume(p))
-// {
-// std::cout << "1: volume"<<r<<" !=
volume"<<p<<"" << " with data"<<p<<
" = " <<
-// data(p).to_result() << std::endl;
-// if (not volume_set(p).is_empty())
-// {
-// std::cout << "2: not
volume_set"<<p<<".is_empty()" << std::endl;
-// if (volume_set(p) != volume_set(r))
-// {
-// std::cout << "3:
volume_set"<<p<<" != volume_set"<<r<< std::endl;
-// cmpts--;
-// }
-// }
-// }
// propagate set
volume_set(p).insert(volume_set(r));
// build tree
@@ -181,6 +163,7 @@
}
debug::println(volume_set);
+
step2:
// std::cout << "Nb cmpts after processing : " << cmpts
<< std::endl;
@@ -195,6 +178,10 @@
output(p) = output(parent(p));
}
+ std::cout << "/output/" << std::endl;
+ debug::println(output);
+ assert(output != input);
+
return output;
}
Index: jardonnet/n_cmpt/test3.cc
--- jardonnet/n_cmpt/test3.cc (revision 2983)
+++ jardonnet/n_cmpt/test3.cc (working copy)
@@ -8,6 +8,9 @@
#include <mln/io/pgm/save.hh>
#include <mln/morpho/closing_volume.hh>
+#include <mln/core/var.hh>
+
+#include <mln/debug/println.hh>
using namespace mln;
using namespace mln::value;
@@ -31,6 +34,9 @@
io::pgm::load(ima, argv[1]);
unsigned lambda = atoi(argv[2]);
- io::pgm::save(morpho::closing_volume(ima, c4(), lambda),
- "out.pgm");
+ mln_VAR(out, morpho::closing_volume(ima, c4(), lambda));
+
+ debug::println(out);
+
+ io::pgm::save(out,"out.pgm");
}
Index: jardonnet/igr/src/igr.cc
--- jardonnet/igr/src/igr.cc (revision 2983)
+++ jardonnet/igr/src/igr.cc (working copy)
@@ -87,8 +87,7 @@
// Volume Closing
///////////////////
- image2d<int_u8> o_ima(mg_ima.domain());
- morpho::closing_volume(mg_ima, c4(), lambda, o_ima);
+ image2d<int_u8> o_ima = morpho::closing_volume(mg_ima, c4(), lambda);
io::pgm::save(o_ima, "o_ima.ppm");