DGtal  0.9.2
exampleLMST2D.cpp
1 
30 #include <iostream>
32 #include <iterator>
33 #include <vector>
34 #include "DGtal/base/Common.h"
35 #include "DGtal/base/BasicTypes.h"
36 #include "DGtal/helpers/StdDefs.h"
37 
39 #include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
40 #include "DGtal/geometry/curves/SaturatedSegmentation.h"
41 #include "DGtal/geometry/curves/estimation/LambdaMST2D.h"
44 
45 
46 using namespace std;
47 using namespace DGtal;
48 using namespace Z2i;
49 
51 
52 int main()
53 {
55  typedef vector < Point > Container;
56  typedef Container::const_iterator ConstIterator;
58  typedef SaturatedSegmentation<SegmentComputer> Segmentation;
61 
62  // Input points
63  Container contour;
64  contour.push_back(Point(18,18));
65  contour.push_back(Point(17,19));
66  contour.push_back(Point(16,20));
67  contour.push_back(Point(15,21));
68  contour.push_back(Point(14,22));
69  contour.push_back(Point(13,23));
70  contour.push_back(Point(12,24));
71  contour.push_back(Point(11,25));
72  contour.push_back(Point(10,26));
73  contour.push_back(Point(9,27));
74  contour.push_back(Point(8,28));
75 
77  // Initialization of tangential cover
78  Segmentation segmenter ( contour.begin(), contour.end(), SegmentComputer() );
79  lmst.attach ( segmenter );
81 
83  for ( ConstIterator it = contour.begin(); it != contour.end(); ++it )
84  lmst.eval ( it );
86 
88  lmst.init ( contour.begin(), contour.end() );
89  std::vector < RealVector > tangent;
90  lmst.eval < back_insert_iterator< vector < RealVector > > > ( contour.begin(), contour.end(), back_inserter ( tangent ) );
92 
93  return 1;
94 }
95 // //
STL namespace.
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Aim: Simplify creation of Lambda MST tangent estimator.
Definition: LambdaMST2D.h:168
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...