DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
exampleAlphaThickSegment.cpp
Go to the documentation of this file.
1
16
29
30
39
40
42
#include <iostream>
43
#include "ConfigExamples.h"
44
#include "DGtal/helpers/StdDefs.h"
45
#include "DGtal/base/Common.h"
46
#include "DGtal/geometry/curves/AlphaThickSegmentComputer.h"
47
#include "DGtal/io/boards/Board2D.h"
48
#include "DGtal/io/readers/PointListReader.h"
50
51
using namespace
std
;
52
using namespace
DGtal
;
53
55
56
int
main
( )
57
{
58
trace
.
beginBlock
(
"Example exampleAlphaThickSegment"
);
59
60
61
typedef
FreemanChain<Z2i::Space::Integer>::ConstIterator
FCConstIterator;
62
typedef
AlphaThickSegmentComputer< Z2i::Point, FCConstIterator >
AlphaThickSegmentComputer2D;
63
Board2D
aBoard;
64
65
// Reading input contour
66
std::string freemanChainFilename = examplesPath +
"samples/contourS.fc"
;
67
fstream fst;
68
fst.open (freemanChainFilename.c_str(), ios::in);
69
FreemanChain<Z2i::Space::Integer>
fc(fst);
70
fst.close();
71
aBoard << fc;
72
73
//construction of an AlphaThickSegmentComputer2D from the freemanchain iterator
74
AlphaThickSegmentComputer2D anAlphaSegment(15), anAlphaSegment2(5), anAlphaSegment3(2);
75
anAlphaSegment.init(fc.
begin
());
76
while
(anAlphaSegment.end() != fc.
end
() &&
77
anAlphaSegment.extendFront()) {
78
}
79
aBoard << anAlphaSegment;
80
// Example of thickness definition change: using the euclidean thickness definition.
82
AlphaThickSegmentComputer2D anAlphaSegment2Eucl(5,
functions::Hull2D::EuclideanThickness
);
84
85
anAlphaSegment2Eucl.init(fc.
begin
());
86
while
(anAlphaSegment2Eucl.end() != fc.
end
() &&
87
anAlphaSegment2Eucl.extendFront()) {
88
}
89
90
aBoard <<
CustomStyle
( anAlphaSegment2Eucl.className(),
91
new
CustomColors
(
DGtal::Color
(20, 250, 255),
DGtal::Color::None
) );
92
aBoard << anAlphaSegment2Eucl;
93
94
95
anAlphaSegment2.init(fc.
begin
());
96
while
(anAlphaSegment2.end() != fc.
end
() && anAlphaSegment2.extendFront()) {
97
}
98
aBoard <<
CustomStyle
( anAlphaSegment2.className(),
new
CustomColors
(
DGtal::Color::Blue
,
DGtal::Color::None
) );
99
aBoard << anAlphaSegment2;
100
101
102
103
FCConstIterator fcIt = fc.
begin
();
104
while
(anAlphaSegment3.extendFront(*fcIt)) {
105
fcIt++;
106
}
107
108
109
aBoard <<
CustomStyle
( anAlphaSegment3.className(),
new
CustomColors
(
DGtal::Color::Green
,
DGtal::Color::None
) );
110
aBoard << anAlphaSegment3;
111
112
113
114
aBoard.
saveEPS
(
"exampleAlphaThickSegment.eps"
);
115
116
trace
.
endBlock
();
117
return
0;
118
}
119
// //
DGtal::AlphaThickSegmentComputer
Aim: This class is devoted to the recognition of alpha thick segments as described in fauretangential...
Definition
AlphaThickSegmentComputer.h:128
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition
Board2D.h:71
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition
Color.h:77
DGtal::Color::None
static const Color None
Definition
Color.h:421
DGtal::Color::Blue
static const Color Blue
Definition
Color.h:428
DGtal::Color::Green
static const Color Green
Definition
Color.h:426
DGtal::FreemanChain::ConstIterator
Definition
FreemanChain.h:144
DGtal::FreemanChain
Definition
FreemanChain.h:116
DGtal::FreemanChain::end
ConstIterator end() const
DGtal::FreemanChain::begin
ConstIterator begin() const
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::endBlock
double endBlock()
LibBoard::Board::saveEPS
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition
Board.cpp:804
DGtal::functions::Hull2D::EuclideanThickness
@ EuclideanThickness
Definition
Hull2DHelpers.h:78
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
std
STL namespace.
DGtal::CustomColors
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Definition
Board2D.h:279
DGtal::CustomStyle::CustomStyle
CustomStyle(std::string classname, DrawableWithBoard2D *style)
Definition
Board2D.h:224
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
examples
geometry
curves
exampleAlphaThickSegment.cpp
Generated on
for DGtal by
1.18.0