26 #ifndef MLN_DEBUG_MOSAIC_HH
27 # define MLN_DEBUG_MOSAIC_HH
35 # include <mln/core/image/image2d.hh>
37 # include <mln/core/image/image3d.hh>
38 # include <mln/core/image/dmorph/slice_image.hh>
40 # include <mln/core/image/dmorph/p2p_image.hh>
41 # include <mln/fun/p2p/translation.hh>
43 # include <mln/data/paste.hh>
44 # include <mln/data/fill.hh>
66 mosaic(const util::array<I>& input,
67 unsigned n_horizontal,
68 const mln_value(I)& bg);
72 # ifndef MLN_INCLUDE_ONLY
78 unsigned n_horizontal,
79 const mln_value(I)& bg)
81 trace::entering(
"debug::mosaic");
83 mlc_is_a(I,
Image)::check();
84 mlc_equal(mln_domain(I),
box2d)::check();
85 mln_precondition(n_horizontal > 0);
88 unsigned max_ncols = 0, max_nrows = 0;
89 for (
unsigned i = 0; i < input.nelements(); ++i)
91 const I& ima = exact(input[i]);
92 mln_precondition(ima.is_valid());
94 if (ima.ncols() > max_ncols)
95 max_ncols = ima.ncols();
97 if (ima.nrows() > max_nrows)
98 max_nrows = ima.nrows();
102 mln_concrete(I) output(max_nrows
103 * (input.nelements() / (float)n_horizontal
105 max_ncols * n_horizontal);
108 unsigned brow = 0, bcol = 0;
109 for (
unsigned i = 0; i < input.nelements(); ++i)
111 const I& ima = exact(input[i]);
112 mln_precondition(ima.is_valid());
115 + ((max_nrows - ima.domain().height()) / 2),
117 + ((max_ncols - ima.domain().width()) / 2));
122 if (! (bcol < n_horizontal))
129 trace::exiting(
"debug::mosaic");
134 # endif // ! MLN_INCLUDE_ONLY
141 #endif // ! MLN_DEBUG_MOSAIC_HH