27 #ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_V_SINGLE_HH
28 # define SCRIBO_PRIMITIVE_EXTRACT_LINES_V_SINGLE_HH
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/concept/neighborhood.hh>
36 # include <mln/win/hline2d.hh>
38 # include <scribo/core/component_set.hh>
39 # include <scribo/primitive/extract/components.hh>
71 template <
typename I,
typename N,
typename V>
72 component_set<mln_ch_value(I,V)>
75 unsigned min_line_length,
98 unsigned min_line_length,
102 # ifndef MLN_INCLUDE_ONLY
107 template <
typename L>
108 struct is_line_v_single
113 is_line_v_single(
const component_set<L>&
components,
114 float h_w_ratio,
unsigned min_line_length)
115 : h_w_ratio_(h_w_ratio), min_line_length_(min_line_length),
116 components_(components)
121 bool operator()(
const mln_value(L)& label)
const
123 const mln_domain(L)&
box = components_(label).
bbox();
128 return ((height / (
float)width) > h_w_ratio_
129 && height > min_line_length_);
133 unsigned min_line_length_;
135 component_set<L> components_;
143 template <
typename I,
typename N,
typename V>
144 component_set<mln_ch_value(I,V)>
147 unsigned min_line_length,
150 mln_trace(
"scribo::primitive::lines_v_single");
152 const I& input =
exact(input_);
154 mln_precondition(input.is_valid());
155 mln_precondition(nbh.is_valid());
160 output = primitive::extract::
components(input, nbh, ncomps);
163 internal::is_line_v_single<L>
164 is_line(output, h_w_ratio, min_line_length);
166 output.update_tags(is_line, component::Ignored);
173 template <typename L>
176 unsigned min_line_length,
179 mln_trace(
"scribo::primitive::lines_v_single");
181 mln_precondition(components.is_valid());
183 internal::is_line_v_single<L>
184 is_line(components, h_w_ratio, min_line_length);
186 component_set<L> output = components.duplicate();
193 # endif // ! MLN_INCLUDE_ONLY
202 #endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_V_SINGLE_HH