This class implements a greedy algorithm to decompose a digital curve into segments.
More...
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
-
Segment | is a concept that has to be default constructible and copyable and provides: |
- a Coordinates type that defines the 2D coordinates of the pixels,
- a Curve type that is an ordered set of Coordinates to define a curve,
- a bool addPoint(Coordinates) function that adds a point to the segment and returns true if the segment is still growable,
- a bool isValid() function that tells whether the segment is a valid one, i.e. if we can rely on its analytical representation,
- a Curve getCurve() fonction that returns the underlying curve the segment represents,
- a
<<
operator that prints the characteristics of the segment on an output stream.
...
Curve curve;
typedef std::vector<DLLSegment> DLLList;
for (DLLList::const_iterator dllsItor = circleDlls.begin();
dllsItor != circleDlls.end(); ++dllsItor) {
std::cout << "DLL: " << *dllsItor << std::endl;
}