50 #include <visp/vpCameraParameters.h>
51 #include <visp/vpDisplayOpenCV.h>
52 #include <visp/vpDisplayX.h>
53 #include <visp/vpDisplayGTK.h>
54 #include <visp/vpDisplayGDI.h>
55 #include <visp/vpDisplayD3D.h>
56 #include <visp/vpHomogeneousMatrix.h>
57 #include <visp/vpImage.h>
58 #include <visp/vpImageIo.h>
59 #include <visp/vpIoTools.h>
60 #include <visp/vpMath.h>
61 #include <visp/vpParseArgv.h>
62 #include <visp/vpWireFrameSimulator.h>
64 #define GETOPTARGS "cdh"
66 #ifdef VISP_HAVE_DISPLAY
68 void usage(
const char *name,
const char *badparam);
69 bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click);
79 void usage(
const char *name,
const char *badparam)
82 Demonstration of the wireframe simulator.\n\
84 The goal of this example is to present the basic functionalities of the wire frame simulator.\n\
87 %s [-c] [-d] [-h]\n", name);
92 Disable mouse click.\n\
95 Turn off the display.\n\
101 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
117 bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click)
124 case 'c': click =
false;
break;
125 case 'd': display =
false;
break;
126 case 'h': usage(argv[0], NULL);
return false;
break;
129 usage(argv[0], optarg_);
134 if ((c == 1) || (c == -1)) {
136 usage(argv[0], NULL);
137 std::cerr <<
"ERROR: " << std::endl;
138 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
147 main(
int argc,
const char ** argv)
150 bool opt_display =
true;
151 bool opt_click =
true;
154 if (getOptions(argc, argv, opt_display, opt_click) ==
false) {
169 #if defined VISP_HAVE_X11
171 #elif defined VISP_HAVE_OPENCV
173 #elif defined VISP_HAVE_GDI
175 #elif defined VISP_HAVE_D3D9
177 #elif defined VISP_HAVE_GTK
183 display[0].
init(Iint, 100, 100,
"The internal view") ;
184 display[1].
init(Iext1, 100, 100,
"The first external view") ;
185 display[2].
init(Iext2, 100, 100,
"The second external view") ;
262 std::cout << std::endl;
263 std::cout <<
"Here are presented the effect of the basic functions of the simulator" << std::endl;
264 std::cout << std::endl;
269 std::cout <<
"Click on the internal view window to continue. the object will move. The external cameras are fixed. The main camera moves too because the homogeneous matrix cMo didn't change." << std::endl;
301 std::cout << std::endl;
305 std::cout <<
"Click on the internal view window to continue" << std::endl;
309 std::cout << std::endl;
310 std::cout <<
"Now you can move the main external camera. Click inside the corresponding window with one of the three buttons of your mouse and move the pointer." << std::endl;
311 std::cout << std::endl;
312 std::cout <<
"Click on the internal view window when you are finished" << std::endl;
317 if (opt_display && opt_click)
327 std::cout << std::endl;
328 std::cout <<
"You have seen the main capabilities of the simulator. Other specific functionalities are available. Please refers to the html documentation to access the list of all functions" << std::endl;
332 std::cout <<
"Catch an exception: " << e << std::endl;
340 vpERROR_TRACE(
"You do not have X11, OpenCV, GDI, D3D9 or GTK display functionalities...");
The object displayed at the desired position is the same than the scene object defined in vpSceneObje...
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
void setCameraColor(const vpColor &col)
void setDesiredViewColor(const vpColor &col)
A 40cm by 40cm plate with 4 points at coordinates (-0.1,-0.1,0), (0.1,-0.1,0), (0.1,0.1,0), (0.1,0.1,0). Each point is represented by a circle with 2cm radius.
void set_fMo(const vpHomogeneousMatrix &fMo_)
Display for windows using GDI (available on any windows 32 platform).
Define the X11 console to display images.
error that can be emited by ViSP classes.
void setCurrentViewColor(const vpColor &col)
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
void setExternalCameraPosition(const vpHomogeneousMatrix &cam_Mf)
void setDesiredCameraPosition(const vpHomogeneousMatrix &cdMo_)
static const vpColor green
static void flush(const vpImage< unsigned char > &I)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Display for windows using Direct3D.
virtual void setWindowPosition(int winx, int winy)=0
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the opencv library.
Generic class defining intrinsic camera parameters.
void initScene(const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject)
The vpDisplayGTK allows to display image using the GTK+ library version 1.2.
void getExternalImage(vpImage< unsigned char > &I)
Implementation of a wire frame simulator. Compared to the vpSimulator class, it does not require thir...
static double rad(double deg)
void setExternalCameraParameters(const vpCameraParameters &cam)
void setCameraPositionRelObj(const vpHomogeneousMatrix &cMo_)
void getInternalImage(vpImage< unsigned char > &I)
void setInternalCameraParameters(const vpCameraParameters &cam)
virtual bool getClick(bool blocking=true)=0
static const vpColor blue