-
-
Notifications
You must be signed in to change notification settings - Fork 121
Contours and discrete geometrics estimators
-
The concept
CRange(Note:CSequenceis called nowCRange) describes a sequence of elements (the order matters) and provides:- inner type:
ConstIterator, a STL bidirectionnal const_iterator begin(): ConstIteratorend(): ConstIterator
- inner type:
-
The concept
CSegmentdescribes a subrange for which a given predicate is true. Moreover, the predicate has to be true for any subrange of any segment. We do not precise further this concept because we focus on their detection along ranges. -
(Incremental) detection algorithms should verify the concept
CSegmentComputer<typename ConstIterator>- inner types:
-
ConstIterator(is the template parameterConstIterator). -
Self, defined asSegmentComputer<typename ConstIterator>. -
Reverse, defined asSegmentComputer<typename std::reverse_iterator<ConstIterator> >.
-
- in addition to the default and copy constructors, it should also define the following methods :
-
void init ( const ConstIterator& it ): initialize the algorithm from one element. -
bool extend ( const ConstIterator& it ): extend the current segment to the next element and return TRUE if it is possible, FALSE otherwise.
-
- inner types:
-
Note that the input parameters are iterators (and not elements) to be able to scan all the visited elements if it is necessary in the detection algorithm. Moreover, when passed as input parameters, iterators are assumed to have been incremented and their validity is assumed to have been checked because the detection algorithm does not care about how the end of the range has to be processed.
-
The concept
CDecomposition<typename Range, typename SegmentComputer>describes an object that covers a model ofCRangeinto segments detected thanks to a model ofCSegmentComputer. More precisely, it provides:- an inner type
SegmentIterator:- default and copy constructors
- dereference operator: return an instance of a model of CSegmentComputer.
-
getBack(),getFront(): return iterators on the range, respectively, at the first element and one-past-the-end element of the segment. -
intersectPrevious(),intersectNext(): return TRUE if the current segment intersects, respectively, the previous and the next one (when they exist), FALSE otherwise.
-
void init(const Range & r, const SegmentComputer s, bool closed): called once, r describes the range to process, s is the detection algorithm, closed tells what to do when arriving at r.end().
- an inner type
-
template <typename KSpace> class GridCurve<KSpace>: describes a 4-connected oriented interpixel curve, closed or open. For instance, the topological boundary of a simply connected digital shape is a closedGridCurve. This object provides several ranges, each of them are models ofCRange:-
PointsRange,CodesRange,LinelsRange,ArrowsRange: Each of them provides the following types/methods: - inner type =ConstIterator-ConstIterator begin() const-ConstIterator end() const -
PointsRange: the ConstIterator is a model ofCConstIteratorOnPoint<KSpace::Space>It returns the successive coordinates (KSpace::Space::Point) of the pointels of the grid curve (even the last when the curve is open). -
CodesRange: the ConstIterator is a model ofCConstIteratorOnCodeIt returns the successive chaincodes (unsigned intin 0-3) of the linels of the grid curve -
LinelsRange: the ConstIterator is a model ofCConstIteratorOnLinel<KSpace>It returns the successive linels (KSpace::SCell) of the grid curve. -
ArrowsRange: the ConstIterator is a model ofCConstIteratorOnArrow<KSpace::Space>It returns the successive arrows corresponding to linels as astd::pair<KSpace::Space::Point,KSpace::Space::Vector>where the point describes the coordinates of the pointel and the vector stands for the displacement. -
ConstraintsRange: the ConstIterator is a model ofCConstIteratorOnConstraints<KSpace::Space>It returns the center of the two pixels incident to the successive linels as astd::pair<KSpace::Space::Point,KSpace::Space::Point>
-
-
The concept
CLocalCurveGeometricEstimatordescribes an object that can process a range so as to return one estimated quantity for each element of the range (or a given subrange). More precisely, it provides:- inner types:
Rangea model ofCRange,Quantitythe type of the estimated quantity. Note thatRangeshould provide an inner typeConstIterator. -
void init( double h, const Range & s, bool closed ): called once,his the grid step,sdescribes the piece to process,closedtells what to do when arriving ats.end(). -
template <typename OutputIterator> void eval( Range::ConstIterator itb, Range::ConstIterator ite, OutputIterator itw ) const: writes estimated quantities from positionsitbtilliteexcluded on the output with*itw++. -
Quantity eval( Sequence::ConstIterator it) const: returns the estimated quantity at positionit.
- inner types:
-
We think to provide a rather generic class for building geometric estimators from models of
CSegmentComputer. For instance, given a SegmentComputer and a functor on SegmentComputer, we may provide an estimator which returns the functor value of the most centered segment. The class should be written astemplate <typename Range, typename SegmentComputer, typename SegmentComputerFunctor> class MostCenteredMaximalSegmentEstimator, where-
Rangeis a model ofCRange -
SegmentComputeris a standard model ofCSegmentComputer -
SegmentComputerFunctorhas- inner type
Value. Value operator()( const SegmentComputer & sc )
- inner type
- inner types:
Range(is template parameterRange),Quantity(isSegmentComputerFunctor::Value) void init( double h, const Range & s, bool closed )template <typename OutputIterator> void eval( Range::ConstIterator itb, Range::ConstIterator ite, OutputIterator itw ) constQuantity eval( Range::ConstIterator it) const
-
-
Similarly, we could provide a lambda-Maximal Segment estimator built similarly from maximal segments.
-
When computing the 'true' geometrical quantities from an implicite shape for comparison, we return one quantity for each element of the range so that we also think about providing a generic class to get true values from implicite shapes. The class should be written as
template <typename Range, typename ImpliciteShape, typename ImliciteShapeFunctor> class TrueEstimator, where-
Rangeis a model ofCRange -
ImpliciteShapeis a model ofCImpliciteShape -
ImliciteShapeFunctorhas- inner type
Value. Value operator()( const ImpliciteShape & sc )
- inner type
- inner types:
Range(is template parameterRange),Quantity(isSegmentComputerFunctor::Value) void init( double h, const Range & s, bool closed )template <typename OutputIterator> void eval( Range::ConstIterator itb, Range::ConstIterator ite, OutputIterator itw ) constQuantity eval( Range::ConstIterator it) const
-
-
The concept
CGlobalCurveGeometricEstimatordescribes an object that can process aCRangeso as to return a singleQuantity. More precisely:- inner types:
Rangethe type of the sequence or range,Quantitythe type of the estimated quantity. Note thatRangeshould provide an inner typeConstIterator. -
void init( double h, const Range & s, bool closed ): called once,his the grid step,sdescribes the range to process,closedtells what to do when arriving ats.end(). -
Quantity eval( ) const: returns the estimated quantity for the range. - Examples of model: length by MLP,FP, greedy DSSs segmentation.
- inner types:
-
The concept
CGlobalGeometricEstimatordescribes an object that can process aCDigitalSetor aCObject(don't know if there exist topology dependent global geometric estimators) so as to return a singleQuantity. More precisely:- inner types:
SetorObjectthe type of the object,Quantitythe type of the estimated quantity. Note thatObjectshould provide an inner typeConstIterator. -
void init( double h, const Set & s): called once,his the grid step,sdescribes the set to process. -
Quantity eval( ) const: returns the estimated quantity for the object- Examples of model: geometrical moments, circularity, ...
- inner types: