29 #include <oln/core/2d/image2d.hh>
30 #include <oln/core/2d/neighb2d.hh>
32 #include <oln/core/gen/such_as.hh>
33 #include <oln/core/gen/torus_image.hh>
34 #include <oln/core/gen/pw_value.hh>
35 #include <oln/core/gen/fun_ops.hh>
37 #include <oln/data/fill.hh>
38 #include <oln/debug/fill.hh>
39 #include <oln/debug/println.hh>
49 template <
typename I>
void algo(
const I& img);
53 bool chessboard(oln::point2d p)
55 return (p.row() + p.col()) % 2;
73 bool vals[] = { 1, 0, 0,
78 debug::fill(img, vals);
79 std::cout <<
"img = " << std::endl;
87 box2d::piter p(ima.points());
92 std::cout << "ima = " << std::endl;
138 image2d<int> test(ima.points());
139 data::fill(test, ima);
140 (test +
c4).
at(1, 1) = 9;
141 debug::println(test);
157 algo((ima | chessboard) +
c8);
175 algo((ima | img) +
c8);
203 algo(torus(ima) +
c8);
225 algo(torus(ima | chessboard) +
c8);
226 algo(torus(ima | img) +
c8);
260 algo((ima | (pw_value(ima) < 4)) + c4);
309 template <
typename I>
310 void algo(
const I& img)
312 std::cout <<
"---input:" << std::endl;
313 oln::debug::print(img);
314 std::cout <<
"---output:" << std::endl;
316 oln_piter(I) p(img.points());
317 oln_niter(I) n(img, p);
321 std::cout << oln::debug::format(img(p))
325 << oln::debug::format(img(n));
326 std::cout << std::endl;
329 std::cout << std::endl;