51 #include "DGtal/base/Common.h"
52 #include "DGtal/helpers/StdDefs.h"
53 #include "DGtal/kernel/BasicPointPredicates.h"
54 #include "DGtal/math/linalg/EigenDecomposition.h"
55 #include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h"
56 #include "DGtal/geometry/volumes/estimation/VoronoiCovarianceMeasure.h"
57 #include "DGtal/io/colormaps/GradientColorMap.h"
58 #include "DGtal/io/boards/Board2D.h"
59 #include "ConfigExamples.h"
65 using namespace DGtal;
68 int main(
int ,
char** )
77 typedef LinearAlgebraTool::Matrix Matrix;
83 vector<unsigned int> vPos;
86 string inputSDP = examplesPath +
"samples/flower-30-8-3.sdp";
89 trace.
info() <<
"Reading input 2d discrete points file: " << inputSDP;
93 trace.
info() <<
"Big radius R = " << R << std::endl;
95 trace.
info() <<
"Small radius r = " << r << std::endl;
97 trace.
info() <<
"Feature thres. T = " << T << std::endl;
98 const double size = 3.0;
101 VCM vcm( R, ceil( r ), l2,
true );
102 vcm.init( pts.begin(), pts.end() );
104 KernelFunction chi( 1.0, r );
109 colormap.addColor(
Color( 128, 128, 255 ) );
110 colormap.addColor(
Color( 255, 255, 255 ) );
111 colormap.addColor(
Color( 255, 255, 0 ) );
112 colormap.addColor(
Color( 255, 0, 0 ) );
116 for ( std::vector<Point>::const_iterator it = pts.begin(), itE = pts.end();
120 vcm_r = vcm.measure( chi, *it );
121 LinearAlgebraTool::getEigenDecomposition( vcm_r, evec, eval );
122 double feature = eval[ 0 ] / ( eval[ 0 ] + eval[ 1 ] );
124 new CustomColors( Color::Black, colormap( feature > T ? T : feature ) ) )
132 board.
saveSVG(
"dvcm-hat-r.svg");
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Structure representing an RGB triple with alpha component.
Aim: This class provides methods to compute the eigen decomposition of a matrix. Its objective is to ...
Aim: implements separable l_p metrics with exact predicates.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Space::RealVector RealVector
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Aim: Implements method to read a set of points represented in each line of a file.
int main(int argc, char **argv)
void draw(const Iterator &itb, const Iterator &ite, Board &aBoard)
HyperRectDomain< Space > Domain
PointVector< 3, double > RealPoint