Milena (Olena)
User documentation 2.0a Id
|
00001 #include <mln/core/image/image2d.hh> 00002 #include <mln/core/alias/box2d.hh> 00003 #include <mln/opt/at.hh> 00004 #include <mln/value/int_u8.hh> 00005 00006 int main() 00007 { 00008 using namespace mln; 00009 00010 // \{ 00011 box2d b(2,3); 00012 image2d<value::int_u8> ima(b); 00013 00014 // On image2d, Site <=> point2d 00015 point2d p(1, 2); 00016 00017 // Associate '9' as value for the site/point2d (1,2). 00018 // The value is returned by reference and can be changed. 00019 opt::at(ima, 1,2) = 9; 00020 std::cout << "opt::at(ima, 1,2) = " << opt::at(ima, 1,2) 00021 << std::endl; 00022 std::cout << "ima(p) = " << ima(p) << std::endl; 00023 00024 std::cout << "---" << std::endl; 00025 00026 00027 // Associate '2' as value for the site/point2d (1,2). 00028 // The value is returned by reference 00029 // and can be changed as well. 00030 ima(p) = 2; 00031 std::cout << "opt::at(ima, 1,2) = " << opt::at(ima, 1,2) 00032 << std::endl; 00033 std::cout << "ima(p) = " << ima(p) << std::endl; 00034 // \} 00035 }