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"
47#include "DGtal/geometry/volumes/distance/LpMetric.h"
49#include "DGtal/shapes/implicit/ImplicitHyperCube.h"
50#include "DGtal/shapes/implicit/ImplicitBall.h"
51#include "DGtal/shapes/GaussDigitizer.h"
53#include "DGtal/io/viewers/Viewer3D.h"
54#include "DGtal/io/colormaps/GradientColorMap.h"
69template<
typename Shape>
72 unsigned int nbok = 0;
88 Point p1( -100, -100, -100 );
89 Point p2( 100, 100, 100 );
91 nbok +=
K.
init( p1, p2,
true ) ? 1 : 0;
93 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
94 <<
"K.init() is ok" << std::endl;
100 gauss.init(p1,p2,1.0);
104 SurfaceContainer* surfaceContainer =
new SurfaceContainer
106 Surface surface( surfaceContainer );
116 FunctorVoting estimator(embedder,1);
120 ConvFunctor convFunc(4.0);
122 reporter.attach(surface);
123 reporter.setParams(l2, estimator , convFunc, 5.0);
125 reporter.init(1, surface.begin() , surface.end());
127 std::vector<double> values;
128 reporter.eval( surface.begin(), surface.end(), std::back_insert_iterator<std::vector<double> >(values));
130 double maxval = *std::max_element(values.begin(), values.end());
131 double minval = *std::min_element(values.begin(), values.end());
132 trace.
info() <<
"Min/max= "<< minval<<
"/"<<maxval<<std::endl;
133 QApplication application( argc, argv );
136 viewer.setWindowTitle(
"Features from Tensor Voting");
140 Gradient cmap_grad( minval, maxval );
141 cmap_grad.addColor(
Color( 50, 50, 255 ) );
142 cmap_grad.addColor(
Color( 255, 0, 0 ) );
143 cmap_grad.addColor(
Color( 255, 255, 10 ) );
146 viewer <<
SetMode3D((*(surface.begin())).className(),
"Basic" );
158 viewer << Viewer3D<>::updateDisplay;
169int main(
int argc,
char** argv )
173 for (
int i = 0; i < argc; ++i )
177 bool res = testLocalEstimatorFromFunctorAdapter<ImplicitHyperCube<Z3i::Space> >(argc,argv)
180 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Structure representing an RGB triple with alpha component.
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
DigitalSurfaceContainer::Surfel Surfel
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
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 Self diagonal(Component val=1)
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="")
SH3::DigitalSurface Surface
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...
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: defines a functor on double numbers which corresponds to a Gaussian convolution kernel....
bool testLocalEstimatorFromFunctorAdapter()