27 #ifndef MLN_MORPHO_EROSION_HH
28 # define MLN_MORPHO_EROSION_HH
36 # include <mln/morpho/general.hh>
37 # include <mln/morpho/includes.hh>
38 # include <mln/accu/logic/land.hh>
39 # include <mln/accu/logic/land_basic.hh>
40 # include <mln/accu/stat/min.hh>
41 # include <mln/accu/stat/min_h.hh>
51 template <
typename I,
typename W>
53 erosion(const Image<I>& input, const Window<W>& win);
56 # ifndef MLN_INCLUDE_ONLY
62 mln_morpho_select_accu(I, logic::land_basic, stat::min)
63 accu(const Image<I>&)
const
65 mln_morpho_select_accu(I, logic::land_basic, stat::min) tmp;
70 mln_morpho_select_accu(I, logic::land, stat::min_h)
71 accu_incr(const Image<I>&)
const
73 mln_morpho_select_accu(I, logic::land, stat::min_h) tmp;
78 mln_value(I) neutral(const Image<I>&)
const
80 return internal::neutral<I>::supremum();
92 template <
typename I,
typename W>
94 general_on_set_centered(const erosion_op&,
95 const Image<I>& input_, const Window<W>& win_)
97 trace::entering(
"morpho::impl::general_on_set_centered__erosion");
99 typedef mln_concrete(I) O;
100 const I& input = exact(input_);
101 const W& win = exact(win_);
103 extension::adjust_fill(input, win, true);
108 mln_piter(I) p(input.domain());
109 mln_qiter(W) q(win, p);
111 if (input(p) == true)
112 for_all(q) if (input.has(q))
113 if (input(q) == false)
119 trace::exiting(
"morpho::impl::general_on_set_centered__erosion");
124 template <
typename I,
typename W>
126 general_on_set_centered_fastest(const erosion_op&,
127 const Image<I>& input_, const Window<W>& win_)
129 trace::entering(
"morpho::impl::general_on_set_centered_fastest__erosion");
131 typedef mln_concrete(I) O;
132 const I& input = exact(input_);
133 const W& win = exact(win_);
135 extension::adjust_fill(input, win, true);
140 mln_pixter(const I) p(input);
141 mln_qixter(const I, W) q(p, win);
142 mln_pixter(O) p_out(output);
146 if (q.val() == false)
152 trace::exiting(
"morpho::impl::general_on_set_centered_fastest__erosion");
160 template <
typename I,
typename W>
165 trace::entering(
"morpho::erosion");
166 mln_precondition(exact(input).is_valid());
167 mln_precondition(! exact(win).is_empty());
169 mln_concrete(I) output =
general(erosion_op(), input, win);
171 if (exact(win).is_centered())
172 mln_postcondition(output <= input);
174 trace::exiting(
"morpho::erosion");
178 # endif // ! MLN_INCLUDE_ONLY
185 #endif // ! MLN_MORPHO_EROSION_HH