46 #include <visp3/core/vpCameraParameters.h>
47 #include <visp3/gui/vpDisplayOpenCV.h>
48 #include <visp3/gui/vpDisplayX.h>
49 #include <visp3/gui/vpDisplayGTK.h>
50 #include <visp3/gui/vpDisplayGDI.h>
51 #include <visp3/gui/vpDisplayD3D.h>
52 #include <visp3/core/vpHomogeneousMatrix.h>
53 #include <visp3/core/vpImage.h>
54 #include <visp3/io/vpImageIo.h>
55 #include <visp3/core/vpIoTools.h>
56 #include <visp3/core/vpMath.h>
57 #include <visp3/io/vpParseArgv.h>
58 #include <visp3/robot/vpWireFrameSimulator.h>
60 #define GETOPTARGS "cdh"
62 #ifdef VISP_HAVE_DISPLAY
64 void usage(
const char *name,
const char *badparam);
65 bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click);
75 void usage(
const char *name,
const char *badparam)
78 Demonstration of the wireframe simulator.\n\
80 The goal of this example is to present the basic functionalities of the wire frame simulator.\n\
83 %s [-c] [-d] [-h]\n", name);
88 Disable mouse click.\n\
91 Turn off the display.\n\
97 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
113 bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click)
120 case 'c': click =
false;
break;
121 case 'd': display =
false;
break;
122 case 'h': usage(argv[0], NULL);
return false;
break;
125 usage(argv[0], optarg_);
130 if ((c == 1) || (c == -1)) {
132 usage(argv[0], NULL);
133 std::cerr <<
"ERROR: " << std::endl;
134 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
143 main(
int argc,
const char ** argv)
146 bool opt_display =
true;
147 bool opt_click =
true;
150 if (getOptions(argc, argv, opt_display, opt_click) ==
false) {
165 #if defined VISP_HAVE_X11
167 #elif defined VISP_HAVE_OPENCV
169 #elif defined VISP_HAVE_GDI
171 #elif defined VISP_HAVE_D3D9
173 #elif defined VISP_HAVE_GTK
179 display[0].
init(Iint, 100, 100,
"The internal view") ;
180 display[1].
init(Iext1, 100, 100,
"The first external view") ;
181 display[2].
init(Iext2, 100, 100,
"The second external view") ;
258 std::cout << std::endl;
259 std::cout <<
"Here are presented the effect of the basic functions of the simulator" << std::endl;
260 std::cout << std::endl;
265 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;
297 std::cout << std::endl;
301 std::cout <<
"Click on the internal view window to continue" << std::endl;
305 std::cout << std::endl;
306 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;
307 std::cout << std::endl;
308 std::cout <<
"Click on the internal view window when you are finished" << std::endl;
313 if (opt_display && opt_click)
323 std::cout << std::endl;
324 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;
328 std::cout <<
"Catch an exception: " << e << std::endl;
336 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...
Implementation of an homogeneous matrix and operations on such kind of matrices.
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