Commit 58cdb6cb authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

mln/labeling/fill_holes.hh: Improve speed.

parent 011b365f
2011-03-01 Guillaume Lazzara <z@lrde.epita.fr>
* mln/labeling/fill_holes.hh: Improve speed.
2011-03-01 Guillaume Lazzara <z@lrde.epita.fr>
 
* mln/fun/v2v/rgb_to_luma.hh: New function for grayscale
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -33,6 +34,8 @@
# include <mln/labeling/background.hh>
# include <mln/labeling/compute.hh>
# include <mln/data/transform.hh>
# include <mln/core/image/dmorph/image_if.hh>
# include <mln/accu/math/count.hh>
......@@ -57,7 +60,7 @@ namespace mln
/// \see mln::labeling::background
///
template <typename I, typename N, typename L>
I
mln_concrete(I)
fill_holes(const Image<I>& input, const Neighborhood<N>& nbh,
L& nlabels);
......@@ -66,7 +69,7 @@ namespace mln
template <typename I, typename N, typename L>
inline
I
mln_concrete(I)
fill_holes(const Image<I>& input, const Neighborhood<N>& nbh,
L& nlabels)
{
......@@ -77,10 +80,6 @@ namespace mln
mln_precondition(exact(input).is_valid());
mln_precondition(exact(nbh).is_valid());
mln_ch_value(I, bool) output;
initialize(output, input);
data::fill(output, false);
mln_ch_value(I, L) lbls = labeling::background(input, nbh, nlabels);
accu::math::count<mln_value(I)> a_;
......@@ -99,7 +98,9 @@ namespace mln
}
}
data::fill((output | (pw::value(lbls) != bg_lbl)).rw(), true);
util::array<bool> bg_relbl(arr.nelements(), true);
bg_relbl(bg_lbl) = false;
mln_ch_value(I, bool) output = data::transform(lbls, bg_relbl);
trace::exiting("labeling::fill_holes");
return output;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment