27 #ifndef MLN_MORPHO_ATTRIBUTE_SHARPNESS_HH
28 # define MLN_MORPHO_ATTRIBUTE_SHARPNESS_HH
35 # include <mln/core/concept/accumulator.hh>
36 # include <mln/accu/internal/base.hh>
37 # include <mln/morpho/attribute/volume.hh>
38 # include <mln/morpho/attribute/height.hh>
59 struct accumulator_< morpho::attribute::sharpness<I> >
61 typedef accumulator::has_untake::no
has_untake;
63 typedef accumulator::has_stop::no
has_stop;
64 typedef accumulator::when_pix::use_v
when_pix;
92 void take(const mln_value(I)& v);
106 unsigned area() const;
123 # ifndef MLN_INCLUDE_ONLY
125 template <
typename I>
132 template <
typename I>
140 template <
typename I>
154 template <
typename I>
160 volume_.take(other.volume_);
161 height_.take(other.height_);
164 template <
typename I>
169 volume_.take_as_init_(v);
170 height_.take_as_init_(v);
173 template <
typename I>
179 if (height_.to_result() != 0)
181 d = (
double) volume_.to_result() /
182 (
double)((volume_.area() - 1) * (height_.to_result() + 1) + 1);
184 mln_postcondition(d >= 0 && d <= 1);
188 template <
typename I>
193 return volume_.area();
196 template <
typename I>
201 return volume_.to_result();
204 template <
typename I>
209 return height_.to_result();
212 template <
typename I>
217 return volume_.is_valid() && height_.is_valid();
220 # endif // ! MLN_INCLUDE_ONLY
229 #endif // ! MLN_MORPHO_ATTRIBUTE_SHARPNESS_HH