44 #include <visp3/core/vpCameraParameters.h>
45 #include <visp3/core/vpHomogeneousMatrix.h>
46 #include <visp3/core/vpImage.h>
47 #include <visp3/core/vpIoTools.h>
48 #include <visp3/core/vpMath.h>
49 #include <visp3/gui/vpDisplayD3D.h>
50 #include <visp3/gui/vpDisplayGDI.h>
51 #include <visp3/gui/vpDisplayGTK.h>
52 #include <visp3/gui/vpDisplayOpenCV.h>
53 #include <visp3/gui/vpDisplayX.h>
54 #include <visp3/io/vpImageIo.h>
55 #include <visp3/io/vpParseArgv.h>
56 #include <visp3/robot/vpWireFrameSimulator.h>
58 #define GETOPTARGS "cdh"
60 #ifdef VISP_HAVE_DISPLAY
62 void usage(
const char *name,
const char *badparam);
63 bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click);
73 void usage(
const char *name,
const char *badparam)
76 Demonstration of the wireframe simulator.\n\
78 The goal of this example is to present the basic functionalities of the wire frame simulator.\n\
87 Disable mouse click.\n\
90 Turn off the display.\n\
96 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
111 bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click)
125 usage(argv[0],
nullptr);
130 usage(argv[0], optarg_);
136 if ((c == 1) || (c == -1)) {
138 usage(argv[0],
nullptr);
139 std::cerr <<
"ERROR: " << std::endl;
140 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
147 int 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(HAVE_OPENCV_HIGHGUI)
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");
266 std::cout << std::endl;
267 std::cout <<
"Here are presented the effect of the basic functions of "
270 std::cout << std::endl;
274 std::cout <<
"Click on the internal view window to continue. the "
275 "object will move. The external cameras are fixed. The "
276 "main camera moves too because the homogeneous matrix "
307 std::cout << std::endl;
310 std::cout <<
"Click on the internal view window to continue" << std::endl;
314 std::cout << std::endl;
315 std::cout <<
"Now you can move the main external camera. Click inside "
316 "the corresponding window with one of the three buttons of "
317 "your mouse and move the pointer."
319 std::cout << std::endl;
320 std::cout <<
"Click on the internal view window when you are finished" << std::endl;
327 if (opt_display && opt_click) {
335 std::cout << std::endl;
336 std::cout <<
"You have seen the main capabilities of the simulator. "
337 "Other specific functionalities are available. Please "
338 "refers to the html documentation to access the list of all "
343 std::cout <<
"Catch an exception: " << e << std::endl;
350 std::cout <<
"You do not have X11, or GDI (Graphical Device Interface), or GTK functionalities to display images..."
352 std::cout <<
"Tip if you are on a unix-like system:" << std::endl;
353 std::cout <<
"- Install X11, configure again ViSP using cmake and build again this example" << std::endl;
354 std::cout <<
"Tip if you are on a windows-like system:" << std::endl;
355 std::cout <<
"- Install GDI, configure again ViSP using cmake and build again this example" << std::endl;
Generic class defining intrinsic camera parameters.
static const vpColor blue
static const vpColor green
Display for windows using Direct3D 3rd party. Thus to enable this class Direct3D should be installed....
Display for windows using GDI (available on any windows 32 platform).
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
static void setWindowPosition(const vpImage< unsigned char > &I, int winx, int winy)
error that can be emitted by ViSP classes.
Implementation of an homogeneous matrix and operations on such kind of matrices.
static double rad(double deg)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Implementation of a wire frame simulator. Compared to the vpSimulator class, it does not require thir...
void setCameraPositionRelObj(const vpHomogeneousMatrix &cMo_)
void getInternalImage(vpImage< unsigned char > &I)
void initScene(const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject)
void setCurrentViewColor(const vpColor &col)
void setCameraColor(const vpColor &col)
void setDesiredViewColor(const vpColor &col)
void setExternalCameraPosition(const vpHomogeneousMatrix &cam_Mf)
void set_fMo(const vpHomogeneousMatrix &fMo_)
void setDesiredCameraPosition(const vpHomogeneousMatrix &cdMo_)
void setInternalCameraParameters(const vpCameraParameters &cam)
void setExternalCameraParameters(const vpCameraParameters &cam)
void getExternalImage(vpImage< unsigned char > &I)
void display(vpImage< unsigned char > &I, const std::string &title)
Display a gray-scale image.