A simple example to show how to extract the set of boundary contours obtained from the image level set. This programm outputs this image:
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/io/readers/PGMReader.h"
#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
#include "DGtal/topology/helpers/Surfaces.h"
#include "DGtal/geometry/curves/FreemanChain.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/io/colormaps/GradientColorMap.h"
#include "DGtal/io/Color.h"
{
std::string filename = examplesPath + "samples/circleR10modif.pgm";
ks.
init( image.domain().lowerBound(), image.domain().upperBound(), true );
aBoard << set2d;
aBoard << image.domain();
std::vector< std::vector< Z2i::Point > > vectContoursBdryPointels;
ks, set2d, sAdj );
cmap_grad.addColor(
Color( 255, 0, 0 ) );
cmap_grad.addColor(
Color( 255, 255, 10 ) );
cmap_grad.addColor(
Color( 25, 255, 255 ) );
cmap_grad.addColor(
Color( 255, 25, 255 ) );
cmap_grad.addColor(
Color( 25, 25, 25 ) );
for(unsigned int i=0; i<vectContoursBdryPointels.size(); i++){
aBoard <<
SetMode( fc.className(),
"InterGrid" );
aBoard << fc;
}
aBoard.
saveEPS(
"freemanChainFromImage.eps");
return 0;
}