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
- Isabelle Sivignon (
isabe.nosp@m.lle..nosp@m.sivig.nosp@m.non@.nosp@m.gipsa.nosp@m.-lab.nosp@m..gren.nosp@m.oble.nosp@m.-inp..nosp@m.fr
) gipsa-lab Grenoble Images Parole Signal Automatique (CNRS, UMR 5216), CNRS, France
- Date
- 2012/03/26
An example file named exampleFrechetShortcut.
This file is part of the DGtal library.
Definition in file exampleFrechetShortcut.cpp.
int main |
( |
int | argc, |
|
|
char ** | argv ) |
[FrechetShortcutUsage]
[FrechetShortcutUsage]
Definition at line 59 of file exampleFrechetShortcut.cpp.
60{
61 trace.beginBlock (
"Example FrechetShortcut" );
62 trace.info() <<
"Args:";
63 for ( int i = 0; i < argc; ++i )
64 trace.info() <<
" " << argv[ i ];
66
67 std::string filename;
69
70 if(argc == 1)
71 {
72 trace.info() <<
"Use default file and error value\n";
73 filename = examplesPath + "samples/plant-frechet.dat";
75 }
76 else
77 if(argc != 3)
78 {
79 trace.info() <<
"Please enter a filename and error value.\n";
80 return 0;
81 }
82 else
83 {
84 filename = argv[1];
85 error = atof(argv[2]);
86 }
87 ifstream instream;
88 instream.open (filename.c_str(), ifstream::in);
89
90
91
94
96
97
99
100 trace.beginBlock(
"Simple example");
101
104
106
107
108 Shortcut s(error);
109
111 while ( ( s.end() != r.
end() )
112 &&( s.extendFront() ) ) {}
113
114
115
116
117
119
121
122
123 Segmentation::SegmentComputerIterator it = theSegmentation.begin();
124 Segmentation::SegmentComputerIterator itEnd = theSegmentation.end();
125
126 for ( ; it != itEnd; ++it) {
127 s=Shortcut(*it);
128 trace.info() << s << std::endl;
129 board << s;
130 }
131
132 board.
saveEPS(
"FrechetShortcutExample.eps", Board2D::BoundingBox, 5000 );
133
135 #ifdef DGTAL_WITH_CAIRO
136 board.
saveCairo(
"FrechetShortcutExample.png");
137 #endif
138
139
141 return 0;
142}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
ConstIterator begin() const
ConstIterator end() const
Aim: On-line computation Computation of the longest shortcut according to the Fréchet distance for a ...
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators....
bool initFromVectorStream(std::istream &in)
PointsRange getPointsRange() const
ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToPoint< KSpace >, Point > PointsRange
ArrowsRange getArrowsRange() const
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
SaturatedSegmentation< SegmentComputer > Segmentation
References DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::begin(), DGtal::SaturatedSegmentation< TSegmentComputer >::begin(), LibBoard::Board::BoundingBox, DGtal::ConstRangeAdapter< TIterator, TFunctor, TReturnType >::end(), DGtal::SaturatedSegmentation< TSegmentComputer >::end(), DGtal::GridCurve< TKSpace >::getArrowsRange(), DGtal::GridCurve< TKSpace >::getPointsRange(), DGtal::GridCurve< TKSpace >::initFromVectorStream(), LibBoard::Board::saveCairo(), LibBoard::Board::saveEPS(), and DGtal::trace.