This example shows the basic usage of the Lambda maximal segment tangent estimation in 2D.
#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 Z2i;
{
typedef vector < Point > Container;
LambdaMST2D < Segmentation > lmst;
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));
for (
ConstIterator it = contour.begin(); it != contour.end(); ++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;
}
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...
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