Milena (Olena)
User documentation 2.0a Id
Main Page
Related Pages
Modules
Namespaces
Classes
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerator
Groups
Pages
fill-subdomain-shorter.cc
1
#include <mln/core/image/image2d.hh>
2
#include <mln/core/image/dmorph/image_if.hh>
3
#include <mln/core/var.hh>
4
#include <mln/core/alias/neighb2d.hh>
5
6
#include <mln/labeling/blobs.hh>
7
8
#include <mln/make/image.hh>
9
10
#include <mln/value/rgb8.hh>
11
#include <mln/value/label_8.hh>
12
#include <mln/literal/colors.hh>
13
14
#include <mln/pw/all.hh>
15
16
#include <mln/data/fill.hh>
17
18
int
main()
19
{
20
using namespace
mln;
21
using
value::rgb8
;
22
using
value::label_8
;
23
24
25
// \{
26
bool
vals[6][5] = {
27
{0, 1, 1, 0, 0},
28
{0, 1, 1, 0, 0},
29
{0, 0, 0, 0, 0},
30
{1, 1, 0, 1, 0},
31
{1, 0, 1, 1, 1},
32
{1, 0, 0, 0, 0}
33
};
34
image2d<bool>
ima =
make::image
(vals);
35
// \}
36
37
// Find and label the different components.
38
// Fill the sites of component 2 with red.
39
// \{
40
label_8
nlabels;
41
image2d<label_8>
lab =
labeling::blobs
(ima,
c4
(), nlabels);
42
43
image2d<rgb8>
ima2;
44
initialize
(ima2, ima);
45
data::fill
(ima2,
literal::black
);
46
47
data::fill
((ima2 | (pw::value(lab) == pw::cst(2u))).rw(),
literal::red
);
48
// \}
49
}
doc
examples
fill-subdomain-shorter.cc
Generated on Thu Nov 8 2012 10:58:04 for Milena (Olena) by
1.8.2-20120930