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 PointVector<2,int>
Point;
typedef std::vector<Point>
Range;
typedef SaturatedSegmentation<SegmentComputer>
Segmentation;
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));
Segmentation theSegmentation(curve.begin(), curve.end(), recognitionAlgorithm);
Segmentation::SegmentComputerIterator i = theSegmentation.begin();
Segmentation::SegmentComputerIterator end = theSegmentation.end();
}
SaturatedSegmentation::SegmentComputerIterator end() const
TSegmentComputer SegmentComputer
SegmentComputer::ConstIterator ConstIterator
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
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
Definition at line 153 of file SaturatedSegmentation.h.