This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
- Author
- Jérémy Levallois (
jerem.nosp@m.y.le.nosp@m.vallo.nosp@m.is@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr
) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), INSA-Lyon, France LAboratoire de MAthématiques - LAMA (CNRS, UMR 5127), Université de Savoie, France
- Date
- 2014/06/26
Functions for testing class IntegralInvariantCovarianceEstimator and IIGeometricFunctor.
This file is part of the DGtal library.
Definition in file testIntegralInvariantCovarianceEstimator.cpp.
bool testGaussianCurvature3d |
( |
double |
h, |
|
|
double |
delta |
|
) |
| |
Definition at line 59 of file testIntegralInvariantCovarianceEstimator.cpp.
75 double realValue = 1.0/(radius * radius);
87 trace.
error() <<
"Problem with Khalimsky space" << std::endl;
99 VisitorRange range(
new Visitor( surf, *surf.begin() ));
100 VisitorConstIterator ibegin = range.begin();
101 VisitorConstIterator iend = range.end();
103 MyIICurvatureFunctor curvatureFunctor;
104 curvatureFunctor.init( h, re );
106 MyIICurvatureEstimator curvatureEstimator( curvatureFunctor );
107 curvatureEstimator.attach(
K, dshape );
108 curvatureEstimator.setParams( re/h );
109 curvatureEstimator.init( h, ibegin, iend );
115 std::vector< Value > results;
116 std::back_insert_iterator< std::vector< Value > > resultsIt( results );
117 curvatureEstimator.eval( ibegin, iend, resultsIt );
121 trace.
beginBlock (
"Comparing results of integral invariant 3D Gaussian curvature ..." );
124 unsigned int rsize = static_cast<unsigned int>(results.size());
128 trace.
error() <<
"ERROR: surface is empty" << std::endl;
133 for (
unsigned int i = 0; i < rsize; ++i )
135 mean += results[ i ];
141 trace.
error() <<
"ERROR: result is NaN" << std::endl;
146 double v = std::abs ( realValue - mean );
148 trace.
warning() <<
"True value: " << realValue << std::endl;
150 trace.
warning() <<
"Delta: " << delta <<
" |true - mean|: " << v << std::endl;
void beginBlock(const std::string &keyword="")
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
MyDigitalSurface::ConstIterator ConstIterator
const Point & getLowerBound() const
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
const Point & getUpperBound() const
Aim: This class is useful to perform a depth-first exploration of a graph given a starting point or s...
void attach(ConstAlias< EuclideanShape > shape)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
BreadthFirstVisitor< MyDigitalSurface > Visitor
Aim: This class implement an Integral Invariant estimator which computes for each surfel the covarian...
Aim: Implements basic operations that will be used in Point and Vector classes.
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
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 class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Aim: Transforms a graph visitor into a single pass input range.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
Aim: A functor Matrix -> Real that returns the Gaussian curvature by diagonalizing the given covarian...
References DGtal::GaussDigitizer< TSpace, TEuclideanShape >::attach(), DGtal::DigitalSurface< TDigitalSurfaceContainer >::begin(), DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::error(), DGtal::Surfaces< TKSpace >::findABel(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::getLowerBound(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::getUpperBound(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::init(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::trace, and DGtal::Trace::warning().
Referenced by main().
bool testPrincipalCurvatures3d |
( |
double |
h | ) |
|
Definition at line 161 of file testIntegralInvariantCovarianceEstimator.cpp.
188 trace.
error() <<
"Problem with Khalimsky space" << std::endl;
200 VisitorRange range(
new Visitor( surf, *surf.begin() ));
201 VisitorConstIterator ibegin = range.begin();
202 VisitorConstIterator iend = range.end();
204 MyIICurvatureFunctor curvatureFunctor;
205 curvatureFunctor.init( h, re );
207 MyIICurvatureEstimator curvatureEstimator( curvatureFunctor );
208 curvatureEstimator.attach(
K, dshape );
209 curvatureEstimator.setParams( re/h );
210 curvatureEstimator.init( h, ibegin, iend );
216 std::vector< Value > results;
217 std::back_insert_iterator< std::vector< Value > > resultsIt( results );
218 curvatureEstimator.eval( ibegin, iend, resultsIt );
222 trace.
beginBlock (
"Comparing results of integral invariant 3D Gaussian curvature ..." );
224 unsigned int error_order = 0;
225 unsigned int rsize = static_cast<unsigned int>(results.size());
229 trace.
error() <<
"ERROR: surface is empty" << std::endl;
234 for (
unsigned int i = 0; i < rsize; ++i )
236 if( std::abs(results[i].first) < std::abs(results[i].second) )
242 trace.
warning() <<
"Error order: " << error_order << std::endl;
243 trace.
warning() <<
"If not equals to 0, something is wrong..." << std::endl;
247 if( error_order != 0 )
void beginBlock(const std::string &keyword="")
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
MyDigitalSurface::ConstIterator ConstIterator
const Point & getLowerBound() const
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
const Point & getUpperBound() const
Aim: This class is useful to perform a depth-first exploration of a graph given a starting point or s...
void attach(ConstAlias< EuclideanShape > shape)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
BreadthFirstVisitor< MyDigitalSurface > Visitor
Aim: This class implement an Integral Invariant estimator which computes for each surfel the covarian...
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: A functor Matrix -> std::pair<Real,Real> that returns the first and the second principal curvatu...
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
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 class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Aim: Transforms a graph visitor into a single pass input range.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
References DGtal::GaussDigitizer< TSpace, TEuclideanShape >::attach(), DGtal::DigitalSurface< TDigitalSurfaceContainer >::begin(), DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::error(), DGtal::Surfaces< TKSpace >::findABel(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::getLowerBound(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::getUpperBound(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::init(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::trace, and DGtal::Trace::warning().
Referenced by main().