This example shows a simple alpha-thick segment recognition given from a noisy input contour with floating point coordinates.
#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/base/Common.h"
#include "DGtal/geometry/curves/AlphaThickSegmentComputer.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/readers/PointListReader.h"
#include "DGtal/io/boards/Board2D.h"
{
trace.
beginBlock (
"Example exampleAlphaThickSegment" );
std::string file = examplesPath + "samples/contourSnoisy.sdp";
aBoard <<
SetMode(aContour[0].className(),
"Grid");
for (unsigned int i = 0; i< aContour.size(); i++){
aBoard << aContour[i];
aBoard.
drawLine(aContour[i][0], aContour[i][1],
aContour[(i+1)%aContour.size()][0], aContour[(i+1)%aContour.size()][1]);
}
AlphaThickSegmentComputer2D anAlphaSegment(15);
std::vector<Z2i::RealPoint>::const_iterator it = aContour.begin();
while (anAlphaSegment.extendFront(*it)) {
it++;
}
aBoard << anAlphaSegment;
AlphaThickSegmentComputer2D anAlphaSegment2(9);
anAlphaSegment2.init(aContour.begin());
while (anAlphaSegment2.end() != aContour.end() &&
anAlphaSegment2.extendFront()) {
}
aBoard << anAlphaSegment2;
AlphaThickSegmentComputer2D anAlphaSegment3(2);
anAlphaSegment3.init(aContour.begin());
while (anAlphaSegment3.end() != aContour.end() &&
anAlphaSegment3.extendFront()) {
}
aBoard << anAlphaSegment3;
aBoard.
saveEPS(
"exampleAlphaThickSegmentNoisy.eps");
return 0;
}
Aim: This class is devoted to the recognition of alpha thick segments as described in FaureTangential...
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
void beginBlock(const std::string &keyword="")
void drawLine(double x1, double y1, double x2, double y2, int depthValue=-1)
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Aim: Implements method to read a set of points represented in each line of a file.
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....