45 #include "ConfigExamples.h"
46 #include "DGtal/helpers/StdDefs.h"
47 #include "DGtal/base/Common.h"
49 #include "DGtal/geometry/curves/AlphaThickSegmentComputer.h"
50 #include "DGtal/geometry/curves/SaturatedSegmentation.h"
51 #include "DGtal/base/Circulator.h"
54 #include "DGtal/geometry/curves/SegmentComputerUtils.h"
58 #include "DGtal/io/boards/Board2D.h"
63 using namespace DGtal;
69 trace.
beginBlock (
"Example of AlphaThickSegment tangential cover obtained from SaturatedSegmentation" );
72 typedef std::vector<Z2i::RealPoint>::const_iterator RAConstIterator;
80 std::string file = examplesPath +
"samples/contourSnoisy.sdp";
84 aBoard <<
SetMode(aContour[0].className(),
"Grid");
85 aBoard2 <<
SetMode(aContour[0].className(),
"Grid");
86 std::vector<LibBoard::Point> poly;
87 for (
unsigned int i = 0; i< aContour.size(); i++) poly.push_back(
LibBoard::Point(aContour[i][0], aContour[i][1]));
98 AlphaThickSegmentComputer2D computer(4, functions::Hull2D::EuclideanThickness);
99 AlphaSegmentation segmentator(circulator, circulator, computer);
103 AlphaSegmentation::SegmentComputerIterator i = segmentator.begin();
104 AlphaSegmentation::SegmentComputerIterator end = segmentator.end();
106 for ( ; i != end; ++i) {
107 AlphaThickSegmentComputer2D current(*i);
108 aBoard <<
SetMode(current.className(),
"BoundingBox");
112 aBoard.
saveEPS(
"exampleAlphaThickSegmentTgtCover.eps");
115 trace.
beginBlock (
"Example of AlphaThickSegment tangential cover obtained for a single point" );
120 unsigned int index = 80;
122 AlphaThickSegmentComputer2D first (computer);
124 AlphaThickSegmentComputer2D last (computer);
128 aBoard2.
fillCircle((*(circulator+index))[0], (*(circulator+index))[1], 1.0);
130 while(first.end() != last.end()){
131 aBoard2 <<
SetMode(first.className(),
"BoundingBox");
139 name <<
"exampleAlphaThickSegmentTgtCoverPoint" << index<<
".eps";
140 aBoard2.
saveEPS(name.str().c_str());
Aim: This class is devoted to the recognition of alpha thick segments as described in ....
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structu...
Structure representing an RGB triple with alpha component.
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
void beginBlock(const std::string &keyword="")
Board & setPenColor(const DGtal::Color &color)
void fillCircle(double x, double y, double radius, int depthValue=-1)
void fillPolyline(const std::vector< Point > &points, 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.
void lastMaximalSegment(SC &s, const typename SC::ConstIterator &i, const typename SC::ConstIterator &begin, const typename SC::ConstIterator &end, DGtal::ForwardSegmentComputer)
void nextMaximalSegment(SC &s, const typename SC::ConstIterator &end, DGtal::ForwardSegmentComputer)
void firstMaximalSegment(SC &s, const typename SC::ConstIterator &i, const typename SC::ConstIterator &begin, const typename SC::ConstIterator &end, DGtal::ForwardSegmentComputer)
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....
Struct representing a 2D point.