DGtal  1.4.beta
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 
56 using namespace std;
57 using namespace DGtal;
58 using namespace Z2i;
59 
61 
62 int main()
63 {
65  typedef vector < Point > Container;
66  typedef Container::const_iterator ConstIterator;
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 // //
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
RealVector eval(const Point &p)
void init(ConstIterator itb, ConstIterator ite)
void attach(Alias< TSegmentation > SegmentComputer)
Aim: Simplify creation of Lambda MST tangent estimator.
Definition: LambdaMST2D.h:170
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
int main()
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
SaturatedSegmentation< SegmentComputer > Segmentation
MyPointD Point
Definition: testClone2.cpp:383