DGtal  1.1.0
geometry/curves/estimation/exampleLMST2D.cpp

This example shows the basic usage of the Lambda maximal segment tangent estimation in 2D.

Digital straight lines and segments
#include <iostream>
#include <iterator>
#include <vector>
#include "DGtal/base/Common.h"
#include "DGtal/base/BasicTypes.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
#include "DGtal/geometry/curves/SaturatedSegmentation.h"
#include "DGtal/geometry/curves/estimation/LambdaMST2D.h"
using namespace std;
using namespace DGtal;
using namespace Z2i;
int main()
{
typedef vector < Point > Container;
typedef Container::const_iterator ConstIterator;
// Input points
Container contour;
contour.push_back(Point(18,18));
contour.push_back(Point(17,19));
contour.push_back(Point(16,20));
contour.push_back(Point(15,21));
contour.push_back(Point(14,22));
contour.push_back(Point(13,23));
contour.push_back(Point(12,24));
contour.push_back(Point(11,25));
contour.push_back(Point(10,26));
contour.push_back(Point(9,27));
contour.push_back(Point(8,28));
// Initialization of tangential cover
Segmentation segmenter ( contour.begin(), contour.end(), SegmentComputer() );
lmst.attach ( segmenter );
for ( ConstIterator it = contour.begin(); it != contour.end(); ++it )
lmst.eval ( *it );
lmst.init ( contour.begin(), contour.end() );
std::vector < RealVector > tangent;
lmst.eval < back_insert_iterator< vector < RealVector > > > ( contour.begin(), contour.end(), back_inserter ( tangent ) );
return 0;
}
// //
DGtal::LambdaMST2D
Aim: Simplify creation of Lambda MST tangent estimator.
Definition: LambdaMST2D.h:170
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition: greedy-plane-segmentation-ex2.cpp:93
DGtal::ArithmeticalDSSComputer
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Definition: ArithmeticalDSSComputer.h:87
DGtal::LambdaMST2DEstimator< Z2i::Space, DSSSegmentationComputer, TangentFromDSS2DFunctor< DSSSegmentationComputer::SegmentComputer, functors::Lambda64Function > >::init
void init(ConstIterator itb, ConstIterator ite)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::LambdaMST2DEstimator< Z2i::Space, DSSSegmentationComputer, TangentFromDSS2DFunctor< DSSSegmentationComputer::SegmentComputer, functors::Lambda64Function > >::attach
void attach(Alias< DSSSegmentationComputer > SegmentComputer)
main
int main(int argc, char **argv)
Definition: testArithmeticDSS-benchmark.cpp:147
DGtal::SaturatedSegmentation
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
Definition: SaturatedSegmentation.h:154
Point
MyPointD Point
Definition: testClone2.cpp:383