26 #ifndef APPS_GRAPH_MORPHO_MAKE_COMPLEX2D_HH
27 # define APPS_GRAPH_MORPHO_MAKE_COMPLEX2D_HH
32 # include <mln/core/image/image2d.hh>
33 # include <mln/world/inter_pixel/dim2/is_pixel.hh>
47 make_complex2d(const mln::Image<I>& input_)
51 const I& input =
exact(input_);
56 typedef mln_concrete(I) O;
57 O output(2 * input.
nrows() - 1, 2 * input.
ncols() - 1);
59 mln_piter(O)
p(output.domain());
63 if (p_.
row() % 2 == 0)
65 if (p_.
col() % 2 == 0)
67 output(p) = input.at_(p_.
row() / 2, p_.
col() / 2);
71 input.at_(p_.
row() / 2, (p_.
col() - 1) / 2) &&
72 input.at_(p_.
row() / 2, (p_.
col() + 1) / 2);
76 if (p_.
col() % 2 == 0)
79 input.at_((p_.
row() - 1) / 2, p_.
col() / 2) &&
80 input.at_((p_.
row() + 1) / 2, p_.
col() / 2);
85 input.at_((p_.
row() - 1) / 2, (p_.
col() - 1) / 2) &&
86 input.at_((p_.
row() - 1) / 2, (p_.
col() + 1) / 2) &&
87 input.at_((p_.
row() + 1) / 2, (p_.
col() - 1) / 2) &&
88 input.at_((p_.
row() + 1) / 2, (p_.
col() + 1) / 2);
100 template <
typename I>
103 unmake_complex2d(const mln::
Image<I>& input_)
107 const I& input =
exact(input_);
109 mln_precondition(input.nrows() % 2 == 1);
110 mln_precondition(input.ncols() % 2 == 1);
120 typedef mln_concrete(I) O;
122 O output(input.nrows() / 2 + 1, input.ncols() / 2 + 1);
124 mln_piter(J) p_in(input_pixels.domain());
125 mln_piter(O) p_out(output.domain());
126 for_all_2(p_in, p_out)
127 output(p_out) = input(p_in);
132 #endif // ! APPS_GRAPH_MORPHO_MAKE_COMPLEX2D_HH