26 #ifndef MLN_MORPHO_ELEMENTARY_TOP_HAT_HH
27 # define MLN_MORPHO_ELEMENTARY_TOP_HAT_HH
35 # include <mln/morpho/elementary/opening.hh>
36 # include <mln/morpho/elementary/closing.hh>
37 # include <mln/morpho/minus.hh>
53 template <
typename I,
typename N>
62 template <typename I, typename N>
64 top_hat_black(const Image<I>& input, const Neighborhood<N>& nbh);
74 template <typename I, typename N>
79 # ifndef MLN_INCLUDE_ONLY
82 template <
typename I,
typename N>
85 top_hat_white(const Image<I>& input, const Neighborhood<N>& nbh)
87 mln_trace(
"morpho::elementary::top_hat_white");
89 mln_precondition(
exact(input).is_valid());
90 mln_precondition(
exact(nbh).is_valid());
92 mln_concrete(I) output = morpho::
minus(input,
93 elementary::
opening(input, nbh));
95 mln_postcondition(
test::positive(output));
101 template <typename I, typename N>
104 top_hat_black(const Image<I>& input, const Neighborhood<N>& nbh)
106 mln_trace(
"morpho::elementary::top_hat_black");
108 mln_precondition(
exact(input).is_valid());
109 mln_precondition(
exact(nbh).is_valid());
111 mln_concrete(I) output = morpho::
minus(elementary::
closing(input, nbh),
114 mln_postcondition(
test::positive(output));
120 template <typename I, typename N>
125 mln_trace(
"morpho::elementary::top_hat_self_complementary");
126 mln_precondition(
exact(input).is_valid());
127 mln_precondition(
exact(nbh).is_valid());
129 mln_concrete(I) output = morpho::
minus(elementary::
closing(input, nbh),
130 elementary::
opening(input, nbh));
132 mln_postcondition(
test::positive(output));
139 # endif // ! MLN_INCLUDE_ONLY
148 #endif // ! MLN_MORPHO_ELEMENTARY_TOP_HAT_HH