$extrastylesheet
Olena
User documentation 2.1
An Image Processing Platform
Scribo
Modules
Namespaces
Classes
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
show_links_top_aligned_2angles.cc
1
// Copyright (C) 2011 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
26
#include <iostream>
27
28
#include <mln/core/image/image2d.hh>
29
#include <mln/core/alias/neighb2d.hh>
30
31
#include <mln/data/convert.hh>
32
33
#include <mln/value/rgb8.hh>
34
#include <mln/value/label_16.hh>
35
#include <mln/literal/colors.hh>
36
37
#include <mln/io/pbm/load.hh>
38
#include <mln/io/ppm/save.hh>
39
40
#include <scribo/core/def/lbl_type.hh>
41
#include <scribo/debug/logger.hh>
42
#include <scribo/primitive/extract/components.hh>
43
#include <scribo/filter/object_links_aligned.hh>
44
#include <scribo/primitive/link/with_single_right_link_dmax_ratio_aligned.hh>
45
46
#include <scribo/debug/usage.hh>
47
48
49
50
const
char
*args_desc[][2] =
51
{
52
{
"input.pbm"
,
"A binary image"
},
53
{
"dmax_ratio"
,
"Maximum distance lookup (common value 5)"
},
54
{
"min_alpha"
,
"First angle used for close objects. (common value : 3)"
},
55
{
"max_alpha"
,
"Second angle used for further objects. (common value : 5)"
},
56
{0, 0}
57
};
58
59
60
int
main(
int
argc,
char
* argv[])
61
{
62
using namespace
scribo;
63
using namespace
scribo::primitive;
64
using namespace
mln;
65
66
if
(argc != 6)
67
return
scribo::debug::usage
(argv,
68
"Show valid or invalid links according the "
69
"horizontal alignment (based on top line)."
,
70
"input.pbm dmax_ratio min_angle max_angle "
71
" output.ppm"
,
72
args_desc);
73
74
image2d<bool>
input;
75
io::pbm::load
(input, argv[1]);
76
77
// Finding components.
78
typedef
scribo::def::lbl_type
V;
79
V nbboxes;
80
typedef
image2d<V>
L;
81
component_set<L>
components
82
=
extract::components
(input,
c8
(), nbboxes);
83
84
// Finding right links.
85
// object_links<L>
86
// right_links = primitive::link::with_single_right_link_dmax_ratio_aligned(
87
// components, atof(argv[2]), atof(argv[3]), atof(argv[4]));
88
89
scribo::debug::logger
().
set_level
(scribo::debug::All);
90
91
primitive::link::internal::single_right_dmax_ratio_aligned_functor<
92
L,
primitive::link::internal::dmax_default
>
93
functor(
components
,
primitive::link::internal::dmax_default
(atof(argv[2])),
94
atof(argv[3]), atof(argv[4]), anchor::StrictTopCenter);
95
96
object_links<L>
output =
primitive::link::compute
(functor, anchor::Top);
97
98
scribo::debug::logger
().
set_level
(scribo::debug::None);
99
100
io::ppm::save
(functor.debug_, argv[5]);
101
}
scribo
src
debug
show_links_top_aligned_2angles.cc
Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)