This example a simple alpha-thick segment recognition given from a freeman chain contour.
#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/geometry/curves/AlphaThickSegmentComputer.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/io/readers/PointListReader.h"
{
trace.
beginBlock (
"Example exampleAlphaThickSegment" );
std::string freemanChainFilename = examplesPath + "samples/contourS.fc";
fstream fst;
fst.open (freemanChainFilename.c_str(), ios::in);
fst.close();
aBoard << fc;
AlphaThickSegmentComputer2D anAlphaSegment(15), anAlphaSegment2(5), anAlphaSegment3(2);
anAlphaSegment.init(fc.
begin());
while (anAlphaSegment.end() != fc.
end() &&
anAlphaSegment.extendFront()) {
}
aBoard << anAlphaSegment;
AlphaThickSegmentComputer2D anAlphaSegment2Eucl(5, functions::Hull2D::EuclideanThickness);
anAlphaSegment2Eucl.init(fc.
begin());
while (anAlphaSegment2Eucl.end() != fc.
end() &&
anAlphaSegment2Eucl.extendFront()) {
}
aBoard <<
CustomStyle( anAlphaSegment2Eucl.className(),
aBoard << anAlphaSegment2Eucl;
anAlphaSegment2.init(fc.
begin());
while (anAlphaSegment2.end() != fc.
end() && anAlphaSegment2.extendFront()) {
}
aBoard << anAlphaSegment2;
FCConstIterator fcIt = fc.
begin();
while (anAlphaSegment3.extendFront(*fcIt)) {
fcIt++;
}
aBoard << anAlphaSegment3;
aBoard.
saveEPS(
"exampleAlphaThickSegment.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 <<)....
Structure representing an RGB triple with alpha component.
ConstIterator end() const
ConstIterator begin() const
void beginBlock(const std::string &keyword="")
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 ...