DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
fullConvexityCollapsiblePoints2D.cpp
Go to the documentation of this file.
1
16
29
40
#include <vector>
41
#include "DGtal/shapes/Shapes.h"
42
#include "DGtal/io/boards/Board2D.h"
43
#include "DGtal/io/Color.h"
44
#include "DGtal/geometry/volumes/DigitalConvexity.h"
45
#include "DGtal/geometry/volumes/NeighborhoodConvexityAnalyzer.h"
46
#include "DGtal/helpers/Shortcuts.h"
47
#include "ConfigExamples.h"
48
49
// Using standard 2D digital space.
51
52
using namespace
std
;
53
using namespace
DGtal
;
54
using namespace
Z2i
;
55
56
typedef
DigitalConvexity< KSpace >
DConv
;
57
typedef
Shortcuts<KSpace>
SH2
;
58
typedef
NeighborhoodConvexityAnalyzer<KSpace,1>
NCA1
;
59
61
int
main
(
int
argc,
char
** argv )
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
}
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition
Board2D.h:71
DGtal::Color::Color
Color()
Definition
Color.h:139
DGtal::DigitalConvexity< KSpace >
DGtal::NeighborhoodConvexityAnalyzer
Aim: A class that models a neighborhood and that provides services to analyse the convexity properti...
Definition
NeighborhoodConvexityAnalyzer.h:95
DGtal::NeighborhoodConvexityAnalyzer::setCenter
void setCenter(Point c, const PointPredicate &X)
DGtal::NeighborhoodConvexityAnalyzer::isFullyConvexCollapsible
bool isFullyConvexCollapsible()
Definition
NeighborhoodConvexityAnalyzer.h:243
DGtal::Shortcuts
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
Definition
Shortcuts.h:102
DGtal::Shortcuts< KSpace >::makeGrayScaleImage
static CountedPtr< GrayScaleImage > makeGrayScaleImage(Domain aDomain)
Definition
Shortcuts.h:869
DGtal::Shortcuts< KSpace >::defaultParameters
static Parameters defaultParameters()
Definition
Shortcuts.h:200
DGtal::Shortcuts< KSpace >::makeBinaryImage
static CountedPtr< BinaryImage > makeBinaryImage(Domain shapeDomain)
Definition
Shortcuts.h:558
DGtal::Domain
DGtal::VoronoiMap::domain
const Domain & domain() const
Definition
VoronoiMap.h:265
LibBoard::Board::saveEPS
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition
Board.cpp:804
NCA1
NeighborhoodConvexityAnalyzer< KSpace, 1 > NCA1
Definition
fullConvexityCollapsiblePoints2D.cpp:58
DConv
DigitalConvexity< KSpace > DConv
Definition
fullConvexityCollapsiblePoints2D.cpp:56
SH2
Shortcuts< KSpace > SH2
Definition
fullConvexityCollapsiblePoints2D.cpp:57
DGtal::Z2i
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
std
STL namespace.
DGtal::CustomColors
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Definition
Board2D.h:279
DGtal::CustomColors::CustomColors
CustomColors(const Color &penColor, const Color &fillColor)
Definition
Board2D.h:289
DGtal::CustomStyle::CustomStyle
CustomStyle(std::string classname, DrawableWithBoard2D *style)
Definition
Board2D.h:224
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
examples
geometry
volumes
fullConvexityCollapsiblePoints2D.cpp
Generated on
for DGtal by
1.18.0