26 #include <scribo/primitive/extract/lines_h_thick_and_thin.hh>
27 #include <scribo/preprocessing/rotate_90.hh>
29 #include <scribo/debug/usage.hh>
31 #include <mln/core/alias/neighb2d.hh>
32 #include <mln/labeling/compute.hh>
33 #include <mln/labeling/foreground.hh>
36 const char *args_desc[][2] =
38 {
"input.pbm",
"A binary image." },
39 {
"output.pbm",
" A binary image with thick and thin horizontal"
41 {
"length",
"The minimum length of the lines. (default : 101)" },
42 {
"delta",
"The lookhead distance between a line pixel and the background."
48 int main(
int argc,
char *argv[])
50 if (argc != 3 && argc != 4 && argc != 5)
52 "Extract thick and thin horizontal lines",
53 "input.pbm output.pbm [length] [delta]",
61 length = atoi(argv[3]);
63 delta = atoi(argv[4]);
66 using namespace scribo;
78 mln::util::array<
box2d>
81 const
box2d& b = input.domain();
82 for_all_ncomponents(e, nlabels)
83 if (
bbox(e).pmin().row() == b.pmin().row()
84 ||
bbox(e).pmax().row() == b.pmax().row()
85 ||
bbox(e).pmin().col() == b.pmin().col()
86 ||
bbox(e).pmax().col() == b.pmax().col())
87 data::
fill(((input |
bbox(e)).rw() | (pw::
value(lbl) == pw::cst(e))).rw(), false);
91 input, length,
delta);
92 I vseparators = preprocessing::rotate_90(
94 preprocessing::rotate_90(input), length, delta, 0.1, 0.80, 2), false);