Milena (Olena)
User documentation 2.0a Id
|
00001 #include <mln/core/image/image2d.hh> 00002 #include <mln/core/image/dmorph/image_if.hh> 00003 #include <mln/core/var.hh> 00004 #include <mln/core/alias/neighb2d.hh> 00005 00006 #include <mln/labeling/blobs.hh> 00007 00008 #include <mln/make/image.hh> 00009 00010 #include <mln/value/rgb8.hh> 00011 #include <mln/value/label_8.hh> 00012 #include <mln/literal/colors.hh> 00013 00014 #include <mln/pw/all.hh> 00015 00016 #include <mln/data/fill.hh> 00017 00018 int main() 00019 { 00020 using namespace mln; 00021 using value::rgb8; 00022 using value::label_8; 00023 00024 00025 // \{ 00026 bool vals[6][5] = { 00027 {0, 1, 1, 0, 0}, 00028 {0, 1, 1, 0, 0}, 00029 {0, 0, 0, 0, 0}, 00030 {1, 1, 0, 1, 0}, 00031 {1, 0, 1, 1, 1}, 00032 {1, 0, 0, 0, 0} 00033 }; 00034 image2d<bool> ima = make::image(vals); 00035 // \} 00036 00037 // Find and label the different components. 00038 // Fill the sites of component 2 with red. 00039 // \{ 00040 label_8 nlabels; 00041 image2d<label_8> lab = labeling::blobs(ima, c4(), nlabels); 00042 00043 image2d<rgb8> ima2; 00044 initialize(ima2, ima); 00045 data::fill(ima2, literal::black); 00046 00047 data::fill((ima2 | (pw::value(lab) == pw::cst(2u))).rw(), literal::red); 00048 // \} 00049 }