26 #ifndef SCRIBO_ESTIM_COMPONENT_FEATURES_HH
27 # define SCRIBO_ESTIM_COMPONENT_FEATURES_HH
29 # include <mln/core/image/image2d.hh>
30 # include <mln/core/alias/neighb2d.hh>
31 # include <mln/topo/skeleton/crest.hh>
32 # include <mln/topo/skeleton/is_simple_point.hh>
33 # include <mln/transform/distance_front.hh>
34 # include <mln/logical/not.hh>
35 # include <mln/make/w_window2d_int.hh>
36 # include <mln/value/int_u8.hh>
37 # include <mln/arith/revert.hh>
38 # include <mln/morpho/skeleton_constrained.hh>
39 # include <mln/core/routine/extend.hh>
40 # include <mln/labeling/blobs.hh>
41 # include <mln/accu/stat/mean.hh>
42 # include <mln/make/dual_neighb.hh>
45 # include <mln/data/compute.hh>
46 # include <mln/io/pbm/save.hh>
47 # include <mln/io/pgm/save.hh>
48 # include <mln/util/timer.hh>
50 # include <scribo/core/component_set.hh>
51 # include <scribo/estim/font_color.hh>
52 # include <scribo/estim/font_boldness.hh>
54 #include <mln/data/convert.hh>
69 template <
typename I,
typename J,
typename L>
75 # ifndef MLN_INCLUDE_ONLY
78 template <
typename I,
typename J,
typename L>
83 mln_trace(
"scribo::estim::components_features");
85 const I& input =
exact(input_);
86 const J& bin_input =
exact(bin_input_);
88 mln_precondition(input.is_valid());
89 mln_precondition(bin_input.is_valid());
91 component_set<L> output = components.duplicate();
93 component_features_data features;
94 features.valid =
true;
103 int vals[] = { 0, 9, 0, 9, 0,
113 mln_max(
value::int_u8));
114 dist_t dist_map = arith::revert(dist);
115 B K = topo::skeleton::crest(bin_input, dist, c8(), psi);
120 nbh_t nbh = mln::make::dual_neighb(bin_input, c8(),
c4());
124 topo::skeleton::is_simple_point<nbh_t>(nbh),
131 for_all_comps(c, output)
135 ((input | output(c).
bbox())
141 features.boldness = internal::boldness_from_lbl(
145 output(c).update_features(features);
152 # endif // ! MLN_INCLUDE_ONLY
158 # endif // ! SCRIBO_ESTIM_COMPONENT_FEATURES_HH