32 #include "DGtal/base/Common.h" 33 #include "DGtal/kernel/PointVector.h" 34 #include "DGtal/geometry/curves/BinomialConvolver.h" 35 #include "DGtal/geometry/curves/estimation/CCurveLocalGeometricEstimator.h" 39 using namespace DGtal;
50 unsigned int nbok = 0;
55 std::vector< RealPoint > points;
56 points.push_back( RealPoint( { 0.0, 0.0 } ) );
57 points.push_back( RealPoint( { 1.0, 0.0 } ) );
58 points.push_back( RealPoint( { 2.0, 0.0 } ) );
59 points.push_back( RealPoint( { 2.0, 1.0 } ) );
60 points.push_back( RealPoint( { 2.0, 2.0 } ) );
61 points.push_back( RealPoint( { 1.0, 2.0 } ) );
62 points.push_back( RealPoint( { 0.0, 2.0 } ) );
63 points.push_back( RealPoint( { 0.0, 1.0 } ) );
65 typedef std::vector< RealPoint >::const_iterator ConstIteratorOnPoints;
68 for (
unsigned int n = 1; n < 10; ++n )
70 trace.
info() <<
"Binomial convolver n=" << n << std::endl;
71 MyBinomialConvolver bcc( n );
72 bcc.init( 1.0, points.begin(), points.end(), true );
73 for (
unsigned int i = 0; i < 8; ++i )
75 <<
" " << bcc.x( i ).first
76 <<
" " << bcc.x( i ).second
77 <<
" " << bcc.tangent( i ).first
78 <<
" " << bcc.tangent( i ).second
79 <<
" " << bcc.curvature( i )
82 unsigned int n = MyBinomialConvolver::suggestedSize( 1.0, points.begin(), points.end() );
83 trace.
info() <<
"Binomial convolver suggested n=" 95 BCTangentEstimator tgtEstimator;
96 BCCurvatureEstimator curvEstimator;
98 tgtEstimator.init( 1.0, points.begin(), points.end(), true );
99 curvEstimator.init( 1.0, points.begin(), points.end(), true );
100 for ( ConstIteratorOnPoints it = points.begin(), it_end = points.end();
104 <<
" " << tgtEstimator.eval( it )
105 <<
" " << curvEstimator.eval( it )
108 nbok +=
true ? 1 : 0;
110 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 111 <<
"true == true" << std::endl;
120 int main(
int argc,
char** argv )
124 for (
int i = 0; i < argc; ++i )
129 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: This class is a functor for getting the tangent vector of a binomial convolver.
void beginBlock(const std::string &keyword="")
int main(int argc, char **argv)
Aim: This class is a functor for getting the curvature of a binomial convolver.
Aim: This class represents a 2D contour convolved by some binomial. It computes first and second orde...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: This concept describes an object that can process a range so as to return one estimated quantity...
bool testBinomialConvolver()
Aim: This class encapsulates a BinomialConvolver and a functor on BinomialConvolver so as to be a mod...