Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range given by a pair of ConstIterators (maximal segments are segments that cannot be included in greater segments).
More...
template<typename TSegmentComputer>
class DGtal::SaturatedSegmentation< TSegmentComputer >
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range given by a pair of ConstIterators (maximal segments are segments that cannot be included in greater segments).
Description of template class 'SaturatedSegmentation'
This class is a model of CSegmentation.
- Template Parameters
-
In the short example below, a digital curve stored in a STL vector is decomposed into maximal 8-connected DSSs whose parameters are sent to the standard output.
typedef std::vector<Point>
Range;
curve.push_back(
Point(1,1));
curve.push_back(
Point(2,1));
curve.push_back(
Point(3,2));
curve.push_back(
Point(4,2));
curve.push_back(
Point(5,2));
curve.push_back(
Point(6,2));
curve.push_back(
Point(7,2));
curve.push_back(
Point(8,1));
curve.push_back(
Point(9,1));
}
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: Specific iterator to visit all the maximal segments of a saturated segmentation.
const ConstIterator end() const
const ConstIterator begin() const
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
SaturatedSegmentation::SegmentComputerIterator end() const
TSegmentComputer SegmentComputer
SegmentComputer::ConstIterator ConstIterator
Aim: model of CBidirectionalRangeFromPoint that adapts any range of elements bounded by two iterators...
SaturatedSegmentation< SegmentComputer > Segmentation
If you want to get the saturated segmentation of a part of the digital curve (not the whole digital curve), you can give the range to process as a pair of iterators when calling the setSubRange() method as follow:
theSegmentation.setSubRange(beginIt, endIt);
Obviously, [beginIt, endIt) has to be a valid range included in the wider range [curve.begin(), curve.end()).
Moreover, the segmentation at the ends depends of the underlying digital curve. Among the whole set of
maximal segments that pass through the first (resp. last) element of the range, one maximal segment must be chosen as the first (resp. last) retrieved maximal segments. Several processing modes are therefore available:
- "First" and "First++"
- "MostCentered" (default) and "MostCentered++"
- "Last" and "Last++"
The mode i indicates that the segmentation begins with the i maximal segment passing through the first element and ends with the i maximal segment passing through the last element. The last retrieved segment of the segmentation is not included in the simple "XXX" modes, but is included in the "XXX++" modes.
For instance, in the default mode "MostCentered", the segmentation begins with the most centered maximal segment passing through the first element and ends (without including it) with the most centered maximal segment passing through the last element. This mode is basically used to process a whole circular structure so that the first maximal segment is not retrieved twice. However, in order to include the most centered maximal segment passing through the last element in a subpart, you should use the "MostCentered++" mode.
In order to set a mode (before getting a SegmentComputerIterator), use the setMode() method as follow:
theSegmentation.setMode("First");
- See also
- testSegmentation.cpp
- Examples
- geometry/curves/convex-and-concave-parts.cpp, geometry/curves/estimation/exampleLMST2D.cpp, and geometry/curves/exampleAlphaThickSegmentTgtCover.cpp.
Definition at line 153 of file SaturatedSegmentation.h.