47 #include <visp3/core/vpCameraParameters.h> 48 #include <visp3/core/vpHomogeneousMatrix.h> 49 #include <visp3/core/vpImage.h> 50 #include <visp3/core/vpIoTools.h> 51 #include <visp3/core/vpMath.h> 52 #include <visp3/gui/vpDisplayD3D.h> 53 #include <visp3/gui/vpDisplayGDI.h> 54 #include <visp3/gui/vpDisplayGTK.h> 55 #include <visp3/gui/vpDisplayOpenCV.h> 56 #include <visp3/gui/vpDisplayX.h> 57 #include <visp3/io/vpImageIo.h> 58 #include <visp3/io/vpParseArgv.h> 59 #include <visp3/robot/vpWireFrameSimulator.h> 61 #define GETOPTARGS "cdh" 63 #ifdef VISP_HAVE_DISPLAY 65 void usage(
const char *name,
const char *badparam);
66 bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click);
76 void usage(
const char *name,
const char *badparam)
79 Demonstration of the wireframe simulator.\n\ 81 The goal of this example is to present the basic functionalities of the wire frame simulator.\n\ 84 %s [-c] [-d] [-h]\n", name);
89 Disable mouse click.\n\ 92 Turn off the display.\n\ 98 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
113 bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click)
127 usage(argv[0], NULL);
132 usage(argv[0], optarg_);
138 if ((c == 1) || (c == -1)) {
140 usage(argv[0], NULL);
141 std::cerr <<
"ERROR: " << std::endl;
142 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
149 int 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 185 display[0].
init(Iint, 100, 100,
"The internal view");
186 display[1].
init(Iext1, 100, 100,
"The first external view");
187 display[2].
init(Iext2, 100, 100,
"The second external view");
268 std::cout << std::endl;
269 std::cout <<
"Here are presented the effect of the basic functions of " 272 std::cout << std::endl;
276 std::cout <<
"Click on the internal view window to continue. the " 277 "object will move. The external cameras are fixed. The " 278 "main camera moves too because the homogeneous matrix " 309 std::cout << std::endl;
312 std::cout <<
"Click on the internal view window to continue" << std::endl;
316 std::cout << std::endl;
317 std::cout <<
"Now you can move the main external camera. Click inside " 318 "the corresponding window with one of the three buttons of " 319 "your mouse and move the pointer." 321 std::cout << std::endl;
322 std::cout <<
"Click on the internal view window when you are finished" << std::endl;
329 if (opt_display && opt_click) {
337 std::cout << std::endl;
338 std::cout <<
"You have seen the main capabilities of the simulator. " 339 "Other specific functionalities are available. Please " 340 "refers to the html documentation to access the list of all " 345 std::cout <<
"Catch an exception: " << e << std::endl;
352 std::cout <<
"You do not have X11, or GDI (Graphical Device Interface), or GTK functionalities to display images..." << std::endl;
353 std::cout <<
"Tip if you are on a unix-like system:" << std::endl;
354 std::cout <<
"- Install X11, configure again ViSP using cmake and build again this example" << std::endl;
355 std::cout <<
"Tip if you are on a windows-like system:" << std::endl;
356 std::cout <<
"- Install GDI, configure again ViSP using cmake and build again this example" << std::endl;
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setCameraColor(const vpColor &col)
void setDesiredViewColor(const vpColor &col)
void set_fMo(const vpHomogeneousMatrix &fMo_)
Display for windows using GDI (available on any windows 32 platform).
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
error that can be emited by ViSP classes.
void setCurrentViewColor(const vpColor &col)
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 3rd party. Thus to enable this class Direct3D should be installed...
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Generic class defining intrinsic camera parameters.
void init(vpImage< unsigned char > &I, int win_x=-1, int win_y=-1, const std::string &win_title="")
void initScene(const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject)
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
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)
static void setWindowPosition(const vpImage< unsigned char > &I, int winx, int winy)
void setInternalCameraParameters(const vpCameraParameters &cam)
static const vpColor blue