A simple example illustrating the filling of the interior/exterior of a given 2D contour. This program outputs these images:
#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/topology/helpers/Surfaces.h"
#include "DGtal/topology/SurfelSetPredicate.h"
#include "DGtal/geometry/curves/FreemanChain.h"
#include "DGtal/io/boards/Board2D.h"
{
trace.
beginBlock (
"Example ctopo-fillContours" );
FreemanChain<int> fc1 (
"001001001001001111101111011222222223222222322233333330301033333003", 6, 14);
aBoard <<
K.lowerBound() <<
K.upperBound() ;
aBoard2 <<
K.lowerBound() <<
K.upperBound() ;
std::set<DGtal::KhalimskySpaceND< 2, int >::SCell> boundarySCell;
it!= boundarySCell.end(); it++){
aBoard << *it;
}
std::set<DGtal::KhalimskySpaceND< 2, int >::SCell> boundarySCellhole;
aBoard << *it;
aBoard2 << *it;
}
BoolImage2D interiorCellImage( imageDomain );
interiorCellImage, 1, false);
for(BoolImage2D::Domain::ConstIterator it = interiorCellImage.domain().begin();
it!=interiorCellImage.domain().end(); it++){
if(interiorCellImage(*it)){
}
}
BoolImage2D interiorCellHoleImage( imageDomain );
BoolImage2D exteriorCellHoleImage( imageDomain );
interiorCellHoleImage, 1, true);
exteriorCellHoleImage, 1, false);
for(BoolImage2D::Domain::ConstIterator it = interiorCellHoleImage.domain().begin();
it!=interiorCellHoleImage.domain().end(); it++){
if(interiorCellHoleImage(*it)){
}
}
for(BoolImage2D::Domain::ConstIterator it = exteriorCellHoleImage.domain().begin();
it!=exteriorCellHoleImage.domain().end(); it++){
if(exteriorCellHoleImage(*it)){
}
}
aBoard.
saveEPS(
"example_ctopo-fillContours.eps");
aBoard.
saveFIG(
"example_ctopo-fillContours.fig");
aBoard2.
saveEPS(
"example_ctopo-fillContours2.eps");
aBoard2.
saveFIG(
"example_ctopo-fillContours2.fig");
return 0;
}
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 is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
void beginBlock(const std::string &keyword="")
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
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 ...
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: The predicate returning true iff the point is in the domain given at construction.
ShapeList & insert(const Shape &shape, int depth)