2 #include <visp3/core/vpConfig.h>
3 #include <visp3/gui/vpDisplayGDI.h>
4 #include <visp3/gui/vpDisplayOpenCV.h>
5 #include <visp3/gui/vpDisplayX.h>
6 #include <visp3/io/vpImageIo.h>
7 #include <visp3/robot/vpImageSimulator.h>
8 #include <visp3/robot/vpSimulatorCamera.h>
9 #include <visp3/visual_features/vpFeatureBuilder.h>
10 #include <visp3/vs/vpServo.h>
11 #include <visp3/vs/vpServoDisplay.h>
13 #ifdef ENABLE_VISP_NAMESPACE
36 for (
int i = 0; i < 4; i++)
57 sim_.
init(target_, X_);
70 sim_.setCleanPreviousImage(
true);
71 sim_.setCameraPosition(cMo);
72 sim_.getImage(I, cam_);
84 static std::vector<vpImagePoint> traj[4];
85 for (
unsigned int i = 0; i < 4; i++) {
86 traj[i].push_back(dot[i].getCog());
88 for (
unsigned int i = 0; i < 4; i++) {
89 for (
unsigned int j = 1; j < traj[i].size(); j++) {
97 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)
105 std::vector<vpPoint> point;
106 point.push_back(
vpPoint(-0.1, -0.1, 0));
107 point.push_back(
vpPoint(0.1, -0.1, 0));
108 point.push_back(
vpPoint(0.1, 0.1, 0));
109 point.push_back(
vpPoint(-0.1, 0.1, 0));
119 #if defined(VISP_HAVE_X11)
120 vpDisplayX d(I, 0, 0,
"Current camera view");
121 #elif defined(VISP_HAVE_GDI)
123 #elif defined(HAVE_OPENCV_HIGHGUI)
126 std::cout <<
"No image viewer is available..." << std::endl;
135 std::vector<vpDot2> dot(4);
137 for (
unsigned int i = 0; i < 4; i++) {
138 point[i].track(cdMo);
141 dot[i].setGraphics(
true);
142 dot[i].initTracking(I);
151 robot.setSamplingTime(0.040);
152 robot.getPosition(wMc);
156 robot.getPosition(wMc);
163 for (
unsigned int i = 0; i < 4; i++) {
168 point[i].changeFrame(cMo, cP);
174 display_trajectory(I, dot);
186 std::cout <<
"Catch an exception: " << e << std::endl;
Generic class defining intrinsic camera parameters.
void init()
Basic initialization with the default parameters.
Implementation of column vector and the associated operations.
static const vpColor green
Display for windows using GDI (available on any windows 32 platform).
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
static void flush(const vpImage< unsigned char > &I)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
error that can be emitted by ViSP classes.
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpImagePoint &t)
Class that defines a 2D point visual feature which is composed by two parameters that are the cartes...
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpHomogeneousMatrix inverse() const
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
Class which enables to project an image in the 3D space and get the view of a virtual camera.
unsigned int getWidth() const
unsigned int getHeight() const
static double rad(double deg)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel) VP_OVERRIDE
static void display(const vpServo &s, const vpCameraParameters &cam, const vpImage< unsigned char > &I, vpColor currentColor=vpColor::green, vpColor desiredColor=vpColor::red, unsigned int thickness=1)
void setInteractionMatrixType(const vpServoIteractionMatrixType &interactionMatrixType, const vpServoInversionType &interactionMatrixInversion=PSEUDO_INVERSE)
void addFeature(vpBasicFeature &s_cur, vpBasicFeature &s_star, unsigned int select=vpBasicFeature::FEATURE_ALL)
void setServo(const vpServoType &servo_type)
vpColVector computeControlLaw()
Class that defines the simplest robot: a free flying camera.
vpVirtualGrabber(const std::string &filename, const vpCameraParameters &cam)
void acquire(vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
VISP_EXPORT int wait(double t0, double t)