32#include "DGtal/base/Common.h"
33#include "ConfigTest.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/base/BasicFunctors.h"
36#include "DGtal/graph/GraphVisitorRange.h"
37#include "DGtal/io/boards/Board2D.h"
38#include "DGtal/io/Color.h"
39#include "DGtal/io/colormaps/GradientColorMap.h"
40#include "DGtal/shapes/Shapes.h"
41#include "DGtal/kernel/CanonicEmbedder.h"
42#include "DGtal/topology/CanonicSCellEmbedder.h"
43#include "DGtal/graph/DistanceBreadthFirstVisitor.h"
44#include "DGtal/geometry/volumes/distance/LpMetric.h"
45#include "DGtal/geometry/surfaces/estimation/LocalEstimatorFromSurfelFunctorAdapter.h"
46#include "DGtal/geometry/surfaces/estimation/estimationFunctors/BasicEstimatorFromSurfelsFunctors.h"
47#include "DGtal/geometry/surfaces/estimation/estimationFunctors/CLocalEstimatorFromSurfelFunctor.h"
49#include "DGtal/topology/LightImplicitDigitalSurface.h"
50#include "DGtal/topology/DigitalSurface.h"
52#include "DGtal/geometry/surfaces/estimation/estimationFunctors/ElementaryConvolutionNormalVectorEstimator.h"
56#include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingGaussianCurvatureEstimator.h"
57#include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingMeanCurvatureEstimator.h"
58#include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingNormalVectorEstimator.h"
59#include "DGtal/geometry/surfaces/estimation/estimationFunctors/LinearLeastSquareFittingNormalVectorEstimator.h"
73template <
typename TPo
int3>
74struct ImplicitDigitalEllipse3 {
75 typedef TPoint3
Point;
77 ImplicitDigitalEllipse3(
double a,
double b,
double c )
78 : myA( a ), myB( b ), myC( c )
81 bool operator()(
const TPoint3 & p )
const
83 double x = ( (double) p[ 0 ] / myA );
84 double y = ( (double) p[ 1 ] / myB );
85 double z = ( (double) p[ 2 ] / myC );
86 return ( x*x + y*y + z*z ) <= 1.0;
98 unsigned int nbok = 0;
103 typedef ImplicitDigitalEllipse3<Point> ImplicitDigitalEllipse;
107 typedef SurfaceContainer::Surfel
Surfel;
111 Point p1( -10, -10, -10 );
112 Point p2( 10, 10, 10 );
114 nbok +=
K.
init( p1, p2,
true ) ? 1 : 0;
116 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
117 <<
"K.init() is ok" << std::endl;
118 ImplicitDigitalEllipse ellipse( 6.0, 4.5, 3.4 );
120 SurfaceContainer* surfaceContainer =
new SurfaceContainer
122 Surface surface( surfaceContainer );
123 unsigned int nbsurfels = 0;
124 for (
ConstIterator it = surface.begin(), it_end = surface.end();
129 trace.
info() << nbsurfels <<
" surfels found." << std::endl;
136 Functor, ConvFunctor> Reporter;
143 Functor estimator(embedder, 1);
145 ConvFunctor convFunc(1.0);
147 reporter.attach(surface);
148 reporter.setParams(l2,estimator,convFunc, 5);
152 ReporterGaussian reporterGaussian;
153 reporterGaussian.attach(surface);
154 reporterGaussian.setParams(l2,estimator,gaussKernelFunc, 5.0);
155 reporterGaussian.init(1, surface.begin(), surface.end());
157 reporter.init(1.0, surface.begin(), surface.end());
158 Functor::Quantity val = reporter.eval( surface.begin() );
159 trace.
info() <<
"Value with radius 5= "<<val << std::endl;
160 nbok += ((fabs((
double)val - 124.0)) < 40) ? 1 : 0;
163 reporter.setParams(l2,estimator,convFunc, 20.0);
164 reporter.init(1, surface.begin(), surface.end());
165 Functor::Quantity val2 = reporter.eval( surface.begin() );
166 trace.
info() <<
"Value with radius 20= "<<val2 << std::endl;
168 nbok += ((fabs((
double)val2 - 398.0)) < 120) ? 1 : 0;
174 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
175 <<
"true == true" << std::endl;
203int main(
int argc,
char** argv )
207 for (
int i = 0; i < argc; ++i )
212 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
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 CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: this class adapts any local functor on digital surface element to define a local estimator....
Aim: implements l_p metrics.
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="")
Aim: Define a simple functor that returns a constant value (0 by default).
Aim: Estimates normal vector by convolution of elementary normal vector to adjacent surfel.
Aim: Estimates normal vector using CGAL linear least squares plane fitting.
Aim: Estimates Gaussian curvature using CGAL Jet Fitting and Monge Form.
Aim: Estimates Mean curvature using CGAL Jet Fitting and Monge Form.
Aim: Estimates normal vector using CGAL Jet Fitting and Monge Form.
SH3::DigitalSurface Surface
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A trivial embedder for signed cell, which corresponds to the canonic injection of cell centroids...
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: this concept describes functors on digtal surface surfel which can be used to define local estim...
Aim: defines a functor on double numbers which corresponds to a Gaussian convolution kernel....
InHalfPlaneBySimple3x3Matrix< Point, double > Functor
bool testLocalEstimatorFromFunctorAdapter()