This example outputs a greedy segmentation of an open and 6-connected 3d digital curve into DSSs.
#include <iostream>
#include "DGtal/io/viewers/Viewer3D.h"
#ifdef WITH_CAIRO
#include "DGtal/io/boards/Board3DTo2D.h"
#endif
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/readers/PointListReader.h"
#include "DGtal/io/CDrawableWithDisplay3D.h"
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/geometry/curves/StandardDSS6Computer.h"
#include "DGtal/geometry/curves/GreedySegmentation.h"
using namespace Z3i;
int main(
int argc,
char** argv )
{
typedef std::vector<Point>::iterator Iterator;
string inputFilename = examplesPath + "samples/sinus.dat";
Decomposition theDecomposition(sequence.begin(), sequence.end(), algo);
bool flag = true;
#ifdef WITH_VISU3D_QGLVIEWER
QApplication application(argc,argv);
#endif
#ifdef WITH_CAIRO
boardViewer <<
SetMode3D(p.className(),
"Grid");
#endif
unsigned int c = 0;
Decomposition::SegmentComputerIterator i = theDecomposition.begin();
for ( ; i != theDecomposition.end(); ++i) {
#ifdef WITH_VISU3D_QGLVIEWER
viewer <<
SetMode3D(currentSegmentComputer.className(),
"Points");
viewer << currentSegmentComputer;
viewer <<
SetMode3D(currentSegmentComputer.className(),
"BoundingBox");
viewer << currentSegmentComputer;
#endif
#ifdef WITH_CAIRO
boardViewer <<
SetMode3D(currentSegmentComputer.className(),
"Points");
boardViewer << currentSegmentComputer;
boardViewer <<
SetMode3D(currentSegmentComputer.className(),
"BoundingBox");
boardViewer << currentSegmentComputer;
#endif
c++;
}
#ifdef WITH_VISU3D_QGLVIEWER
viewer << Viewer3D<>::updateDisplay;
flag = application.exec();
#endif
#ifdef WITH_CAIRO
#endif
return flag;
}
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
void saveCairo(const char *filename, CairoType type, int bWidth, int bHeight)
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators....
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
DGtal is the top-level namespace which contains all DGtal functions and types.
CameraDirection class to set camera direction.
CameraPosition class to set camera position.
CameraUpVector class to set camera up-vector.
CameraZNearFar class to set near and far distance.
Aim: Implements method to read a set of points represented in each line of a file.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer