DGtal  1.3.beta
Typedefs | Functions
fullConvexityCollapsiblePoints2D.cpp File Reference
#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"
Include dependency graph for fullConvexityCollapsiblePoints2D.cpp:

Go to the source code of this file.

Typedefs

typedef DigitalConvexity< KSpaceDConv
 
typedef Shortcuts< KSpaceSH2
 
typedef NeighborhoodConvexityAnalyzer< KSpace, 1 > NCA1
 

Functions

int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Jacques-Olivier Lachaud (jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr ) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
Date
2021/06/22

An example file named fullConvexityCollapsiblePoints2D.

This file is part of the DGtal library.

Definition in file fullConvexityCollapsiblePoints2D.cpp.

Typedef Documentation

◆ DConv

◆ NCA1

◆ SH2

typedef Shortcuts<KSpace> SH2

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file fullConvexityCollapsiblePoints2D.cpp.

62 {
63  double noise = argc > 1 ? atof( argv[ 1 ] ) : 0.1;
64  auto params = SH2::defaultParameters();
65  params( "noise", noise )( "thresholdMin", 128 );
66  auto g_image = SH2::makeGrayScaleImage( examplesPath + "samples/contourS.pgm" );
67  auto b_image = SH2::makeBinaryImage ( g_image, params );
68  Board2D board;
69  Domain image_domain = b_image->domain();
70  NCA1 nca1( image_domain.lowerBound(), image_domain.upperBound() );
71  for ( auto p : image_domain )
72  {
73  nca1.setCenter( p, (*b_image) );
74  bool simple = nca1.isFullyConvexCollapsible();
75  if ( (*b_image)( p ) )
76  board << CustomStyle( p.className(),
77  simple
78  ? new CustomColors( Color( 0, 0, 0 ),
79  Color( 10, 255, 10 ) )
80  : new CustomColors( Color( 0, 0, 0 ),
81  Color( 255, 10, 10 ) ) );
82  else
83  board << CustomStyle( p.className(),
84  simple
85  ? new CustomColors( Color( 0, 0, 0 ),
86  Color( 180, 255, 180 ) )
87  : new CustomColors( Color( 0, 0, 0 ),
88  Color( 255, 180, 180 ) ) );
89  board << p;
90  }
91  board.saveEPS( "contour-fcvx-collapsible.eps" );
92  return 0;
93 }

References DGtal::NeighborhoodConvexityAnalyzer< TKSpace, K >::isFullyConvexCollapsible(), DGtal::HyperRectDomain< TSpace >::lowerBound(), LibBoard::Board::saveEPS(), DGtal::NeighborhoodConvexityAnalyzer< TKSpace, K >::setCenter(), and DGtal::HyperRectDomain< TSpace >::upperBound().

DGtal::HyperRectDomain< Space >
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition: Color.h:67
DGtal::HyperRectDomain::upperBound
const Point & upperBound() const
DGtal::CustomStyle
Definition: Board2D.h:217
DGtal::CustomColors
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Definition: Board2D.h:278
DGtal::NeighborhoodConvexityAnalyzer
Aim: A class that models a neighborhood and that provides services to analyse the convexity properti...
Definition: NeighborhoodConvexityAnalyzer.h:94
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70
LibBoard::Board::saveEPS
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:805
DGtal::HyperRectDomain::lowerBound
const Point & lowerBound() const