DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
exampleAlphaThickSegmentNoisy.cpp
Go to the documentation of this file.
1
16
29
30
39
40
41
43
#include <iostream>
44
#include "ConfigExamples.h"
45
#include "DGtal/base/Common.h"
47
#include "DGtal/geometry/curves/AlphaThickSegmentComputer.h"
48
#include "DGtal/helpers/StdDefs.h"
49
#include "DGtal/io/readers/PointListReader.h"
51
#include "DGtal/io/boards/Board2D.h"
53
54
using namespace
std
;
55
using namespace
DGtal
;
56
58
59
int
main
( )
60
{
61
trace
.
beginBlock
(
"Example exampleAlphaThickSegment"
);
62
64
typedef
AlphaThickSegmentComputer< Z2i::RealPoint >
AlphaThickSegmentComputer2D;
66
67
Board2D
aBoard;
68
std::string file = examplesPath +
"samples/contourSnoisy.sdp"
;
70
std::vector<Z2i::RealPoint> aContour =
PointListReader<Z2i::RealPoint>::getPointsFromFile
(file);
72
73
// displaying contour
74
aBoard <<
SetMode
(aContour[0].className(),
"Grid"
);
75
for
(
unsigned
int
i = 0; i< aContour.size(); i++){
76
aBoard << aContour[i];
77
aBoard.
drawLine
(aContour[i][0], aContour[i][1],
78
aContour[(i+1)%aContour.size()][0], aContour[(i+1)%aContour.size()][1]);
79
}
80
81
82
//initialisation of an AlphaThickSegmentComputer2D of thickness 10 and forward recognition.
85
AlphaThickSegmentComputer2D anAlphaSegment(15);
88
std::vector<Z2i::RealPoint>::const_iterator it = aContour.begin();
89
while
(anAlphaSegment.extendFront(*it)) {
90
it++;
91
}
94
96
aBoard << anAlphaSegment;
98
AlphaThickSegmentComputer2D anAlphaSegment2(9);
100
anAlphaSegment2.init(aContour.begin());
101
while
(anAlphaSegment2.end() != aContour.end() &&
102
anAlphaSegment2.extendFront()) {
103
}
105
107
aBoard <<
CustomStyle
( anAlphaSegment2.className(),
new
CustomColors
(
DGtal::Color::Blue
,
DGtal::Color::None
) );
108
aBoard << anAlphaSegment2;
110
111
AlphaThickSegmentComputer2D anAlphaSegment3(2);
112
anAlphaSegment3.init(aContour.begin());
113
while
(anAlphaSegment3.end() != aContour.end() &&
114
anAlphaSegment3.extendFront()) {
115
}
116
aBoard <<
CustomStyle
( anAlphaSegment3.className(),
new
CustomColors
(
DGtal::Color::Green
,
DGtal::Color::None
) );
117
aBoard << anAlphaSegment3;
118
119
120
aBoard.
saveEPS
(
"exampleAlphaThickSegmentNoisy.eps"
);
121
122
trace
.
endBlock
();
123
return
0;
124
}
125
// //
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::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::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::endBlock
double endBlock()
LibBoard::Board::drawLine
void drawLine(double x1, double y1, double x2, double y2, int depthValue=-1)
Definition
Board.cpp:367
LibBoard::Board::saveEPS
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition
Board.cpp:804
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
DGtal::PointListReader::getPointsFromFile
static std::vector< TPoint > getPointsFromFile(const std::string &filename, std::vector< unsigned int > aVectPosition=std::vector< unsigned int >())
DGtal::SetMode::SetMode
SetMode(std::string classname, std::string mode)
Definition
Board2D.h:254
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
examples
geometry
curves
exampleAlphaThickSegmentNoisy.cpp
Generated on
for DGtal by
1.18.0