32 #include "DGtal/base/Common.h"
33 #include "ConfigTest.h"
34 #include "DGtalCatch.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/shapes/implicit/ImplicitHyperCube.h"
37 #include "DGtal/shapes/implicit/ImplicitBall.h"
38 #include "DGtal/shapes/GaussDigitizer.h"
39 #include "DGtal/topology/LightImplicitDigitalSurface.h"
40 #include "DGtal/topology/DigitalSurface.h"
41 #include "DGtal/topology/CanonicSCellEmbedder.h"
42 #include "DGtal/base/BasicFunctors.h"
43 #include "DGtal/geometry/volumes/distance/LpMetric.h"
44 #include "DGtal/geometry/surfaces/estimation/LocalEstimatorFromSurfelFunctorAdapter.h"
45 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/SphericalHoughNormalVectorEstimator.h"
47 #ifdef WITH_VISU3D_QGLVIEWER
48 #include "DGtal/io/viewers/Viewer3D.h"
50 #include "DGtal/io/boards/Board3D.h"
55 using namespace DGtal;
62 TEST_CASE(
"Testing SphericalHoughNormalVectorEstimator" )
72 Point p1( -50, -50, -50 );
73 Point p2( 50, 50, 50 );
79 Shape shape(RealPoint::diagonal(0.0), 10.0 );
82 gauss.init(p1,p2,1.0);
95 SphericalHough estimator(embedder,1.0 , 0.001, 1000 , 10, 1);
98 ConstFunctor constFunc(1.0);
99 Reporter reporter(
surface, l2, estimator , constFunc);
101 reporter.setParams(l2, estimator , constFunc, 10.0);
106 typedef Reporter::Quantity Quantity;
108 Quantity result = reporter.eval(
surface.begin() );
109 trace.
info() <<
"Result at begin = "<< result <<std::endl;
113 trace.
info() <<
"Expecting = "<< res <<std::endl;
115 REQUIRE( std::abs(result.dot(res)) > 0.9 );
118 #ifdef WITH_VISU3D_QGLVIEWER_TESTS
121 QApplication application(argc,argv);
127 Quantity normal = reporter.eval( it );
128 viewer << CustomColors3D( DGtal::Color(static_cast<unsigned char>(255*abs(normal[0])),
129 static_cast<unsigned char>(255*abs(normal[1])),
130 static_cast<unsigned char>(255*abs(normal[2]))),
131 DGtal::Color(
static_cast<unsigned char>(255*abs(normal[0])),
132 static_cast<unsigned char>(255*abs(normal[1])),
133 static_cast<unsigned char>(255*abs(normal[2]))));
139 viewer<< Viewer3D<>::updateDisplay;
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: 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.
Cell unsigns(const SCell &p) const
Creates an unsigned cell from a signed one.
Point sCoords(const SCell &c) const
Return its digital coordinates.
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.
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Aim: Define a simple functor that returns a constant value (0 by default).
Aim: This functor estimates normal vector for a collection of surfels using spherical accumulator bas...
CountedPtr< SH3::DigitalSurface > surface
SH3::DigitalSurface Surface
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.
REQUIRE(domain.isInside(aPoint))
TEST_CASE("Testing SphericalHoughNormalVectorEstimator")