27 #ifndef MLN_LABELING_FILL_HOLES_HH
28 # define MLN_LABELING_FILL_HOLES_HH
34 # include <mln/labeling/background.hh>
35 # include <mln/labeling/compute.hh>
37 # include <mln/data/transform.hh>
39 # include <mln/core/image/dmorph/image_if.hh>
40 # include <mln/accu/math/count.hh>
62 template <
typename I,
typename N,
typename L>
64 fill_holes(const Image<I>& input, const Neighborhood<N>& nbh,
68 # ifndef MLN_INCLUDE_ONLY
70 template <
typename I,
typename N,
typename L>
76 trace::entering(
"labeling::fill_holes");
78 mlc_equal(mln_trait_image_kind(I),
79 mln::trait::image::kind::binary)::check();
80 mln_precondition(exact(input).is_valid());
81 mln_precondition(exact(nbh).is_valid());
88 unsigned bg_count = 0;
92 for (
unsigned i = 1; i < arr.
nelements(); ++i)
94 if (arr[i] > bg_count)
102 bg_relbl(bg_lbl) =
false;
105 trace::exiting(
"labeling::fill_holes");
109 # endif // ! MLN_INCLUDE_ONLY
116 #endif // ! MLN_LABELING_FILL_HOLES_HH