26 #ifndef SCRIBO_UPSAMPLING_BS2X_HH
27 # define SCRIBO_UPSAMPLING_BS2X_HH
33 # include <mln/core/concept/image.hh>
34 # include <mln/core/alias/box2d.hh>
35 # include <mln/opt/at.hh>
36 # include <mln/geom/all.hh>
53 bs2x(const
Image<I>& input);
57 # ifndef MLN_INCLUDE_ONLY
62 bs2x(const mln::
Image<I>& input_)
64 mln_trace(
"scribo::upsampling::bs2x");
66 const I& input =
exact(input_);
69 mlc_is(mln_value(I),
bool)::check();
71 mln_precondition(input.is_valid());
73 typedef mln_value(I) V;
80 mln_piter(I) p(input.domain());
81 mln_concrete(I) output(mln::make::
box2d(mrow, mcol,
82 mrow + 2 * input.
nrows() - 1,
83 mcol + 2 * input.
ncols() - 1));
87 row = mrow + 2 * (p.row() - mrow),
88 col = mcol + 2 * (p.col() - mcol);
97 V
value = opt::at(input, p.row(), p.col());
121 opt::at(output, row, col) = (w == n &&((se != nw) || !value)) ? w : value;
122 opt::at(output, row, col + 1) = (e == n &&((sw != ne) || !value)) ? e : value;
123 opt::at(output, row + 1, col) = (w == s &&((ne != sw) || !value)) ? w : value;
124 opt::at(output, row + 1, col + 1) = (e == s &&((nw != se) || !value)) ? e : value;
138 # endif // ! MLN_INCLUDE_ONLY
146 #endif // ! SCRIBO_UPSAMPLING_BS2X_HH