GJK_nD
 All Classes Files Functions Typedefs Friends Pages
Public Types | Public Member Functions | List of all members
Utils::GreedyDecomposition< Segment > Class Template Reference

This class implements a greedy algorithm to decompose a digital curve into segments. More...

#include <GreedyDecomposition.hpp>

Public Types

typedef Segment::Coordinates Coordinates
 The coordinates type of each pixel of the contour. More...
 
typedef Segment::Curve Curve
 The type of a contour. More...
 

Public Member Functions

 GreedyDecomposition (const Curve *curve=0)
 
void setCurve (const Curve *curve)
 
std::vector< Segment > decomposeCurve ()
 
std::vector< Segment > decomposeCurve (const Curve &curve)
 

Detailed Description

template<typename Segment>
class Utils::GreedyDecomposition< Segment >

This class implements a greedy algorithm to decompose a digital curve into segments.

The GreedyDecomposition is a templated class that decompose a digital curve into segments according to the given Segment model parameter. We start fom the first point of the curve and add points to the segment while it is still growable. If the set of points is not a valid segment anymore (wrt. Segment) we stop the recognition process and start a new segment with the next point of the curve, and so on until the whole curve has been treated.

Template Parameters
Segmentis a concept that has to be default constructible and copyable and provides:
...
Curve curve;
// initialize the curve (e.g. with a BoundariesExtractor)
typedef DLL::Segment<DLL::Circle> DLLSegment;
typedef std::vector<DLLSegment> DLLList;
DLLList circleDlls = decompositor.decomposeCurve(curve);
// print the characteristics of each DLL segments of the curve
for (DLLList::const_iterator dllsItor = circleDlls.begin();
dllsItor != circleDlls.end(); ++dllsItor) {
std::cout << "DLL: " << *dllsItor << std::endl;
}

Member Typedef Documentation

template<typename Segment>
typedef Segment::Coordinates Utils::GreedyDecomposition< Segment >::Coordinates

The coordinates type of each pixel of the contour.

template<typename Segment>
typedef Segment::Curve Utils::GreedyDecomposition< Segment >::Curve

The type of a contour.

Constructor & Destructor Documentation

template<typename Segment>
Utils::GreedyDecomposition< Segment >::GreedyDecomposition ( const Curve curve = 0)
inline

Create a new GreedyDecomposition to decompose the curve into segments (wrt. Segment).

Member Function Documentation

template<typename Segment >
std::vector< Segment > Utils::GreedyDecomposition< Segment >::decomposeCurve ( )

Decompose the curve associated to this instance of GreedyDecomposition.

Returns
the partiton of the curve as a set of segments.
template<typename Segment>
std::vector<Segment> Utils::GreedyDecomposition< Segment >::decomposeCurve ( const Curve curve)
inline

Decompose the curve into segments.

Returns
the partiton of the curve as a set of segments.
template<typename Segment>
void Utils::GreedyDecomposition< Segment >::setCurve ( const Curve curve)
inline

Associate the curve to this GreedyDecomposition instance.


The documentation for this class was generated from the following file: