$extrastylesheet
Olena
User documentation 2.1
An Image Processing Platform
Milena
Getting started
API Reference Manual
All Classes
Examples
Demos
Publications
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
fill-imageif-cfun.cc
1
#include <mln/core/image/image2d.hh>
2
#include <mln/core/image/dmorph/image_if.hh>
3
#include <mln/core/var.hh>
4
5
#include <mln/make/image.hh>
6
7
#include <mln/value/rgb8.hh>
8
#include <mln/value/label_8.hh>
9
#include <mln/literal/colors.hh>
10
11
#include <mln/data/fill.hh>
12
13
#include <doc/tools/sample_utils.hh>
14
// \{
15
bool
row_oddity(
mln::point2d
p)
16
{
17
return
p.
row
() % 2;
18
}
19
// \}
20
int
main()
21
{
22
using namespace
mln;
23
using
value::rgb8
;
24
using
value::label_8
;
25
26
27
// \{
28
bool
vals[6][5] = {
29
{0, 1, 1, 0, 0},
30
{0, 1, 1, 0, 0},
31
{0, 0, 0, 0, 0},
32
{1, 1, 0, 1, 0},
33
{1, 0, 1, 1, 1},
34
{1, 0, 0, 0, 0}
35
};
36
image2d<bool>
ima =
make::image
(vals);
37
// \}
38
39
// Create a black image from ima.
40
// Fill sites being part of component 2 with red.
41
// \{
42
image2d<rgb8>
ima2;
43
initialize
(ima2, ima);
44
data::fill
(ima2,
literal::black
);
45
46
data::fill
((ima2 | row_oddity).rw(),
literal::red
);
47
// \}
48
49
doc::ppmsave
(ima2,
"fill-imageif-cfun"
);
50
}
doc
examples
fill-imageif-cfun.cc
Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)