40#include "DGtal/base/Common.h"
42#include "DGtal/kernel/SpaceND.h"
43#include "DGtal/kernel/domains/HyperRectDomain.h"
44#include "DGtal/topology/KhalimskySpaceND.h"
45#include "DGtal/topology/SurfelAdjacency.h"
46#include "DGtal/topology/SurfelNeighborhood.h"
48#include "DGtal/shapes/Shapes.h"
49#include "DGtal/shapes/ShapeFactory.h"
50#include "DGtal/shapes/GaussDigitizer.h"
51#include "DGtal/geometry/curves/GridCurve.h"
53#include "DGtal/geometry/curves/estimation/MostCenteredMaximalSegmentEstimator.h"
54#include "DGtal/geometry/curves/StabbingCircleComputer.h"
63template <
typename Shape,
typename RealPo
int>
78 dig.
init( low, up, h );
89 std::cerr <<
"[estimatorOnShapeDigitization]"
90 <<
" error in creating KSpace." << std::endl;
98 std::vector<Point> points;
109 std::vector<double> estimations;
118 CurvatureEstimator estimator(sc, sce);
121 std::cout <<
"# open grid curve" << endl;
124 estimator.init( r.begin(), r.end() );
128 estimator.eval( r.begin(), r.end(), std::back_inserter(estimations), h );
138 CurvatureEstimator estimator(sc, sce);
139 std::cout <<
"# closed grid curve" << endl;
140 estimator.init( r.c(), r.c() );
141 estimator.eval( r.c(), r.c(), std::back_inserter(estimations), h );
144 std::cout <<
"# idx kappa" << endl;
146 for ( ClassicIterator it = r.begin(), ite = r.end();
147 it != ite; ++it, ++i )
149 std::cout << i <<
" " << estimations.at(i) << std::endl;
154 std::cerr <<
"[estimatorOnShapeDigitization]"
155 <<
" error in finding a bel." << std::endl;
158 trace.
emphase() << ( ok ?
"Passed." :
"Error." ) << endl;
167 trace.
info() <<
" Curvature estimation using shape to digitize: flower" << std::endl
168 <<
" with Grid step: 0.01" << std::endl;
173 string shapeName =
"flower";
180 if (shapeName ==
"flower")
188 else if (shapeName ==
"ellipse")
196 else if (shapeName ==
"ball")
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Aim: Model of the concept StarShaped represents any circle in the plane.
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structu...
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
Aim: Model of the concept StarShaped represents any ellipse in the plane.
Aim: Model of the concept StarShaped represents any flower with k-petals in the plane.
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
const Point & getUpperBound() const
void attach(ConstAlias< EuclideanShape > shape)
const Point & getLowerBound() const
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
IncidentPointsRange getIncidentPointsRange() const
bool initFromVector(const std::vector< Point > &aVectorOfPoints)
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: A model of CLocalCurveGeometricEstimator that assigns to each element of a (sub)range a quantity...
static Self diagonal(Component val=1)
Aim: model of CBidirectionalRangeFromPoint that adapts any range of elements bounded by two iterators...
TConstIterator ConstIterator
Aim: On-line recognition of a digital circular arcs (DCA) defined as a sequence of connected grid edg...
static void track2DBoundaryPoints(std::vector< Point > &aVectorOfPoints, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
bool estimatorOnShapeDigitization(const string &name, Shape &aShape, const RealPoint &low, const RealPoint &up, double h)
DGtal is the top-level namespace which contains all DGtal functions and types.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
PointVector< 3, double > RealPoint