$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
linked_bboxes_image.hh
1 // Copyright (C) 2009, 2010, 2011 EPITA Research and Development
2 // Laboratory (LRDE)
3 //
4 // This file is part of Olena.
5 //
6 // Olena is free software: you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free
8 // Software Foundation, version 2 of the License.
9 //
10 // Olena is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // As a special exception, you may use this file as part of a free
19 // software project without restriction. Specifically, if other files
20 // instantiate templates or use macros or inline functions from this
21 // file, or you compile this file and link it with other files to produce
22 // an executable, this file does not by itself cause the resulting
23 // executable to be covered by the GNU General Public License. This
24 // exception does not however invalidate any other reasons why the
25 // executable file might be covered by the GNU General Public License.
26 
27 #ifndef SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
28 # define SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
29 
33 
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/concept/graph.hh>
36 # include <mln/labeling/compute.hh>
37 # include <mln/accu/center.hh>
38 # include <mln/data/convert.hh>
39 # include <mln/value/rgb8.hh>
40 # include <mln/util/array.hh>
41 # include <mln/io/ppm/save.hh>
42 # include <mln/literal/colors.hh>
43 
44 # include <scribo/core/object_links.hh>
45 # include <scribo/core/component_set.hh>
46 # include <scribo/draw/bounding_boxes.hh>
47 # include <scribo/draw/bounding_box_links.hh>
48 
49 
50 namespace scribo
51 {
52 
53  namespace debug
54  {
55 
56  using namespace mln;
57 
58 
68  //
69  template <typename I, typename L>
70  mln_ch_value(I,value::rgb8)
71  linked_bboxes_image(const Image<I>& input,
72  const object_links<L>& array,
73  const value::rgb8& box_value,
74  const value::rgb8& link_value,
75  anchor::Type anchor);
76 
81  //
82  template <typename I, typename L>
83  mln_ch_value(I,value::rgb8)
84  linked_bboxes_image(const Image<I>& input,
85  const object_links<L>& array,
86  const value::rgb8& box_value,
87  const value::rgb8& link_value);
88 
99  //
100  template <typename I, typename L>
101  mln_ch_value(I,value::rgb8)
102  linked_bboxes_image(const Image<I>& input,
103  const object_links<L>& left_link,
104  const object_links<L>& right_link,
105  const value::rgb8& box_value,
106  const value::rgb8& link_value,
107  anchor::Type anchor);
108 
122  //
123  template <typename I, typename L>
124  inline
125  mln_ch_value(I,value::rgb8)
126  linked_bboxes_image(const Image<I>& input,
127  const object_links<L>& left_link,
128  const object_links<L>& right_link,
129  const value::rgb8& box_value,
130  const value::rgb8& left_link_value,
131  const value::rgb8& right_link_value,
132  const value::rgb8& validated_link_value,
133  anchor::Type anchor);
134 
135 
145  //
146  template <typename I, typename L, typename G>
147  mln_ch_value(I,value::rgb8)
148  linked_bboxes_image(const Image<I>& input,
149  const Graph<G>& g,
150  const value::rgb8& box_value,
151  const value::rgb8& link_value,
152  anchor::Type anchor);
153 
154 
155 # ifndef MLN_INCLUDE_ONLY
156 
157 
158  template <typename I, typename L>
159  inline
160  mln_ch_value(I,value::rgb8)
161  linked_bboxes_image(const Image<I>& input,
162  const object_links<L>& links,
163  const value::rgb8& box_value,
164  const value::rgb8& link_value,
165  anchor::Type anchor)
166  {
167  mln_trace("scribo::debug::linked_bboxes_image");
168  mln_precondition(exact(input).is_valid());
169 
170  mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
171 
172  draw::bounding_boxes(tmp, links.components(), box_value);
173  draw::bounding_box_links(tmp, links, link_value, anchor);
174 
175  return tmp;
176  }
177 
178 
179  template <typename I, typename L>
180  inline
181  mln_ch_value(I,value::rgb8)
182  linked_bboxes_image(const Image<I>& input,
183  const object_links<L>& links,
184  const value::rgb8& box_value,
185  const value::rgb8& link_value)
186  {
187  return linked_bboxes_image(input, links, box_value,
188  link_value, anchor::Center);
189  }
190 
191 
192 
193  template <typename I, typename L>
194  inline
195  mln_ch_value(I,value::rgb8)
196  linked_bboxes_image(const Image<I>& input,
197  const object_links<L>& left_link,
198  const object_links<L>& right_link,
199  const value::rgb8& box_value,
200  const value::rgb8& value)
201  {
202  return linked_bboxes_image(input,
203  left_link,
204  right_link,
205  box_value,
206  literal::yellow,
207  literal::cyan,
208  value,
209  anchor::Center);
210  }
211 
212 
213  template <typename I, typename L>
214  inline
215  mln_ch_value(I,value::rgb8)
216  linked_bboxes_image(const Image<I>& input,
217  const object_links<L>& left_link,
218  const object_links<L>& right_link,
219  const value::rgb8& box_value,
220  const value::rgb8& left_link_value,
221  const value::rgb8& right_link_value,
222  const value::rgb8& validated_link_value,
223  anchor::Type anchor)
224  {
225  mln_trace("scribo::debug::linked_bboxes_image");
226  mln_precondition(exact(input).is_valid());
227 
228  mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
229 
230  draw::bounding_boxes(tmp, left_link.components(), box_value);
231  draw::bounding_box_links(tmp,
232  left_link, right_link,
233  left_link_value, right_link_value,
234  validated_link_value,
235  anchor);
236 
237  return tmp;
238  }
239 
240 
241 
242  template <typename I, typename L, typename G>
243  inline
244  mln_ch_value(I,value::rgb8)
245  linked_bboxes_image(const Image<I>& input,
246  const Graph<G>& g,
247  const value::rgb8& box_value,
248  const value::rgb8& link_value,
249  anchor::Type anchor)
250  {
251  mln_trace("scribo::debug::linked_bboxes_image");
252  mln_precondition(exact(g).is_valid());
253  mln_precondition(exact(input).is_valid());
254 
255  mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
256 
257  draw::bounding_boxes(tmp, exact(g).components(), box_value);
258  draw::bounding_box_links(tmp, exact(g).components(), g, link_value,
259  anchor);
260 
261  return tmp;
262  }
263 
264 
265 # endif // ! MLN_INCLUDE_ONLY
266 
267  } // end of namespace scribo::debug
268 
269 } // end of namespace scribo
270 
271 
272 #endif // ! SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH