32 #include "DGtal/base/Common.h" 33 #include "DGtal/helpers/StdDefs.h" 34 #include "DGtal/base/BasicFunctors.h" 35 #include "DGtal/graph/GraphVisitorRange.h" 36 #include "DGtal/io/boards/Board2D.h" 37 #include "DGtal/io/Color.h" 38 #include "DGtal/io/colormaps/GradientColorMap.h" 39 #include "DGtal/shapes/Shapes.h" 40 #include "DGtal/topology/CanonicSCellEmbedder.h" 41 #include "DGtal/graph/DistanceBreadthFirstVisitor.h" 42 #include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h" 43 #include "DGtal/geometry/surfaces/estimation/LocalEstimatorFromSurfelFunctorAdapter.h" 44 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/BasicEstimatorFromSurfelsFunctors.h" 45 #include "DGtal/topology/LightImplicitDigitalSurface.h" 46 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/TensorVotingFeatureExtraction.h" 48 #include "DGtal/shapes/implicit/ImplicitHyperCube.h" 49 #include "DGtal/shapes/implicit/ImplicitBall.h" 50 #include "DGtal/shapes/GaussDigitizer.h" 54 using namespace DGtal;
64 template<
typename Shape>
67 unsigned int nbok = 0;
77 typedef typename Surface::Surfel Surfel;
81 Point p1( -10, -10, -10 );
82 Point p2( 10, 10, 10 );
84 nbok += K.init( p1, p2,
true ) ? 1 : 0;
86 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 87 <<
"K.init() is ok" << std::endl;
90 Shape shape(RealPoint::diagonal(0.0), 6.0 );
93 gauss.init(p1,p2,1.0);
97 SurfaceContainer* surfaceContainer =
new SurfaceContainer
99 Surface surface( surfaceContainer );
109 FunctorVoting estimator(embedder,1);
111 ConvFunctor convFunc(1.0);
113 reporter.attach(surface);
114 reporter.setParams(l2Metric, estimator , convFunc, 2.0);
116 reporter.init(1, surface.begin(), surface.end());
118 typename FunctorVoting::Quantity val = reporter.eval( surface.begin());
119 trace.
info() <<
"probing at "<< *(surface.begin())<<std::endl;
121 trace.
info() <<
"Voting = "<<val <<std::endl;
126 nbok +=
true ? 1 : 0;
128 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 129 <<
"true == true" << std::endl;
138 unsigned int nbok = 0;
148 typedef Surface::Surfel Surfel;
152 Point p1( -10, -10, -10 );
153 Point p2( 10, 10, 10 );
155 nbok += K.init( p1, p2,
true ) ? 1 : 0;
157 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 158 <<
"K.init() is ok" << std::endl;
161 Shape shape(RealPoint::diagonal(0.0), 6.0 );
164 gauss.init(p1,p2,1.0);
168 SurfaceContainer* surfaceContainer =
new SurfaceContainer
170 Surface surface( surfaceContainer );
180 FunctorVoting estimator(embedder,1);
182 ConvFunctor convFunc(1.0);
183 Reporter reporter(surface, l2Metric, estimator , convFunc);
184 reporter.attach(surface);
185 reporter.setParams(l2Metric, estimator , convFunc, 2.0);
186 reporter.init(1, surface.begin(),surface.end());
193 if (K.sKCoords(*it) == p)
195 Reporter::Quantity val = reporter.eval( it );
196 trace.
info() <<
"probing at "<< *it<<std::endl;
197 trace.
info() <<
"Voting = "<<val <<std::endl;
203 nbok +=
true ? 1 : 0;
205 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 206 <<
"true == true" << std::endl;
214 int main(
int argc,
char** argv )
218 for (
int i = 0; i < argc; ++i )
222 bool res = testLocalEstimatorFromFunctorAdapter<ImplicitHyperCube<Z3i::Space> >()
225 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void beginBlock(const std::string &keyword="")
Aim: defines a functor on double numbers which corresponds to a Gaussian convolution kernel...
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
MyDigitalSurface::ConstIterator ConstIterator
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
bool testLocalEstimatorFromFunctorAdapter()
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD...
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create an hypercube in n...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: this class adapts any local functor on digital surface element to define a local estimator...
int main(int argc, char **argv)