29 #include <mln/core/image/image2d.hh>
30 #include <mln/labeling/colorize.hh>
31 #include <mln/debug/println.hh>
32 #include <mln/data/convert.hh>
33 #include <mln/util/array.hh>
34 #include <mln/literal/colors.hh>
35 #include <mln/io/pbm/load.hh>
36 #include <mln/io/ppm/save.hh>
37 #include <mln/core/alias/neighb2d.hh>
38 #include <mln/value/label_16.hh>
40 #include <scribo/core/object_links.hh>
42 #include <scribo/primitive/extract/components.hh>
44 #include <scribo/primitive/link/with_single_left_link.hh>
45 #include <scribo/primitive/link/with_single_right_link.hh>
46 #include <scribo/primitive/link/merge_double_link.hh>
48 #include <scribo/draw/bounding_boxes.hh>
49 #include <scribo/draw/bounding_box_links.hh>
51 #include <scribo/debug/usage.hh>
55 const char *args_desc[][2] =
57 {
"input.pbm",
"A binary image. 'True' for objects, 'False'\
58 for the background." },
59 {
"hlmax",
"Maximum distance between two grouped objects while browsing on the left." },
60 {
"hrmax",
"Maximum distance between two grouped objects while browsing on the right." },
64 int main(
int argc,
char *argv[])
66 using namespace scribo;
71 "Display double validated (left and right) links between objects",
72 "<input.pbm> <hlmax> <hrmax> <output.ppm>",
79 value::label_16 nbboxes;
101 literal::green, anchor::MassCenter);
103 util::array<bool> drawn(
unsigned(comps.nelements()) + 1, 0);
104 for_all_comps(i, comps)
105 if (links(i) == i && ! drawn(i))
115 drawn[links(i)] =
true;