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" 59 using namespace DGtal;
63 template <
typename Shape,
typename RealPo
int>
67 const RealPoint& low,
const RealPoint& up,
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( h, r.
begin(), r.
end() );
128 estimator.eval( r.
begin(), r.
end(), std::back_inserter(estimations) );
138 CurvatureEstimator estimator(sc, sce);
139 std::cout <<
"# closed grid curve" << endl;
140 estimator.init( h, r.
c(), r.
c() );
141 estimator.eval( r.
c(), r.
c(), std::back_inserter(estimations) );
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")
184 RealPoint::diagonal(-10),
185 RealPoint::diagonal(10),
188 else if (shapeName ==
"ellipse")
192 RealPoint::diagonal(-10),
193 RealPoint::diagonal(10),
196 else if (shapeName ==
"ball")
200 RealPoint::diagonal(-10),
201 RealPoint::diagonal(10),
void beginBlock(const std::string &keyword="")
bool estimatorOnShapeDigitization(const string &name, Shape &aShape, const RealPoint &low, const RealPoint &up, double h)
const Domain domain(Point(1, 2), Point(6, 5))
const Point & getLowerBound() const
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
const Point & getUpperBound() const
Aim: A model of CLocalCurveGeometricEstimator that assigns to each element of a (sub)range a quantity...
Aim: Model of the concept StarShaped represents any ellipse in the plane.
Aim: Implements basic operations that will be used in Point and Vector classes.
void attach(const EuclideanShape &shape)
Aim: Model of the concept StarShaped represents any flower with k-petals in the plane.
Aim: On-line recognition of a digital circular arcs (DCA) defined as a sequence of connected grid edg...
Aim: Model of the concept StarShaped represents any circle in the plane.
bool initFromVector(const std::vector< Point > &aVectorOfPoints)
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structu...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
TConstIterator ConstIterator
IncidentPointsRange getIncidentPointsRange() const
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...