29 #include <mln/core/image/image2d.hh>
30 #include <mln/core/alias/neighb2d.hh>
32 #include <mln/data/convert.hh>
34 #include <mln/util/couple.hh>
36 #include <mln/value/rgb8.hh>
37 #include <mln/value/label_16.hh>
38 #include <mln/literal/colors.hh>
40 #include <mln/io/pbm/load.hh>
41 #include <mln/io/ppm/save.hh>
43 #include <mln/draw/line.hh>
45 #include <scribo/primitive/extract/components.hh>
46 #include <scribo/primitive/link/internal/link_several_dmax_base.hh>
47 #include <scribo/primitive/link/internal/compute_anchor.hh>
48 #include <scribo/primitive/link/compute_several.hh>
50 #include <scribo/draw/bounding_boxes.hh>
51 #include <scribo/debug/usage.hh>
57 template <
typename I,
typename L>
58 struct several_right_overlap_debug_functor
59 :
public primitive::link::internal::link_several_dmax_base<L, several_right_overlap_debug_functor<I, L> >
61 typedef several_right_overlap_debug_functor<I, L> self_t;
63 primitive::link::internal::link_several_dmax_base<L, self_t> super_;
66 typedef mln_site(L) P;
68 several_right_overlap_debug_functor(const I& input,
69 const component_set<L>& comps,
73 this->anchors_.
append(anchor::Top);
74 this->anchors_.
append(anchor::Bottom);
75 this->anchors_.
append(anchor::Center);
79 mln_postcondition(output_.is_valid());
84 finalize_link_(
unsigned current_object)
87 c = super_::finalize_link_(current_object);
89 if (c.
first() != anchor::Invalid)
92 p = primitive::link::internal::compute_anchor(this->components_,
95 mln::draw::
line(output_, p, c.second(), literal::green);
102 start_point_(
unsigned current_object, anchor::Type anchor)
104 return primitive::link::internal::compute_anchor(this->components_,
110 void compute_next_site_(P& p)
116 image2d<value::rgb8> output_;
123 const char *args_desc[][2] =
125 {
"input.pbm",
"A binary image. True for objects and False for the background." },
126 {
"max_nbh_dist",
"The maximum lookup distance. (common value : 30)" },
131 int main(
int argc,
char* argv[])
133 using namespace scribo;
134 using namespace scribo::primitive::internal;
139 "Show sucessful/unsuccessful right links "
140 "between components.",
141 "input.pbm max_nbh_dist output.ppm",
149 value::label_16 nbboxes;
155 several_right_overlap_debug_functor<I, L> functor(input,
156 comps, atoi(argv[2]));