27 #ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_H_SINGLE_HH
28 # define SCRIBO_PRIMITIVE_EXTRACT_LINES_H_SINGLE_HH
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/concept/neighborhood.hh>
37 # include <scribo/core/component_set.hh>
38 # include <scribo/primitive/extract/components.hh>
72 template <
typename I,
typename N,
typename V>
73 component_set<mln_ch_value(I,V)>
76 unsigned min_line_length,
99 unsigned min_line_length,
103 # ifndef MLN_INCLUDE_ONLY
108 template <
typename L>
109 struct is_line_h_single
114 is_line_h_single(
const component_set<L>&
components,
115 float w_h_ratio,
unsigned min_line_length)
116 : w_h_ratio_(w_h_ratio), min_line_length_(min_line_length),
117 components_(components)
122 bool operator()(
const mln_value(L)& label)
const
124 const mln_domain(L)&
box = components_(label).
bbox();
130 return ((width / (
float)height) > w_h_ratio_
131 && width > min_line_length_);
135 unsigned min_line_length_;
137 component_set<L> components_;
146 template <
typename I,
typename N,
typename V>
147 component_set<mln_ch_value(I,V)>
150 unsigned min_line_length,
153 mln_trace(
"scribo::primitive::lines_h_single");
155 const I& input =
exact(input_);
157 mln_precondition(input.is_valid());
158 mln_precondition(nbh.is_valid());
163 output = primitive::extract::
components(input, nbh, ncomps);
166 internal::is_line_h_single<L>
167 is_line(output, w_h_ratio, min_line_length);
169 output.update_tags(is_line, component::Ignored);
177 template <typename L>
180 unsigned min_line_length,
183 mln_trace(
"scribo::primitive::lines_h_single");
185 mln_precondition(components.is_valid());
187 internal::is_line_h_single<L>
188 is_line(components, w_h_ratio, min_line_length);
190 component_set<L> output = components.duplicate();
197 # endif // ! MLN_INCLUDE_ONLY
206 #endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_H_SINGLE_HH