• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

fill-imageif-cfun.cc

00001 #include <mln/core/image/image2d.hh>
00002 #include <mln/core/image/dmorph/image_if.hh>
00003 #include <mln/core/var.hh>
00004 
00005 #include <mln/make/image.hh>
00006 
00007 #include <mln/value/rgb8.hh>
00008 #include <mln/value/label_8.hh>
00009 #include <mln/literal/colors.hh>
00010 
00011 #include <mln/data/fill.hh>
00012 
00013 #include <doc/tools/sample_utils.hh>
00014 // \{
00015 bool row_oddity(mln::point2d p)
00016 {
00017   return p.row() % 2;
00018 }
00019 // \}
00020 int main()
00021 {
00022   using namespace mln;
00023   using value::rgb8;
00024   using value::label_8;
00025 
00026 
00027   // \{
00028   bool vals[6][5] = {
00029       {0, 1, 1, 0, 0},
00030       {0, 1, 1, 0, 0},
00031       {0, 0, 0, 0, 0},
00032       {1, 1, 0, 1, 0},
00033       {1, 0, 1, 1, 1},
00034       {1, 0, 0, 0, 0}
00035   };
00036   image2d<bool> ima = make::image(vals);
00037   // \}
00038 
00039   // Create a black image from ima.
00040   // Fill sites being part of component 2 with red.
00041   // \{
00042   image2d<rgb8> ima2;
00043   initialize(ima2, ima);
00044   data::fill(ima2, literal::black);
00045 
00046   data::fill((ima2 | row_oddity).rw(), literal::red);
00047   // \}
00048 
00049   doc::ppmsave(ima2, "fill-imageif-cfun");
00050 }

Generated on Tue Oct 4 2011 15:23:46 for Milena (Olena) by  doxygen 1.7.1