ViSP  2.8.0
vpWireFrameSimulator Class Reference

#include <vpWireFrameSimulator.h>

+ Inheritance diagram for vpWireFrameSimulator:

Public Types

enum  vpSceneObject {
  THREE_PTS, CUBE, PLATE, SMALL_PLATE,
  RECTANGLE, SQUARE_10CM, DIAMOND, TRAPEZOID,
  THREE_LINES, ROAD, TIRE, PIPE,
  CIRCLE, SPHERE, CYLINDER, PLAN,
  POINT_CLOUD
}
 
enum  vpSceneDesiredObject { D_STANDARD, D_CIRCLE, D_TOOL }
 
enum  vpCameraTrajectoryDisplayType { CT_LINE, CT_POINT }
 

Public Member Functions

 vpWireFrameSimulator ()
 
virtual ~vpWireFrameSimulator ()
 
void deleteCameraPositionHistory ()
 
void displayTrajectory (const vpImage< unsigned char > &I, const std::list< vpHomogeneousMatrix > &list_cMo, const std::list< vpHomogeneousMatrix > &list_fMo, const vpHomogeneousMatrix &camMf)
 
void displayTrajectory (const vpImage< vpRGBa > &I, const std::list< vpHomogeneousMatrix > &list_cMo, const std::list< vpHomogeneousMatrix > &list_fMo, const vpHomogeneousMatrix &camMf)
 
vpCameraParameters getExternalCameraParameters (const vpImage< unsigned char > &I) const
 
vpCameraParameters getExternalCameraParameters (const vpImage< vpRGBa > &I) const
 
vpHomogeneousMatrix getExternalCameraPosition () const
 
void getExternalImage (vpImage< unsigned char > &I)
 
void getExternalImage (vpImage< unsigned char > &I, const vpHomogeneousMatrix &camMf)
 
void getExternalImage (vpImage< vpRGBa > &I)
 
void getExternalImage (vpImage< vpRGBa > &I, const vpHomogeneousMatrix &camMf)
 
vpCameraParameters getInternalCameraParameters (const vpImage< unsigned char > &I) const
 
vpCameraParameters getInternalCameraParameters (const vpImage< vpRGBa > &I) const
 
void getInternalImage (vpImage< unsigned char > &I)
 
void getInternalImage (vpImage< vpRGBa > &I)
 
vpHomogeneousMatrix get_cMo () const
 
void get_cMo_History (std::list< vpHomogeneousMatrix > &cMo_history)
 
vpHomogeneousMatrix get_fMo () const
 
void get_fMo_History (std::list< vpHomogeneousMatrix > &fMo_history)
 
void initScene (const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject)
 
void initScene (const char *obj, const char *desiredObject)
 
void initScene (const vpSceneObject &obj)
 
void initScene (const char *obj)
 
void initScene (const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject, const std::list< vpImageSimulator > &imObj)
 
void initScene (const char *obj, const char *desiredObject, const std::list< vpImageSimulator > &imObj)
 
void initScene (const vpSceneObject &obj, const std::list< vpImageSimulator > &imObj)
 
void initScene (const char *obj, const std::list< vpImageSimulator > &imObj)
 
void setCameraColor (const vpColor &col)
 
void setCameraPositionRelObj (const vpHomogeneousMatrix &cMo)
 
void setCameraPositionRelWorld (const vpHomogeneousMatrix &fMc)
 
void setCameraSizeFactor (const float factor)
 
void setCameraTrajectoryColor (const vpColor &col)
 
void setCameraTrajectoryDisplayType (const vpCameraTrajectoryDisplayType &camTrajType)
 
void setCurrentViewColor (const vpColor &col)
 
void setDesiredCameraPosition (const vpHomogeneousMatrix &cdMo)
 
void setDesiredViewColor (const vpColor &col)
 
void setDisplayCameraTrajectory (const bool &displayCameraTrajectory)
 
void setExternalCameraParameters (const vpCameraParameters &cam)
 
void setExternalCameraPosition (const vpHomogeneousMatrix &camMf)
 
void setGraphicsThickness (unsigned int thickness)
 
void setInternalCameraParameters (const vpCameraParameters &cam)
 
void setNbPtTrajectory (const unsigned int nbPt)
 
void set_fMo (const vpHomogeneousMatrix &fMo)
 
Deprecated functions
vp_deprecated void displayTrajectory (const vpImage< unsigned char > &I, vpList< vpHomogeneousMatrix > &list_cMo, vpList< vpHomogeneousMatrix > &list_fMo, vpHomogeneousMatrix camMf)
 
vp_deprecated void displayTrajectory (const vpImage< vpRGBa > &I, vpList< vpHomogeneousMatrix > &list_cMo, vpList< vpHomogeneousMatrix > &list_fMo, vpHomogeneousMatrix camMf)
 
vp_deprecated vpList< vpHomogeneousMatrixget_cMo_History ()
 
vp_deprecated vpList< vpHomogeneousMatrixget_fMo_History ()
 
vp_deprecated void initScene (vpSceneObject obj, vpSceneDesiredObject desiredObject, vpList< vpImageSimulator > &imObj)
 
vp_deprecated void initScene (const char *obj, const char *desiredObject, vpList< vpImageSimulator > &imObj)
 
vp_deprecated void initScene (vpSceneObject obj, vpList< vpImageSimulator > &imObj)
 
vp_deprecated void initScene (const char *obj, vpList< vpImageSimulator > &imObj)
 

Protected Member Functions

void display_scene (Matrix mat, Bound_scene &sc, const vpImage< vpRGBa > &I, const vpColor &color)
 
void display_scene (Matrix mat, Bound_scene &sc, const vpImage< unsigned char > &I, const vpColor &color)
 
vpHomogeneousMatrix navigation (const vpImage< vpRGBa > &I, bool &changed)
 
vpHomogeneousMatrix navigation (const vpImage< unsigned char > &I, bool &changed)
 
vpImagePoint projectCameraTrajectory (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo)
 
vpImagePoint projectCameraTrajectory (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo)
 
vpImagePoint projectCameraTrajectory (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo, const vpHomogeneousMatrix &cMf)
 
vpImagePoint projectCameraTrajectory (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo, const vpHomogeneousMatrix &cMf)
 

Protected Attributes

Bound_scene scene
 
Bound_scene desiredScene
 
Bound_scene camera
 
std::list< vpImageSimulatorobjectImage
 
vpHomogeneousMatrix fMo
 
vpHomogeneousMatrix fMc
 
vpHomogeneousMatrix camMf
 
vpHomogeneousMatrix refMo
 
vpHomogeneousMatrix cMo
 
vpHomogeneousMatrix cdMo
 
vpSceneObject object
 
vpSceneDesiredObject desiredObject
 
vpColor camColor
 
vpColor camTrajColor
 
vpColor curColor
 
vpColor desColor
 
bool sceneInitialized
 
bool displayCameraTrajectory
 
std::list< vpImagePointcameraTrajectory
 
std::list< vpHomogeneousMatrixposeList
 
std::list< vpHomogeneousMatrixfMoList
 
unsigned int nbrPtLimit
 
vpImagePoint old_iPr
 
vpImagePoint old_iPz
 
vpImagePoint old_iPt
 
bool blockedr
 
bool blockedz
 
bool blockedt
 
bool blocked
 
vpHomogeneousMatrix camMf2
 
vpHomogeneousMatrix f2Mf
 
double px_int
 
double py_int
 
double px_ext
 
double py_ext
 
bool displayObject
 
bool displayDesiredObject
 
bool displayCamera
 
bool displayImageSimulator
 
float cameraFactor
 
vpCameraTrajectoryDisplayType camTrajType
 
bool extCamChanged
 
vpHomogeneousMatrix rotz
 
unsigned int thickness_
 

Detailed Description

Implementation of a wire frame simulator. Compared to the vpSimulator class, it does not require third party libraries to be used.

The simulator uses several frames to display the scene in the image. There are:

  • The world frame : This is a fixed frame used to compute the position of the other frames against each other. By default this frame is positionned at the same location as the initial object frame position.
  • The object frame : It is the frame linked to the object.
  • The camera frame : It is the frame linked to the main camera.
  • The external camera frame : It is the frame which corresponds to one external point of view.

The most used homogeneous matrices which describes the displacement between two frames are :

  • fMo which is the displacement between the world frame and the object frame.
  • cMo which is the displacement between the main camera frame and the object frame.
  • cextMf which is the displacement between one external camera frame and the world frame.

The following picture summarize all the previous information.

vpWireFrameSimulator.jpeg

The simulator uses .bnd or .wrl files as 3D scene descriptors. Several scenes can be found in the data folder which is in the directory where you build ViSP.

You can move the main external view while clicking in the image. The left click enables to turn, the middle button enables to zoom and the left to translate along x and y.

The simulator is able to take into account to camera parameters. You can set the internal and external cameras parameters thanks to a vpCameraParameters.

The following example shows how it is easy to use.

#include <visp/vpImage.h>
#include <visp/vpWireFrameSimulator.h>
int main()
{
vpImage<vpRGBa> Iint(480,640,255);
vpImage<vpRGBa> Iext(480,640,255);
//Set the type of scene to use
//Set the initial pose of the camera
//Set the desired pose of the camera (for the internal view)
//Set the pose of the reference frame (for the external view)
//Set the camera parameters
vpCameraParameters camera(1000,1000,320,240);
//Get the internal view
sim.getInternalImage(Iint);
//Get the external view
sim.getExternalImage(Iext);
return 0;
}
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 181 of file vpWireFrameSimulator.h.

Member Enumeration Documentation

Enumerator
CT_LINE 
CT_POINT 

Definition at line 222 of file vpWireFrameSimulator.h.

Type of scene used to display the object at the desired pose (in the internal view).

  • D_STANDARD will use the vpSceneObject used to be the object at the current position.
  • D_OUTIL will display a tool which is attached to the camera.
Enumerator
D_STANDARD 

The object displayed at the desired position is the same than the scene object defined in vpSceneObject.

D_CIRCLE 

The object displayed at the desired position is a circle.

D_TOOL 

A cylindrical tool is attached to the camera.

Definition at line 215 of file vpWireFrameSimulator.h.

Type of scene used to display the object at the current position.

Enumerator
THREE_PTS 

A 40cm by 40cm plate with 3 points at coordinates (0,0,0), (0.1,0,0), (0,0.1,0). Each point is represented by a circle with 2cm radius.

CUBE 

A 12.5cm size cube.

PLATE 

A 40cm by 40cm plate with 4 points at coordinates (-0.1,-0.1,0), (0.1,-0.1,0), (0.1,0.1,0), (0.1,0.1,0). Each point is represented by a circle with 2cm radius.

SMALL_PLATE 

4 points at coordinates (-0.03,-0.03,0), (0.03,-0.03,0), (0.03,0.03,0), (0.03,0.03,0). Each point is represented by a circle with 1cm radius.

RECTANGLE 

A 40cm by 40cm plate with 4 points at coordinates (-0.07,-0.05,0), (0.07,0.05,0), (0.07,-0.05,0), (-0.07,-0.05,0). Each point is represented by a circle with 2cm radius.

SQUARE_10CM 

A 40cm by 40cm plate with 4 points at coordinates (-0.05,0.05,0), (0.05,0.05,0), (0.05,-0.05,0), (-0.05,-0.05,0). Each point is represented by a circle with 2cm radius.

DIAMOND 

A 40cm by 40cm plate with 4 points at coordinates (0,-0.1,0), (0.1,0,0), (0,0.1,0), (-0.1,0,0). Each point is represented by a circle with 2cm radius.

TRAPEZOID 

A 40cm by 40cm plate with 4 points at coordinates (-0.025,-0.05,0), (-0.075,0.05,0), (0.075,0.05,0), (0.025,-0.05,0). Each point is represented by a circle with 2cm radius.

THREE_LINES 

Three parallel lines with equation y=-5, y=0, y=5.

ROAD 

Three parallel lines representing a road.

TIRE 

A tire represented by 2 circles with radius 10cm and 15cm.

PIPE 

A pipe represented by a cylinder of 25 cm length and 15cm radius.

CIRCLE 

A 10cm radius circle.

SPHERE 

A 15cm radius sphere.

CYLINDER 

A cylinder of 80cm length and 10cm radius.

PLAN 

A plane represented by a 56cm by 56cm plate with a grid of 49 squares inside.

POINT_CLOUD 

A plate with 8 points at coordinates (0.05,0,0), (0.15,0.05,0), (0.2,0.2,0), (-0.05,0.2,0), (-0.15,-0.1,0), (-0.1,-0.1,0), (-0.05,0.05,0) and (0.5,0,0). ach point is represented by a circle with 2cm radius.

Definition at line 188 of file vpWireFrameSimulator.h.

Constructor & Destructor Documentation

vpWireFrameSimulator::vpWireFrameSimulator ( )

Basic constructor.

Set the path to the scene files (*.bnd and *.sln) used by the simulator. If the path set in vpConfig.h in VISP_SCENES_DIR macro is not valid, the path is set from the VISP_SCENES_DIR environment variable that the user has to set.

Definition at line 512 of file vpWireFrameSimulator.cpp.

References blocked, blockedr, blockedt, blockedz, vpColor::blue, vpHomogeneousMatrix::buildFrom(), camColor, cameraFactor, cameraTrajectory, camTrajColor, camTrajType, vpIoTools::checkDirectory(), CT_LINE, curColor, desColor, displayCamera, displayCameraTrajectory, displayDesiredObject, displayImageSimulator, displayObject, extCamChanged, fMo, fMoList, vpIoTools::getenv(), vpColor::green, nbrPtLimit, objectImage, old_iPr, old_iPt, old_iPz, poseList, px_ext, px_int, py_ext, py_int, vpMath::rad(), vpColor::red, rotz, sceneInitialized, vpHomogeneousMatrix::setIdentity(), and thickness_.

vpWireFrameSimulator::~vpWireFrameSimulator ( )
virtual

Member Function Documentation

void vpWireFrameSimulator::deleteCameraPositionHistory ( )
inline

Delete the history of the main camera position which are displayed in the external views.

Definition at line 298 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::display_scene ( Matrix  mat,
Bound_scene &  sc,
const vpImage< vpRGBa > &  I,
const vpColor color 
)
protected
void vpWireFrameSimulator::display_scene ( Matrix  mat,
Bound_scene &  sc,
const vpImage< unsigned char > &  I,
const vpColor color 
)
protected
void vpWireFrameSimulator::displayTrajectory ( const vpImage< unsigned char > &  I,
const std::list< vpHomogeneousMatrix > &  list_cMo,
const std::list< vpHomogeneousMatrix > &  list_fMo,
const vpHomogeneousMatrix cMf 
)

Display a trajectory thanks to a list of homogeneous matrices which give the position of the camera relative to the object and the position of the object relative to the world reference frame. The trajectory is projected into the view of an external camera whose position is given in parameter.

The two lists must have the same size of homogeneous matrices must have the same size.

Parameters
I: The image where the trajectory is displayed.
list_cMo: The homogeneous matrices list containing the position of the camera relative to the object.
list_fMo: The homogeneous matrices list containing the position of the object relative to the world reference frame.
cMf: A homogeneous matrix which gives the position of the external camera (used to project the trajectory) relative to the world reference frame.

Definition at line 1694 of file vpWireFrameSimulator.cpp.

References camTrajColor, camTrajType, CT_LINE, CT_POINT, vpException::dimensionError, vpDisplay::displayLine(), vpDisplay::displayPoint(), projectCameraTrajectory(), rotz, and thickness_.

void vpWireFrameSimulator::displayTrajectory ( const vpImage< vpRGBa > &  I,
const std::list< vpHomogeneousMatrix > &  list_cMo,
const std::list< vpHomogeneousMatrix > &  list_fMo,
const vpHomogeneousMatrix cMf 
)

Display a trajectory thanks to a list of homogeneous matrices which give the position of the camera relative to the object and the position of the object relative to the world reference frame. The trajectory is projected into the view of an external camera whose position is given in parameter.

The two lists must have the same size of homogeneous matrices must have the same size.

Parameters
I: The image where the trajectory is displayed.
list_cMo: The homogeneous matrices list containing the position of the camera relative to the object.
list_fMo: The homogeneous matrices list containing the position of the object relative to the world reference frame.
cMf: A homogeneous matrix which gives the position of the external camera (used to project the trajectory) relative to the world reference frame.

Definition at line 1734 of file vpWireFrameSimulator.cpp.

References camTrajColor, camTrajType, CT_LINE, CT_POINT, vpException::dimensionError, vpDisplay::displayLine(), vpDisplay::displayPoint(), projectCameraTrajectory(), rotz, and thickness_.

void vpWireFrameSimulator::displayTrajectory ( const vpImage< unsigned char > &  I,
vpList< vpHomogeneousMatrix > &  list_cMo,
vpList< vpHomogeneousMatrix > &  list_fMo,
vpHomogeneousMatrix  cMf 
)
Deprecated:
This method is deprecated. You should use displayTrajectory(vpImage<unsigned char> &, const std::list<vpHomogeneousMatrix> &, const std::list<vpHomogeneousMatrix> &, const vpHomogeneousMatrix &); instead.

Display a trajectory thanks to a list of homogeneous matrices which give the position of the camera relative to the object and the position of the object relative to the world reference frame. The trajectory is projected into the view of an external camera whose position is given in parameter.

The two lists must have the same size of homogeneous matrices must have the same size.

Parameters
I: The image where the trajectory is displayed.
list_cMo: The homogeneous matrices list containing the position of the camera relative to the object.
list_fMo: The homogeneous matrices list containing the position of the object relative to the world reference frame.
cMf: A homogeneous matrix which gives the position of the external camera (used to project the trajectory) relative to the world reference frame.

Definition at line 1612 of file vpWireFrameSimulator.cpp.

References camTrajColor, camTrajType, CT_LINE, CT_POINT, vpException::dimensionError, vpDisplay::displayLine(), vpDisplay::displayPoint(), vpList< type >::front(), vpList< type >::nbElements(), vpList< type >::next(), vpList< type >::outside(), projectCameraTrajectory(), rotz, thickness_, and vpList< type >::value().

void vpWireFrameSimulator::displayTrajectory ( const vpImage< vpRGBa > &  I,
vpList< vpHomogeneousMatrix > &  list_cMo,
vpList< vpHomogeneousMatrix > &  list_fMo,
vpHomogeneousMatrix  cMf 
)
Deprecated:
This method is deprecated. You should use displayTrajectory (vpImage<vpRGBa> &, const std::list<vpHomogeneousMatrix> &, const std::list<vpHomogeneousMatrix> &, const vpHomogeneousMatrix &); instead.

Display a trajectory thanks to a list of homogeneous matrices which give the position of the camera relative to the object and the position of the object relative to the world reference frame. The trajectory is projected into the view of an external camera whose position is given in parameter.

The two lists must have the same size of homogeneous matrices must have the same size.

Parameters
I: The image where the trajectory is displayed.
list_cMo: The homogeneous matrices list containing the position of the camera relative to the object.
list_fMo: The homogeneous matrices list containing the position of the object relative to the world reference frame.
cMf: A homogeneous matrix which gives the position of the external camera (used to project the trajectory) relative to the world reference frame.

Definition at line 1654 of file vpWireFrameSimulator.cpp.

References camTrajColor, camTrajType, CT_LINE, CT_POINT, vpException::dimensionError, vpDisplay::displayLine(), vpDisplay::displayPoint(), vpList< type >::front(), vpList< type >::nbElements(), vpList< type >::next(), vpList< type >::outside(), projectCameraTrajectory(), rotz, thickness_, and vpList< type >::value().

vpHomogeneousMatrix vpWireFrameSimulator::get_cMo ( ) const
inline

Get the pose between the object and the camera.

Returns
The pose between between the object and the camera.

Definition at line 403 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::get_cMo_History ( std::list< vpHomogeneousMatrix > &  cMo_history)
inline

Get the homogeneous matrices cMo stored to display the camera trajectory.

Parameters
cMo_history: The list of the homogeneous matrices cMo.

Definition at line 410 of file vpWireFrameSimulator.h.

vp_deprecated vpList<vpHomogeneousMatrix> vpWireFrameSimulator::get_cMo_History ( )
inline
Deprecated:
This method is deprecated. You should use get_cMo_History(std::list<vpHomogeneousMatrix> &) instead.

Get the homogeneous matrices cMo stored to display the camera trajectory.
Returns
Returns the list of the homogeneous matrices cMo.

Definition at line 592 of file vpWireFrameSimulator.h.

References vpList< type >::addRight().

vpHomogeneousMatrix vpWireFrameSimulator::get_fMo ( ) const
inline

Get the pose between the object and the fixed world frame.

Returns
The pose between the object and the fixed world frame.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, and servoSimuSphere.cpp.

Definition at line 422 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::get_fMo_History ( std::list< vpHomogeneousMatrix > &  fMo_history)
inline

Get the homogeneous matrices fMo stored to display the camera trajectory.

Parameters
fMo_history: The list of the homogeneous matrices fMo.

Definition at line 429 of file vpWireFrameSimulator.h.

vp_deprecated vpList<vpHomogeneousMatrix> vpWireFrameSimulator::get_fMo_History ( )
inline
Deprecated:
This method is deprecated. You should use get_fMo_History(std::list<vpHomogeneousMatrix> &) instead.

Get the homogeneous matrices fMo stored to display the camera trajectory.
Returns
Returns the list of the homogeneous matrices fMo.

Definition at line 607 of file vpWireFrameSimulator.h.

References vpList< type >::addRight().

vpCameraParameters vpWireFrameSimulator::getExternalCameraParameters ( const vpImage< unsigned char > &  I) const
inline

Get the parameters of the virtual external camera.

Parameters
I: The image used to display the view of the camera.
Returns
It returns the camera parameters.

Definition at line 313 of file vpWireFrameSimulator.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpMath::maximum(), and vpMath::minimum().

Referenced by projectCameraTrajectory().

vpCameraParameters vpWireFrameSimulator::getExternalCameraParameters ( const vpImage< vpRGBa > &  I) const
inline

Get the parameters of the virtual external camera.

Parameters
I: The image used to display the view of the camera.
Returns
It returns the camera parameters.

Definition at line 332 of file vpWireFrameSimulator.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpMath::maximum(), and vpMath::minimum().

vpHomogeneousMatrix vpWireFrameSimulator::getExternalCameraPosition ( ) const
inline

Get the main external camera's position relative to the the world reference frame.

Returns
the main external camera position relative to the the world reference frame.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, and servoSimuSphere.cpp.

Definition at line 349 of file vpWireFrameSimulator.h.

Referenced by vpRobotWireFrameSimulator::getExternalCameraPosition().

void vpWireFrameSimulator::getExternalImage ( vpImage< unsigned char > &  I,
const vpHomogeneousMatrix camMf 
)

Get an external view. The point of view is set thanks to the pose between the camera camMf and the fixed world frame.

Parameters
I: The image where the external view is displayed.
camMf: The pose between the point of view and the fixed world frame.
Warning
: The objects are displayed thanks to overlays. The image I is not modified.

Definition at line 1543 of file vpWireFrameSimulator.cpp.

References camColor, camera, camMf, cMo, curColor, vpImage< Type >::display, vpDisplay::display(), display_scene(), displayCamera, displayImageSimulator, displayObject, fMo, vpImage< Type >::getHeight(), vpImageSimulator::getImage(), getInternalCameraParameters(), vpImage< Type >::getWidth(), vpHomogeneousMatrix::inverse(), vpMath::maximum(), vpMath::minimum(), objectImage, px_ext, py_ext, rotz, scene, and vpImageSimulator::setCameraPosition().

void vpWireFrameSimulator::getExternalImage ( vpImage< vpRGBa > &  I)
void vpWireFrameSimulator::getExternalImage ( vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix camMf 
)

Get an external view. The point of view is set thanks to the pose between the camera camMf and the fixed world frame.

Parameters
I: The image where the external view is displayed.
camMf: The pose between the point of view and the fixed world frame.
Warning
: The objects are displayed thanks to overlays. The image I is not modified.

Definition at line 1260 of file vpWireFrameSimulator.cpp.

References camColor, camera, camMf, cMo, curColor, vpImage< Type >::display, vpDisplay::display(), display_scene(), displayCamera, displayImageSimulator, displayObject, fMo, vpImage< Type >::getHeight(), vpImageSimulator::getImage(), getInternalCameraParameters(), vpImage< Type >::getWidth(), vpHomogeneousMatrix::inverse(), vpMath::maximum(), vpMath::minimum(), objectImage, px_ext, py_ext, rotz, scene, and vpImageSimulator::setCameraPosition().

vpCameraParameters vpWireFrameSimulator::getInternalCameraParameters ( const vpImage< unsigned char > &  I) const
inline

Get the parameters of the virtual internal camera.

Parameters
I: The image used to display the view of the camera.
Returns
It returns the camera parameters.

Definition at line 363 of file vpWireFrameSimulator.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpMath::maximum(), and vpMath::minimum().

Referenced by getExternalImage(), and getInternalImage().

vpCameraParameters vpWireFrameSimulator::getInternalCameraParameters ( const vpImage< vpRGBa > &  I) const
inline

Get the parameters of the virtual internal camera.

Parameters
I: The image used to display the view of the camera.
Returns
It returns the camera parameters.

Definition at line 382 of file vpWireFrameSimulator.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpMath::maximum(), and vpMath::minimum().

void vpWireFrameSimulator::getInternalImage ( vpImage< vpRGBa > &  I)
void vpWireFrameSimulator::initScene ( const vpSceneObject obj,
const vpSceneDesiredObject desiredObject 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

It exists several default scenes you can use. Use the vpSceneObject and the vpSceneDesiredObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

Parameters
obj: Type of scene used to display the object at the current position.
desiredObject: Type of scene used to display the object at the desired pose (in the internal view).
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 612 of file vpWireFrameSimulator.cpp.

References camera, cameraFactor, CIRCLE, CUBE, CYLINDER, D_CIRCLE, D_STANDARD, D_TOOL, desiredObject, desiredScene, DIAMOND, displayCamera, displayDesiredObject, displayImageSimulator, displayObject, PIPE, PLAN, PLATE, POINT_CLOUD, RECTANGLE, ROAD, scene, sceneInitialized, SMALL_PLATE, SPHERE, SQUARE_10CM, THREE_LINES, THREE_PTS, TIRE, and TRAPEZOID.

Referenced by vpRobotWireFrameSimulator::initScene(), and initScene().

void vpWireFrameSimulator::initScene ( const char *  obj,
const char *  desiredObject 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

Parameters
obj: Path to the scene file you want to use.
desiredObject: Path to the scene file you want to use.

Definition at line 743 of file vpWireFrameSimulator.cpp.

References camera, cameraFactor, D_STANDARD, desiredScene, displayCamera, displayDesiredObject, displayObject, scene, sceneInitialized, THREE_PTS, and vpERROR_TRACE.

void vpWireFrameSimulator::initScene ( const vpSceneObject obj)

Initialize the simulator. It enables to choose the type of object which will be used to display the object at the current position. The object at the desired position is not displayed.

It exists several default scenes you can use. Use the vpSceneObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

Parameters
obj: Type of scene used to display the object at the current position.

Definition at line 847 of file vpWireFrameSimulator.cpp.

References camera, cameraFactor, CIRCLE, CUBE, CYLINDER, DIAMOND, displayCamera, displayDesiredObject, displayImageSimulator, displayObject, PIPE, PLAN, PLATE, POINT_CLOUD, RECTANGLE, ROAD, scene, sceneInitialized, SMALL_PLATE, SPHERE, SQUARE_10CM, THREE_LINES, THREE_PTS, TIRE, and TRAPEZOID.

void vpWireFrameSimulator::initScene ( const char *  obj)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position. The object at the desired position is not displayed.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

Parameters
obj: Path to the scene file you want to use.

Definition at line 951 of file vpWireFrameSimulator.cpp.

References camera, cameraFactor, displayCamera, displayObject, scene, sceneInitialized, THREE_PTS, and vpERROR_TRACE.

void vpWireFrameSimulator::initScene ( const vpSceneObject obj,
const vpSceneDesiredObject desiredObject,
const std::list< vpImageSimulator > &  imObj 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

It exists several default scenes you can use. Use the vpSceneObject and the vpSceneDesiredObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Type of scene used to display the object at the current position.
desiredObject: Type of scene used to display the object at the desired pose (in the internal view).
imObj: A list of vpImageSimulator instances.

Definition at line 725 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

void vpWireFrameSimulator::initScene ( const char *  obj,
const char *  desiredObject,
const std::list< vpImageSimulator > &  imObj 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Path to the scene file you want to use.
desiredObject: Path to the scene file you want to use.
imObj: A list of vpImageSimulator instances.

Definition at line 831 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

void vpWireFrameSimulator::initScene ( const vpSceneObject obj,
const std::list< vpImageSimulator > &  imObj 
)

Initialize the simulator. It enables to choose the type of object which will be used to display the object at the current position. The object at the desired position is not displayed.

It exists several default scenes you can use. Use the vpSceneObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Type of scene used to display the object at the current position.
imObj: A list of vpImageSimulator instances.

Definition at line 935 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

void vpWireFrameSimulator::initScene ( const char *  obj,
const std::list< vpImageSimulator > &  imObj 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position. The object at the desired position is not displayed.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Path to the scene file you want to use.
imObj: A list of vpImageSimulator instances.

Definition at line 1024 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

void vpWireFrameSimulator::initScene ( vpSceneObject  obj,
vpSceneDesiredObject  desiredObject,
vpList< vpImageSimulator > &  imObj 
)
Deprecated:
This method is deprecated. You should use initScene(vpSceneObject, vpSceneDesiredObject, const std::list<vpImageSimulator> &) instead.

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

It exists several default scenes you can use. Use the vpSceneObject and the vpSceneDesiredObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Type of scene used to display the object at the current position.
desiredObject: Type of scene used to display the object at the desired pose (in the internal view).
imObj: A list of vpImageSimulator instances.

Definition at line 701 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, vpList< type >::front(), initScene(), vpList< type >::next(), objectImage, vpList< type >::outside(), and vpList< type >::value().

void vpWireFrameSimulator::initScene ( const char *  obj,
const char *  desiredObject,
vpList< vpImageSimulator > &  imObj 
)
Deprecated:
This method is deprecated. You should use initScene(const char*, const char*, const std::list<vpImageSimulator> &) instead.

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Path to the scene file you want to use.
desiredObject: Path to the scene file you want to use.
imObj: A list of vpImageSimulator instances.

Definition at line 807 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, vpList< type >::front(), initScene(), vpList< type >::next(), objectImage, vpList< type >::outside(), and vpList< type >::value().

void vpWireFrameSimulator::initScene ( vpSceneObject  obj,
vpList< vpImageSimulator > &  imObj 
)
Deprecated:
This method is deprecated. You should use initScene(vpSceneObject, const std::list<vpImageSimulator> &) instead.

Initialize the simulator. It enables to choose the type of object which will be used to display the object at the current position. The object at the desired position is not displayed.

It exists several default scenes you can use. Use the vpSceneObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Type of scene used to display the object at the current position.
imObj: A list of vpImageSimulator instances.

Definition at line 912 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, vpList< type >::front(), initScene(), vpList< type >::next(), objectImage, vpList< type >::outside(), and vpList< type >::value().

void vpWireFrameSimulator::initScene ( const char *  obj,
vpList< vpImageSimulator > &  imObj 
)
Deprecated:
This method is deprecated. You should use initScene(const char*, const std::list<vpImageSimulator> &) instead.

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position. The object at the desired position is not displayed.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Path to the scene file you want to use.
imObj: A list of vpImageSimulator instances.

Definition at line 1001 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, vpList< type >::front(), initScene(), vpList< type >::next(), objectImage, vpList< type >::outside(), and vpList< type >::value().

vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo,
const vpHomogeneousMatrix fMo 
)
protected
vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const vpHomogeneousMatrix fMo 
)
protected
vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo,
const vpHomogeneousMatrix fMo,
const vpHomogeneousMatrix cMf 
)
protected
vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const vpHomogeneousMatrix fMo,
const vpHomogeneousMatrix cMf 
)
protected
void vpWireFrameSimulator::set_fMo ( const vpHomogeneousMatrix fMo)
inline

Set the pose between the object and the fixed world frame.

Parameters
fMo: The pose between the object and the fixed world frame.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, and wireframeSimulator.cpp.

Definition at line 563 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCameraColor ( const vpColor col)
inline

Set the color used to display the camera in the external view.

Parameters
col: The desired color.
Examples:
wireframeSimulator.cpp.

Definition at line 446 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCameraPositionRelObj ( const vpHomogeneousMatrix cMo)
inline

Set the position of the camera relative to the object.

Parameters
cMo: The pose of the camera.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 452 of file vpWireFrameSimulator.h.

References vpHomogeneousMatrix::inverse().

void vpWireFrameSimulator::setCameraPositionRelWorld ( const vpHomogeneousMatrix fMc)
inline

Set the position of the the world reference frame relative to the camera.

Parameters
fMc: The pose of the camera.

Definition at line 459 of file vpWireFrameSimulator.h.

References vpHomogeneousMatrix::inverse().

void vpWireFrameSimulator::setCameraSizeFactor ( const float  factor)
inline

Set the parameter which enables to choose the size of the main camera in the external camera views. By default this parameter is set to 1.

Parameters
factor: The ration for the camera size.

Definition at line 466 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCameraTrajectoryColor ( const vpColor col)
inline

Set the color used to display the camera trajectory in the external view.

Parameters
col: The desired color.

Definition at line 473 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCameraTrajectoryDisplayType ( const vpCameraTrajectoryDisplayType camTrajType)
inline

Set the way to display the history of the main camera trajectory in the main external view. The choice is given between displaying lines and points.

Parameters
camTrajType: The chosen way to display the camera trajectory.

Definition at line 480 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCurrentViewColor ( const vpColor col)
inline

Set the color used to display the object at the current position.

Parameters
col: The desired color.
Examples:
wireframeSimulator.cpp.

Definition at line 487 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setDesiredCameraPosition ( const vpHomogeneousMatrix cdMo)
inline

Set the desired position of the camera relative to the object.

Parameters
cdMo: The desired pose of the camera.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 493 of file vpWireFrameSimulator.h.

Referenced by vpRobotWireFrameSimulator::setDesiredCameraPosition().

void vpWireFrameSimulator::setDesiredViewColor ( const vpColor col)
inline

Set the color used to display the object at the desired position.

Parameters
col: The desired color.
Examples:
wireframeSimulator.cpp.

Definition at line 499 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setDisplayCameraTrajectory ( const bool &  displayCameraTrajectory)
inline

Enable or disable the displaying of the camera trajectory in the main external camera view.

By default the trajectory is displayed.

Parameters
displayCameraTrajectory: Set to true to display the camera trajectory.

Definition at line 507 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setExternalCameraParameters ( const vpCameraParameters cam)
inline

Set the internal camera parameters.

Parameters
cam: The desired camera parameters.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 514 of file vpWireFrameSimulator.h.

References vpCameraParameters::get_px(), and vpCameraParameters::get_py().

Referenced by vpSimulatorAfma6::initDisplay(), and vpSimulatorViper850::initDisplay().

void vpWireFrameSimulator::setExternalCameraPosition ( const vpHomogeneousMatrix camMf)
inline

Set the external camera point of view.

Parameters
camMf: The pose of the external camera relative to the world reference frame.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 523 of file vpWireFrameSimulator.h.

References vpHomogeneousMatrix::buildFrom(), and vpHomogeneousMatrix::inverse().

Referenced by vpRobotWireFrameSimulator::setExternalCameraPosition().

void vpWireFrameSimulator::setGraphicsThickness ( unsigned int  thickness)
inline

Specify the thickness of the graphics drawings.

Definition at line 536 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setInternalCameraParameters ( const vpCameraParameters cam)
inline

Set the internal camera parameters.

Parameters
cam: The desired camera parameters.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 546 of file vpWireFrameSimulator.h.

References vpCameraParameters::get_px(), and vpCameraParameters::get_py().

void vpWireFrameSimulator::setNbPtTrajectory ( const unsigned int  nbPt)
inline

Set the maximum number of main camera's positions which are stored. Those position can be displayed in the external camera field of view. By default this parameter is set to 1000.

Parameters
nbPt: The desired number of position which are saved.

Definition at line 556 of file vpWireFrameSimulator.h.

Member Data Documentation

bool vpWireFrameSimulator::blocked
protected

Definition at line 263 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

bool vpWireFrameSimulator::blockedr
protected

Definition at line 260 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

bool vpWireFrameSimulator::blockedt
protected

Definition at line 262 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

bool vpWireFrameSimulator::blockedz
protected

Definition at line 261 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

vpColor vpWireFrameSimulator::camColor
protected
float vpWireFrameSimulator::cameraFactor
protected
std::list<vpImagePoint> vpWireFrameSimulator::cameraTrajectory
protected
vpHomogeneousMatrix vpWireFrameSimulator::camMf2
protected
vpColor vpWireFrameSimulator::camTrajColor
protected
vpCameraTrajectoryDisplayType vpWireFrameSimulator::camTrajType
protected
vpHomogeneousMatrix vpWireFrameSimulator::cdMo
protected
vpColor vpWireFrameSimulator::desColor
protected
vpSceneDesiredObject vpWireFrameSimulator::desiredObject
protected
Bound_scene vpWireFrameSimulator::desiredScene
protected
bool vpWireFrameSimulator::displayCameraTrajectory
protected

Definition at line 251 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), and vpWireFrameSimulator().

bool vpWireFrameSimulator::displayDesiredObject
protected
bool vpWireFrameSimulator::displayImageSimulator
protected
bool vpWireFrameSimulator::extCamChanged
protected

Definition at line 282 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), and vpWireFrameSimulator().

vpHomogeneousMatrix vpWireFrameSimulator::f2Mf
protected
std::list<vpHomogeneousMatrix> vpWireFrameSimulator::fMoList
protected
unsigned int vpWireFrameSimulator::nbrPtLimit
protected

Definition at line 255 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), and vpWireFrameSimulator().

vpSceneObject vpWireFrameSimulator::object
protected

Definition at line 241 of file vpWireFrameSimulator.h.

std::list<vpImageSimulator> vpWireFrameSimulator::objectImage
protected
vpImagePoint vpWireFrameSimulator::old_iPr
protected

Definition at line 257 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

vpImagePoint vpWireFrameSimulator::old_iPt
protected

Definition at line 259 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

vpImagePoint vpWireFrameSimulator::old_iPz
protected

Definition at line 258 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

std::list<vpHomogeneousMatrix> vpWireFrameSimulator::poseList
protected
double vpWireFrameSimulator::px_ext
protected
double vpWireFrameSimulator::py_ext
protected
vpHomogeneousMatrix vpWireFrameSimulator::refMo
protected

Definition at line 237 of file vpWireFrameSimulator.h.