Zip (View)
Include <mln/core/image/view/zip.hpp>
ima… |
zip(ima…) |
||
---|---|---|---|
Category |
Forward |
X |
X |
Bidirectional |
X |
X |
|
Raw |
X |
||
Properties |
Writable |
X |
X |
Accessible |
X |
X |
|
Indexable |
X |
X |
Examples
Traversing both input and output image at the same time:
mln::image2d<uint8_t> input = { {0, 1, 2}, {3, 4, 5} };
mln::image2d<uint8_t> output{input.domain()};
mln::fill(output, 0);
auto zipped_ima = mln::view::zip(input, output);
for (auto&& [v_in, v_out] : zipped_ima.values())
v_out = v_in * v_in;
auto vals = zipped_ima.values();
for (auto r : mln::ranges::rows(vals))
{
for (auto&& [_, v_out] : r)
std::cout << v_out << " ";
std::cout << std::endl;
}
Outputs:
0 1 4
9 16 25