49 #include "DGtal/base/Common.h" 50 #include "DGtal/helpers/StdDefs.h" 51 #include "DGtal/topology/SetOfSurfels.h" 52 #include "DGtal/topology/DigitalSurface.h" 53 #include "DGtal/geometry/curves/GridCurve.h" 54 #include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h" 55 #include "DGtal/geometry/volumes/estimation/VoronoiCovarianceMeasure.h" 56 #include "DGtal/geometry/surfaces/estimation/VoronoiCovarianceMeasureOnDigitalSurface.h" 57 #include "DGtal/geometry/surfaces/estimation/VCMDigitalSurfaceLocalEstimator.h" 58 #include "DGtal/io/colormaps/GradientColorMap.h" 59 #include "DGtal/io/boards/Board2D.h" 60 #include "ConfigExamples.h" 66 using namespace DGtal;
69 int main(
int ,
char** )
77 typedef Curve::SCellsRange LinelRange;
84 KernelFunction, CurvatureFunctor> VCMCurvatureEstimator;
90 string inputSDP = examplesPath +
"samples/circle-43.sdp";
91 trace.
info() <<
"Reading input 2d discrete points file: " << inputSDP;
92 KSpace ks; ks.init(
Point( -1000, -1000 ),
Point( 1000, 1000 ),
true );
94 fstream inputStream( inputSDP.c_str(), ios::in);
95 curve.initFromVectorStream(inputStream);
97 DigitalSurfaceContainer* container
99 LinelRange range = curve.getSCellsRange();
101 container->surfelSet().insert( *it );
103 trace.
info() <<
" [done] " << std::endl ;
105 trace.
info() <<
"Big radius R = " << R << std::endl;
107 trace.
info() <<
"Small radius r = " << r << std::endl;
108 const double T = 0.2;
109 trace.
info() <<
"Curvature thres. T = " << T << std::endl;
112 KernelFunction chi( 1.0, r );
113 VCMCurvatureEstimator estimator( ptrSurface );
114 estimator.setParams( Pointels, R, r, chi, 3.0, l2,
true );
115 estimator.init( 1.0, ptrSurface->begin(), ptrSurface->end() );
119 colormap.addColor( Color::Blue );
120 colormap.addColor( Color::Yellow );
121 colormap.addColor( Color::Red );
126 double curv = estimator.eval( it );
127 curv = std::min( T, curv );
129 new CustomColors( colormap( curv ), colormap( curv ) ) )
131 std::cout << curv << std::endl;
133 board.
saveSVG(
"dvcm-curvature.svg");
Aim: A functor Surfel -> Quantity that returns the absolute curvature at given surfel. This class has meaning only in 2D.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Aim: This class adapts a VoronoiCovarianceMeasureOnDigitalSurface to be a model of CDigitalSurfaceLoc...
MyDigitalSurface::ConstIterator ConstIterator
KhalimskySpaceND< 2, Integer > KSpace
Aim: Smart or simple const pointer on T. It can be a smart pointer based on reference counts or a sim...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Aim: implements separable l_p metrics with exact predicates.
Aim: This class specializes the Voronoi covariance measure for digital surfaces. It adds notably the ...
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels...
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex...
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...