54 #include <visp/vpImage.h>
55 #include <visp/vpImageIo.h>
56 #include <visp/vpDisplayOpenCV.h>
57 #include <visp/vpDisplayX.h>
58 #include <visp/vpDisplayGTK.h>
59 #include <visp/vpDisplayGDI.h>
60 #include <visp/vpDisplayD3D.h>
61 #include <visp/vpCameraParameters.h>
63 #include <visp/vpMath.h>
64 #include <visp/vpHomogeneousMatrix.h>
65 #include <visp/vpParseArgv.h>
66 #include <visp/vpIoTools.h>
67 #include <visp/vpWireFrameSimulator.h>
70 #define GETOPTARGS "cdh"
72 #if (defined (VISP_HAVE_X11) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK))
82 void usage(
const char *name,
const char *badparam)
85 Demonstration of the wireframe simulator.\n\
87 The goal of this example is to present the basic functionalities of the wire frame simulator.\n\
90 %s [-c] [-d] [-h]\n", name);
95 Disable mouse click.\n\
98 Turn off the display.\n\
104 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
120 bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click)
127 case 'c': click =
false;
break;
128 case 'd': display =
false;
break;
129 case 'h': usage(argv[0], NULL);
return false;
break;
132 usage(argv[0], optarg);
137 if ((c == 1) || (c == -1)) {
139 usage(argv[0], NULL);
140 std::cerr <<
"ERROR: " << std::endl;
141 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
150 main(
int argc,
const char ** argv)
152 bool opt_display =
true;
153 bool opt_click =
true;
156 if (getOptions(argc, argv, opt_display, opt_click) ==
false) {
171 #if defined VISP_HAVE_X11
173 #elif defined VISP_HAVE_OPENCV
175 #elif defined VISP_HAVE_GDI
177 #elif defined VISP_HAVE_D3D9
179 #elif defined VISP_HAVE_GTK
188 display[0].
init(Iint, 100, 100,
"The internal view") ;
189 display[1].
init(Iext1, 100, 100,
"The first external view") ;
190 display[2].
init(Iext2, 100, 100,
"The second external view") ;
273 std::cout << std::endl;
274 std::cout <<
"Here are presented the effect of the basic functions of the simulator" << std::endl;
275 std::cout << std::endl;
280 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;
312 std::cout << std::endl;
316 std::cout <<
"Click on the internal view window to continue" << std::endl;
320 std::cout << std::endl;
321 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;
322 std::cout << std::endl;
323 std::cout <<
"Click on the internal view window when you are finished" << std::endl;
328 if (opt_display && opt_click)
338 std::cout << std::endl;
339 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;
346 vpERROR_TRACE(
"You do not have X11, OpenCV, GDI, D3D9 or GTK display functionalities...");
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Display for windows using GDI (available on any windows 32 platform).
Define the X11 console to display images.
void setDesiredViewColor(const vpColor col)
void setCameraPositionRelObj(const vpHomogeneousMatrix cMo)
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
void setCurrentViewColor(const vpColor col)
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.
void setExternalCameraPosition(const vpHomogeneousMatrix camMf)
virtual void setWindowPosition(int winx, int winy)=0
void getInternalImage(vpImage< vpRGBa > &I)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the opencv library.
Generic class defining intrinsic camera parameters.
The vpDisplayGTK allows to display image using the GTK+ library version 1.2.
void setDesiredCameraPosition(const vpHomogeneousMatrix cdMo)
Implementation of a wire frame simulator. Compared to the vpSimulator class, it does not require thir...
static double rad(double deg)
void initScene(vpSceneObject obj, vpSceneDesiredObject desiredObject)
void setCameraColor(const vpColor col)
void setInternalCameraParameters(const vpCameraParameters cam)
virtual bool getClick(bool blocking=true)=0
void getExternalImage(vpImage< vpRGBa > &I)
void setExternalCameraParameters(const vpCameraParameters cam)
void set_fMo(const vpHomogeneousMatrix &fMo)
static const vpColor blue