42#include <visp3/core/vpCameraParameters.h>
43#include <visp3/core/vpConfig.h>
44#include <visp3/core/vpHomogeneousMatrix.h>
45#include <visp3/core/vpImage.h>
46#include <visp3/core/vpIoTools.h>
47#include <visp3/core/vpMath.h>
48#include <visp3/gui/vpDisplayFactory.h>
49#include <visp3/io/vpImageIo.h>
50#include <visp3/io/vpParseArgv.h>
51#include <visp3/robot/vpWireFrameSimulator.h>
53#define GETOPTARGS "cdh"
55#ifdef VISP_HAVE_DISPLAY
57#ifdef ENABLE_VISP_NAMESPACE
61void usage(
const char *name,
const char *badparam);
62bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click);
72void usage(
const char *name,
const char *badparam)
75Demonstration of the wireframe simulator.\n\
77The goal of this example is to present the basic functionalities of the wire frame simulator.\n\
86 Disable mouse click.\n\
89 Turn off the display.\n\
95 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
110bool getOptions(
int argc,
const char **argv,
bool &display,
bool &click)
124 usage(argv[0],
nullptr);
128 usage(argv[0], optarg_);
133 if ((c == 1) || (c == -1)) {
135 usage(argv[0],
nullptr);
136 std::cerr <<
"ERROR: " << std::endl;
137 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
144int main(
int argc,
const char **argv)
146 const unsigned int NB_DISPLAYS = 3;
147#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
148 std::shared_ptr<vpDisplay> display[NB_DISPLAYS];
151 for (
unsigned int i = 0;
i < NB_DISPLAYS; ++
i) {
152 display[
i] =
nullptr;
156 bool opt_display =
true;
157 bool opt_click =
true;
160 if (getOptions(argc, argv, opt_display, opt_click) ==
false) {
177#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
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 "
341#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
342 for (
unsigned int i = 0;
i < NB_DISPLAYS; ++
i) {
343 if (display[i] !=
nullptr) {
351 std::cout <<
"Catch an exception: " <<
e << std::endl;
352#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
353 for (
unsigned int i = 0;
i < NB_DISPLAYS; ++
i) {
354 if (display[i] !=
nullptr) {
365 std::cout <<
"You do not have X11, or GDI (Graphical Device Interface), or GTK functionalities to display images..."
367 std::cout <<
"Tip if you are on a unix-like system:" << std::endl;
368 std::cout <<
"- Install X11, configure again ViSP using cmake and build again this example" << std::endl;
369 std::cout <<
"Tip if you are on a windows-like system:" << std::endl;
370 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
Class that defines generic functionalities for display.
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.
Definition of the vpImage class member functions.
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)
std::shared_ptr< vpDisplay > createDisplay()
Return a smart pointer vpDisplay specialization if a GUI library is available or nullptr otherwise.
vpDisplay * allocateDisplay()
Return a newly allocated vpDisplay specialization if a GUI library is available or nullptr otherwise.