Displays fully convex collapsible points in the given image. All these points can be safely flipped without changing the topology of the image.
#include <vector>
#include "DGtal/shapes/Shapes.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/io/Color.h"
#include "DGtal/geometry/volumes/DigitalConvexity.h"
#include "DGtal/geometry/volumes/NeighborhoodConvexityAnalyzer.h"
#include "DGtal/helpers/Shortcuts.h"
#include "ConfigExamples.h"
using namespace Z2i;
int main(
int argc,
char** argv )
{
double noise = argc > 1 ? atof( argv[ 1 ] ) : 0.1;
auto params = SH2::defaultParameters();
params( "noise", noise )( "thresholdMin", 128 );
auto g_image = SH2::makeGrayScaleImage( examplesPath + "samples/contourS.pgm" );
auto b_image = SH2::makeBinaryImage ( g_image, params );
Domain image_domain = b_image->domain();
NCA1 nca1( image_domain.lowerBound(), image_domain.upperBound() );
for ( auto p : image_domain )
{
nca1.setCenter( p, (*b_image) );
bool simple = nca1.isFullyConvexCollapsible();
if ( (*b_image)( p ) )
simple
Color( 255, 10, 10 ) ) );
else
simple
Color( 255, 180, 180 ) ) );
board << p;
}
board.
saveEPS(
"contour-fcvx-collapsible.eps" );
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: A class that models a neighborhood and that provides services to analyse the convexity properti...
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
NeighborhoodConvexityAnalyzer< KSpace, 1 > NCA1
DigitalConvexity< KSpace > DConv
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 ...
HyperRectDomain< Space > Domain