DGtal  1.2.0
exampleLMST3D.cpp
Go to the documentation of this file.
1 
42 #include <iostream>
43 #include <iterator>
44 #include <vector>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/BasicTypes.h"
47 #include "DGtal/helpers/StdDefs.h"
48 
50 #include "DGtal/geometry/curves/Naive3DDSSComputer.h"
51 #include "DGtal/geometry/curves/SaturatedSegmentation.h"
52 #include "DGtal/geometry/curves/estimation/LambdaMST3D.h"
55 
56 
57 using namespace std;
58 using namespace DGtal;
59 using namespace Z3i;
60 using namespace DGtal::functors;
61 
63 
64 int main()
65 {
67  typedef vector < Point > Container;
68  typedef Container::const_iterator ConstIterator;
73 
74  // Input points
75  Container contour;
76  contour.push_back(Point(18,25,18));
77  contour.push_back(Point(17,25,19));
78  contour.push_back(Point(16,25,20));
79  contour.push_back(Point(15,25,21));
80  contour.push_back(Point(14,25,22));
81  contour.push_back(Point(13,25,23));
82  contour.push_back(Point(12,25,24));
83  contour.push_back(Point(11,25,25));
84  contour.push_back(Point(10,25,26));
85  contour.push_back(Point(9,25,27));
86  contour.push_back(Point(8,25,28));
87 
89  // Initialization of tangential cover
90  Segmentation segmenter ( contour.begin(), contour.end(), SegmentComputer() );
91  lmst.attach ( segmenter );
93 
95  lmst.getDSSFilter ( ).init ( 7 );
97 
99  for ( ConstIterator it = contour.begin(); it != contour.end(); ++it )
100  lmst.eval ( *it );
102 
104  lmst.init ( contour.begin(), contour.end() );
105  std::vector < RealVector > tangent;
106  lmst.eval < std::back_insert_iterator< std::vector < RealVector > > > ( contour.begin(), contour.end(), std::back_insert_iterator< vector < RealVector > > ( tangent ) );
108 
109  return 0;
110 }
111 // //
void attach(Alias< TSegmentation > segmentComputer)
RealVector eval(const Point &p)
void init(ConstIterator itb, ConstIterator ite)
Aim: Simplify creation of Lambda MST tangent estimator.
Definition: LambdaMST3D.h:212
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
int main()
MyDigitalSurface::ConstIterator ConstIterator
functors namespace gathers all DGtal functors.
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