DGtal 1.3.0
Loading...
Searching...
No Matches
exampleLMST2D.cpp
Go to the documentation of this file.
1
41#include <iostream>
42#include <iterator>
43#include <vector>
44#include "DGtal/base/Common.h"
45#include "DGtal/base/BasicTypes.h"
46#include "DGtal/helpers/StdDefs.h"
47
49#include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
50#include "DGtal/geometry/curves/SaturatedSegmentation.h"
51#include "DGtal/geometry/curves/estimation/LambdaMST2D.h"
54
55
56using namespace std;
57using namespace DGtal;
58using namespace Z2i;
59
61
62int main()
63{
65 typedef vector < Point > Container;
66 typedef Container::const_iterator ConstIterator;
67 typedef ArithmeticalDSSComputer < ConstIterator, int, 8 > SegmentComputer;
69 LambdaMST2D < Segmentation > lmst;
71
72 // Input points
73 Container contour;
74 contour.push_back(Point(18,18));
75 contour.push_back(Point(17,19));
76 contour.push_back(Point(16,20));
77 contour.push_back(Point(15,21));
78 contour.push_back(Point(14,22));
79 contour.push_back(Point(13,23));
80 contour.push_back(Point(12,24));
81 contour.push_back(Point(11,25));
82 contour.push_back(Point(10,26));
83 contour.push_back(Point(9,27));
84 contour.push_back(Point(8,28));
85
87 // Initialization of tangential cover
88 Segmentation segmenter ( contour.begin(), contour.end(), SegmentComputer() );
89 lmst.attach ( segmenter );
91
93 for ( ConstIterator it = contour.begin(); it != contour.end(); ++it )
94 lmst.eval ( *it );
96
98 lmst.init ( contour.begin(), contour.end() );
99 std::vector < RealVector > tangent;
100 lmst.eval < back_insert_iterator< vector < RealVector > > > ( contour.begin(), contour.end(), back_inserter ( tangent ) );
102
103 return 0;
104}
105// //
RealVector eval(const Point &p)
void init(ConstIterator itb, ConstIterator ite)
void attach(Alias< TSegmentation > SegmentComputer)
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
int main()
MyDigitalSurface::ConstIterator ConstIterator
Space::Point Point
Definition: StdDefs.h:95
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
SaturatedSegmentation< SegmentComputer > Segmentation