Milena (Olena)
User documentation 2.0a Id
Main Page
Related Pages
Modules
Namespaces
Classes
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerator
Groups
Pages
tools/seed2tiling.cc
1
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
2
//
3
// This file is part of Olena.
4
//
5
// Olena is free software: you can redistribute it and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, version 2 of the License.
8
//
9
// Olena is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
// General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
16
//
17
// As a special exception, you may use this file as part of a free
18
// software project without restriction. Specifically, if other files
19
// instantiate templates or use macros or inline functions from this
20
// file, or you compile this file and link it with other files to produce
21
// an executable, this file does not by itself cause the resulting
22
// executable to be covered by the GNU General Public License. This
23
// exception does not however invalidate any other reasons why the
24
// executable file might be covered by the GNU General Public License.
25
29
30
31
32
# include <mln/core/image/image2d.hh>
33
# include <mln/core/image/dmorph/sub_image.hh>
34
# include <mln/core/alias/neighb2d.hh>
35
# include <mln/value/int_u8.hh>
36
# include <mln/data/stretch.hh>
37
# include <mln/border/fill.hh>
38
# include <mln/io/pbm/load.hh>
39
# include <mln/io/pgm/save.hh>
40
# include <mln/labeling/foreground.hh>
41
# include <mln/debug/println.hh>
42
# include <mln/geom/seeds2tiling.hh>
43
# include <mln/geom/seeds2tiling_roundness.hh>
44
# include <mln/make/voronoi.hh>
45
46
#include <mln/core/image/image2d.hh>
47
#include <mln/core/image/dmorph/sub_image.hh>
48
#include <mln/core/image/dmorph/image_if.hh>
49
50
51
#include <mln/core/alias/w_window2d_int.hh>
52
#include <mln/make/win_chamfer.hh>
53
54
int
main(
int
argc,
char
* argv[])
55
{
56
if
(argc < 2)
57
{
58
std::cerr <<
"missing argument: "
59
<<
"specify the location of the binary image (*.pbm)"
60
<< std::endl;
61
return
1;
62
}
63
using namespace
mln;
64
using
value::int_u8
;
65
unsigned
max
= 2048;
66
67
image2d<bool>
input =
io::pbm::load
(argv[1]);
68
69
{
70
const
w_window2d_int
& w_win = make::mk_chamfer_3x3_int<2,3>();
71
72
unsigned
n;
73
image2d<unsigned>
lab =
labeling::foreground
(input,
c4
(), n);
74
std::cout <<
"number of labels = "
<< n << std::endl;
75
76
77
image2d<unsigned>
inte =
geom::seeds2tiling
(lab,
c4
());
78
border::fill
(inte, 0);
79
80
image2d<int_u8>
inte2 =
data::stretch
(
int_u8
(), inte);
81
io::pgm::save
(inte2,
"ima1.pgm"
);
82
83
std::cout <<
"ima1 generate with seeds2tiling"
84
<< std::endl;
85
inte = geom::seeds2tiling_roundness(lab, w_win, max,
c4
());
86
border::fill
(inte, 0);
87
88
inte2 =
data::stretch
(
int_u8
(), inte);
89
90
io::pgm::save
(inte2,
"ima2.pgm"
);
91
std::cout <<
"ima2 generate with seeds2tiling_roundness"
92
<< std::endl;
93
}
94
95
}
tools
seed2tiling.cc
Generated on Thu Nov 8 2012 10:58:20 for Milena (Olena) by
1.8.2-20120930