37 #include "DGtal/base/Common.h"
38 #include "DGtal/helpers/StdDefs.h"
39 #include "DGtal/io/colormaps/GrayscaleColorMap.h"
40 #include "DGtal/io/colormaps/HueShadeColorMap.h"
41 #include "DGtal/io/boards/Board2D.h"
42 #include "DGtal/images/ImageSelector.h"
43 #include "DGtal/images/imagesSetsUtils/SimpleThresholdForegroundPredicate.h"
44 #include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
48 using namespace DGtal;
59 template<
typename Image>
60 void randomSeeds(
Image &image,
const unsigned int nb,
const int value)
67 for (
unsigned int k = 0 ; k < nb; k++)
69 for (
unsigned int dim = 0; dim < Image::dimension; dim++)
70 p[dim] = rand() % (ext[dim]) + low[dim];
89 for (
Image::Iterator it = image.begin(), itend = image.end();it != itend; ++it)
92 randomSeeds(image,16,0);
105 Display2DFactory::drawImage<Gray>(board, image, (
unsigned int)0, (
unsigned int)129);
106 board.saveSVG(
"inputShape.svg");
111 PointPredicate predicate(image,0);
120 DTL2 dtL2( image.domain(), predicate );
121 DTLInf dtLinf(image.domain(), predicate );
122 DTL1 dtL1(image.domain(), predicate );
124 DTL2::OutputImage resultL2 = dtL2.
compute ( );
125 DTLInf::OutputImage resultLinf = dtLinf.compute ( );
126 DTL1::OutputImage resultL1 = dtL1.compute ( );
132 for ( DTLInf::OutputImage::ConstIterator it = resultLinf.begin(), itend = resultLinf.end();it != itend; ++it)
137 for ( DTL2::OutputImage::ConstIterator it = resultL2.begin(), itend = resultL2.end();it != itend; ++it)
142 for ( DTL1::OutputImage::ConstIterator it = resultL1.begin(), itend = resultL1.end();it != itend; ++it)
146 trace.
warning() << resultL2 <<
" maxValue= "<<maxv2<< endl;
148 Display2DFactory::drawImage<HueTwice>(board, resultL2, (
DGtal::int64_t)0, maxv2 + 1);
149 board.saveSVG (
"example-DT-L2.svg" );
151 trace.
warning() << resultL1 <<
" maxValue= "<<maxv1<< endl;
153 Display2DFactory::drawImage<HueTwice>(board, resultL1, (
DGtal::int64_t)0, maxv1 + 1);
154 board.saveSVG (
"example-DT-L1.svg" );
156 trace.
warning() << resultLinf <<
" maxValue= "<<maxv<< endl;
158 Display2DFactory::drawImage<HueTwice>(board, resultLinf, (
DGtal::int64_t)0, maxv + 1);
159 board.saveSVG (
"example-DT-Linf.svg" );
163 for (
unsigned int j=0;j<33;j++)
165 for(
unsigned int i=0; i<33; i++)