
https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Fix fast level labeling. * mln/border/resize.hh: Change the behavior so that resizing is always effective. * mln/canvas/labeling.hh (labeling_fast): Initialize parent properly. * mln/labeling/level.hh (level_): Resize border in the fast version. border/resize.hh | 9 +++++---- canvas/labeling.hh | 5 +++-- labeling/level.hh | 6 ++++++ 3 files changed, 14 insertions(+), 6 deletions(-) Index: mln/border/resize.hh --- mln/border/resize.hh (revision 1406) +++ mln/border/resize.hh (working copy) @@ -99,11 +99,12 @@ mlc_is(mln_trait_image_border(I), trait::image::border::some)::check(); const I& ima = exact(ima_); mln_precondition(ima.has_data()); - if (border::get(ima) >= thickness) - return; + + if (border::get(ima) = thickness) + return; // No-op. + impl::resize_(ima, mln_trait_image_category(I)(), thickness); - mln_postcondition(border::get(ima) >= thickness); - return; + mln_postcondition(border::get(ima) = thickness); } # endif // ! MLN_INCLUDE_ONLY Index: mln/canvas/labeling.hh --- mln/canvas/labeling.hh (revision 1406) +++ mln/canvas/labeling.hh (working copy) @@ -38,6 +38,7 @@ # include <mln/level/sort_points.hh> # include <mln/convert/to_window.hh> + namespace mln { @@ -167,8 +168,7 @@ mln_ch_value(O, unsigned) parent; labeling_fast(F& f) - : f(f), - parent(f.output.domain(), f.input.border()) + : f(f) { run(); } @@ -178,6 +178,7 @@ // init { + initialize(parent, f.input); f.nlabels = 0; f.init(); } Index: mln/labeling/level.hh --- mln/labeling/level.hh (revision 1406) +++ mln/labeling/level.hh (working copy) @@ -37,6 +37,7 @@ # include <mln/core/concept/image.hh> # include <mln/labeling/base.hh> # include <mln/level/fill.hh> +# include <mln/border/resize.hh> @@ -137,7 +138,12 @@ trait::image::speed::fastest, O& output, unsigned& nlabels) { typedef level_fast_t<I,N,O> F; + + border::resize(input, exact(nbh).delta()); + border::resize(output, exact(nbh).delta()); + F f(input, val, exact(nbh), output); + canvas::labeling_fast<F> run(f); nlabels = f.nlabels; return f.status;