Visual Servoing Platform  version 3.3.0 under development (2020-02-17)
vpHomogeneousMatrix Class Reference

#include <visp3/core/vpHomogeneousMatrix.h>

+ Inheritance diagram for vpHomogeneousMatrix:

Public Member Functions

 vpHomogeneousMatrix ()
 
 vpHomogeneousMatrix (const vpHomogeneousMatrix &M)
 
 vpHomogeneousMatrix (const vpTranslationVector &t, const vpRotationMatrix &R)
 
 vpHomogeneousMatrix (const vpTranslationVector &t, const vpThetaUVector &tu)
 
 vpHomogeneousMatrix (const vpTranslationVector &t, const vpQuaternionVector &q)
 
 vpHomogeneousMatrix (const vpPoseVector &p)
 
 vpHomogeneousMatrix (const std::vector< float > &v)
 
 vpHomogeneousMatrix (const std::vector< double > &v)
 
 vpHomogeneousMatrix (double tx, double ty, double tz, double tux, double tuy, double tuz)
 
virtual ~vpHomogeneousMatrix ()
 
void buildFrom (const vpTranslationVector &t, const vpRotationMatrix &R)
 
void buildFrom (const vpTranslationVector &t, const vpThetaUVector &tu)
 
void buildFrom (const vpTranslationVector &t, const vpQuaternionVector &q)
 
void buildFrom (const vpPoseVector &p)
 
void buildFrom (const std::vector< float > &v)
 
void buildFrom (const std::vector< double > &v)
 
void buildFrom (double tx, double ty, double tz, double tux, double tuy, double tuz)
 
void convert (std::vector< float > &M)
 
void convert (std::vector< double > &M)
 
void eye ()
 
vpColVector getCol (unsigned int j) const
 
vpRotationMatrix getRotationMatrix () const
 
vpThetaUVector getThetaUVector () const
 
vpTranslationVector getTranslationVector () const
 
vpHomogeneousMatrix inverse () const
 
void inverse (vpHomogeneousMatrix &Mi) const
 
bool isAnHomogeneousMatrix () const
 
void insert (const vpRotationMatrix &R)
 
void insert (const vpThetaUVector &tu)
 
void insert (const vpTranslationVector &t)
 
void insert (const vpQuaternionVector &t)
 
void extract (vpRotationMatrix &R) const
 
void extract (vpThetaUVector &tu) const
 
void extract (vpTranslationVector &t) const
 
void extract (vpQuaternionVector &q) const
 
void load (std::ifstream &f)
 
void save (std::ofstream &f) const
 
vpHomogeneousMatrixoperator= (const vpHomogeneousMatrix &M)
 
vpHomogeneousMatrix operator* (const vpHomogeneousMatrix &M) const
 
vpHomogeneousMatrixoperator*= (const vpHomogeneousMatrix &M)
 
vpColVector operator* (const vpColVector &v) const
 
vpTranslationVector operator* (const vpTranslationVector &t) const
 
vpPoint operator* (const vpPoint &bP) const
 
void print () const
 
void resize (unsigned int nrows, unsigned int ncols, bool flagNullify=true)
 
bool operator== (const vpArray2D< float > &A) const
 
Deprecated functions
vp_deprecated void init ()
 
vp_deprecated void setIdentity ()
 
Inherited functionalities from vpArray2D
unsigned int getCols () const
 
double getMaxValue () const
 
double getMinValue () const
 
unsigned int getRows () const
 
unsigned int size () const
 
void resize (unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
 
void reshape (unsigned int nrows, unsigned int ncols)
 
bool operator== (const vpArray2D< double > &A) const
 
bool operator!= (const vpArray2D< double > &A) const
 
double * operator[] (unsigned int i)
 
double * operator[] (unsigned int i) const
 
vpArray2D< double > hadamard (const vpArray2D< double > &m) const
 

Static Public Member Functions

static vpHomogeneousMatrix mean (const std::vector< vpHomogeneousMatrix > &vec_M)
 
Inherited I/O from vpArray2D with Static Public Member Functions
static bool load (const std::string &filename, vpArray2D< double > &A, bool binary=false, char *header=NULL)
 
static bool loadYAML (const std::string &filename, vpArray2D< double > &A, char *header=NULL)
 
static bool save (const std::string &filename, const vpArray2D< double > &A, bool binary=false, const char *header="")
 
static bool saveYAML (const std::string &filename, const vpArray2D< double > &A, const char *header="")
 

Public Attributes

double * data
 

Protected Attributes

unsigned int rowNum
 
unsigned int colNum
 
double ** rowPtrs
 
unsigned int dsize
 

Related Functions

(Note that these are not member functions.)

enum  vpGEMMmethod
 
void vpGEMM (const vpArray2D< double > &A, const vpArray2D< double > &B, const double &alpha, const vpArray2D< double > &C, const double &beta, vpArray2D< double > &D, const unsigned int &ops=0)
 

Detailed Description

Implementation of an homogeneous matrix and operations on such kind of matrices.

The class provides a data structure for the homogeneous matrices as well as a set of operations on these matrices.

The vpHomogeneousMatrix class is derived from vpArray2D<double>.

An homogeneous matrix is 4x4 matrix defines as

\[ ^a{\bf M}_b = \left(\begin{array}{cc} ^a{\bf R}_b & ^a{\bf t}_b \\ {\bf 0}_{1\times 3} & 1 \end{array} \right) \]

that defines the position of frame b in frame a

$ ^a{\bf R}_b $ is a rotation matrix and $ ^a{\bf t}_b $ is a translation vector.

There are different ways to initialize an homogeneous matrix. You can set each element of the matrix like:

#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
M[0][0] = 0; M[0][1] = 0; M[0][2] = -1; M[0][3] = 0.1;
M[1][0] = 0; M[1][1] = -1; M[1][2] = 0; M[1][3] = 0.2;
M[2][0] = -1; M[2][1] = 0; M[2][2] = 0; M[2][3] = 0.3;
std::cout << "M:" << std::endl;
for (unsigned int i = 0; i < M.getRows(); i++) {
for (unsigned int j = 0; j < M.getCols(); j++) {
std::cout << M[i][j] << " ";
}
std::cout << std::endl;
}
}

It produces the following printings:

M:
0 0 -1 0.1
0 -1 0 0.2
-1 0 0 0.3
0 0 0 1

You can also use vpRotationMatrix::operator<< and vpTranslationVector::operator<< like:

#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
R << 0, 0, -1,
0, -1, 0,
-1, 0, 0;
t << 0.1, 0.2, 0.3;
std::cout << "M:\n" << M << std::endl;
}

If ViSP is build with c++11 enabled, you can do the same using:

#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
vpHomogeneousMatrix M( vpTranslationVector(0.1, 0.2, 0.3), vpRotationMatrix( {0, 0, -1, 0, -1, 0, -1, 0, 0} ) );
std::cout << "M:\n" << M << std::endl;
#endif
}
Examples:
AROgre.cpp, AROgreBasic.cpp, calibrate-hand-eye.cpp, exponentialMap.cpp, HelloWorldOgre.cpp, HelloWorldOgreAdvanced.cpp, homographyHartleyDLT2DObject.cpp, homographyHLM2DObject.cpp, homographyHLM3DObject.cpp, homographyRansac2DObject.cpp, manGeometricFeatures.cpp, manServo4PointsDisplay.cpp, manServoMomentsSimple.cpp, manSimu4Dots.cpp, manSimu4Points.cpp, mbot-apriltag-2D-half-vs.cpp, mbot-apriltag-ibvs.cpp, mbot-apriltag-pbvs.cpp, mbtEdgeKltMultiTracking.cpp, mbtEdgeKltTracking.cpp, mbtEdgeMultiTracking.cpp, mbtEdgeTracking.cpp, mbtGenericTracking.cpp, mbtGenericTracking2.cpp, mbtGenericTrackingDepth.cpp, mbtGenericTrackingDepthOnly.cpp, mbtKltMultiTracking.cpp, mbtKltTracking.cpp, photometricVisualServoing.cpp, poseVirtualVS.cpp, servoAfma4Point2DArtVelocity.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6Cylinder2DCamVelocity.cpp, servoAfma6Cylinder2DCamVelocitySecondaryTask.cpp, servoAfma6FourPoints2DCamVelocityLs_cur.cpp, servoAfma6FourPoints2DCamVelocityLs_des.cpp, servoAfma6Line2DCamVelocity.cpp, servoAfma6Point2DArtVelocity.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoAfma6SquareLines2DCamVelocity.cpp, servoAfma6TwoLines2DCamVelocity.cpp, servoBebop2.cpp, servoBiclopsPoint2DArtVelocity.cpp, servoFlirPtuIBVS.cpp, servoFrankaIBVS.cpp, servoFrankaPBVS.cpp, servoMomentImage.cpp, servoMomentPoints.cpp, servoMomentPolygon.cpp, servoPioneerPanSegment3D.cpp, servoPtu46Point2DArtVelocity.cpp, servoSimu3D_cdMc_CamVelocity.cpp, servoSimu3D_cdMc_CamVelocityWithoutVpServo.cpp, servoSimu3D_cMcd_CamVelocity.cpp, servoSimu3D_cMcd_CamVelocityWithoutVpServo.cpp, servoSimu4Points.cpp, servoSimuAfma6FourPoints2DCamVelocity.cpp, servoSimuCircle2DCamVelocity.cpp, servoSimuCircle2DCamVelocityDisplay.cpp, servoSimuCylinder.cpp, servoSimuCylinder2DCamVelocityDisplay.cpp, servoSimuCylinder2DCamVelocityDisplaySecondaryTask.cpp, servoSimuFourPoints2DCamVelocity.cpp, servoSimuFourPoints2DCamVelocityDisplay.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, servoSimuLine2DCamVelocityDisplay.cpp, servoSimuPoint2DCamVelocity1.cpp, servoSimuPoint2DCamVelocity2.cpp, servoSimuPoint2DCamVelocity3.cpp, servoSimuPoint2DhalfCamVelocity1.cpp, servoSimuPoint2DhalfCamVelocity2.cpp, servoSimuPoint2DhalfCamVelocity3.cpp, servoSimuPoint3DCamVelocity.cpp, servoSimuSphere.cpp, servoSimuSphere2DCamVelocity.cpp, servoSimuSphere2DCamVelocityDisplay.cpp, servoSimuSphere2DCamVelocityDisplaySecondaryTask.cpp, servoSimuSquareLine2DCamVelocityDisplay.cpp, servoSimuThetaUCamVelocity.cpp, servoSimuViper850FourPoints2DCamVelocity.cpp, servoViper650FourPoints2DArtVelocityLs_cur.cpp, servoViper650FourPoints2DCamVelocityLs_cur-SR300.cpp, servoViper650FourPoints2DCamVelocityLs_cur.cpp, servoViper850FourPoints2DArtVelocityLs_cur.cpp, servoViper850FourPoints2DCamVelocityLs_cur.cpp, servoViper850FourPointsKinect.cpp, servoViper850Point2DArtVelocity.cpp, simulateCircle2DCamVelocity.cpp, simulateFourPoints2DCartesianCamVelocity.cpp, simulateFourPoints2DPolarCamVelocity.cpp, testAprilTag.cpp, testDisplacement.cpp, testDisplays.cpp, testEigenConversion.cpp, testFeatureSegment.cpp, testFindMatch.cpp, testFrankaCartVelocity-3.cpp, testFrankaGetPose.cpp, testGenericTracker.cpp, testGenericTrackerDepth.cpp, testImageDraw.cpp, testKeyPoint-2.cpp, testKeyPoint-4.cpp, testPose.cpp, testPoseFeatures.cpp, testPoseRansac.cpp, testPoseVector.cpp, testRobotAfma6Pose.cpp, testRobotViper650-frames.cpp, testRobotViper850-frames.cpp, testRobotViper850.cpp, testRobotViper850Pose.cpp, testViper650.cpp, testViper850.cpp, testVirtuoseAfma6.cpp, testVirtuoseHapticBox.cpp, testVirtuoseWithGlove.cpp, tutorial-apriltag-detector-live-rgbd-realsense.cpp, tutorial-chessboard-pose.cpp, tutorial-detection-object-mbt-deprecated.cpp, tutorial-detection-object-mbt.cpp, tutorial-detection-object-mbt2-deprecated.cpp, tutorial-detection-object-mbt2.cpp, tutorial-flir-ptu-ibvs.cpp, tutorial-hand-eye-calibration.cpp, tutorial-homography-from-points.cpp, tutorial-ibvs-4pts-display.cpp, tutorial-ibvs-4pts-image-tracking.cpp, tutorial-ibvs-4pts-ogre-tracking.cpp, tutorial-ibvs-4pts-ogre.cpp, tutorial-ibvs-4pts-plotter-continuous-gain-adaptive.cpp, tutorial-ibvs-4pts-plotter-gain-adaptive.cpp, tutorial-ibvs-4pts-plotter.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, tutorial-ibvs-4pts-wireframe-robot-afma6.cpp, tutorial-ibvs-4pts-wireframe-robot-viper.cpp, tutorial-ibvs-4pts.cpp, tutorial-image-simulator.cpp, tutorial-mb-edge-tracker.cpp, tutorial-mb-generic-tracker-apriltag-rs2.cpp, tutorial-mb-generic-tracker-apriltag-webcam.cpp, tutorial-mb-generic-tracker-full.cpp, tutorial-mb-generic-tracker-live.cpp, tutorial-mb-generic-tracker-rgbd-blender.cpp, tutorial-mb-generic-tracker-rgbd-realsense.cpp, tutorial-mb-generic-tracker-rgbd.cpp, tutorial-mb-generic-tracker-stereo-mono.cpp, tutorial-mb-generic-tracker-stereo.cpp, tutorial-mb-generic-tracker.cpp, tutorial-mb-hybrid-tracker.cpp, tutorial-mb-klt-tracker.cpp, tutorial-mb-tracker-full.cpp, tutorial-mb-tracker-stereo-mono.cpp, tutorial-mb-tracker-stereo.cpp, tutorial-mb-tracker.cpp, tutorial-pose-from-points-image.cpp, tutorial-pose-from-points-live.cpp, tutorial-pose-from-qrcode-image.cpp, tutorial-simu-pioneer-continuous-gain-adaptive.cpp, tutorial-simu-pioneer-continuous-gain-constant.cpp, tutorial-simu-pioneer-pan.cpp, tutorial-simu-pioneer.cpp, and wireframeSimulator.cpp.

Definition at line 149 of file vpHomogeneousMatrix.h.

Constructor & Destructor Documentation

◆ vpHomogeneousMatrix() [1/9]

vpHomogeneousMatrix::vpHomogeneousMatrix ( )

Default constructor that initialize an homogeneous matrix as identity.

Definition at line 66 of file vpHomogeneousMatrix.cpp.

References eye().

◆ vpHomogeneousMatrix() [2/9]

vpHomogeneousMatrix::vpHomogeneousMatrix ( const vpHomogeneousMatrix M)

Copy constructor that initialize an homogeneous matrix from another homogeneous matrix.

Definition at line 72 of file vpHomogeneousMatrix.cpp.

◆ vpHomogeneousMatrix() [3/9]

vpHomogeneousMatrix::vpHomogeneousMatrix ( const vpTranslationVector t,
const vpRotationMatrix R 
)

Construct an homogeneous matrix from a translation vector and a rotation matrix.

Definition at line 89 of file vpHomogeneousMatrix.cpp.

References insert().

◆ vpHomogeneousMatrix() [4/9]

vpHomogeneousMatrix::vpHomogeneousMatrix ( const vpTranslationVector t,
const vpThetaUVector tu 
)

Construct an homogeneous matrix from a translation vector and $\theta {\bf u}$ rotation vector.

Definition at line 78 of file vpHomogeneousMatrix.cpp.

References buildFrom().

◆ vpHomogeneousMatrix() [5/9]

vpHomogeneousMatrix::vpHomogeneousMatrix ( const vpTranslationVector t,
const vpQuaternionVector q 
)

Construct an homogeneous matrix from a translation vector and quaternion rotation vector.

Definition at line 56 of file vpHomogeneousMatrix.cpp.

References buildFrom().

◆ vpHomogeneousMatrix() [6/9]

vpHomogeneousMatrix::vpHomogeneousMatrix ( const vpPoseVector p)
explicit

Construct an homogeneous matrix from a pose vector.

Definition at line 100 of file vpHomogeneousMatrix.cpp.

References buildFrom().

◆ vpHomogeneousMatrix() [7/9]

vpHomogeneousMatrix::vpHomogeneousMatrix ( const std::vector< float > &  v)
explicit

Construct an homogeneous matrix from a vector of float.

Parameters
v: Vector of 12 or 16 values corresponding to the values of the homogeneous matrix.

The following example shows how to use this function:

#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
std::vector<float> v(12, 0);
v[1] = -1.; // ry=-90
v[4] = 1.; // rx=90
v[10] = -1.; // rz=-90
v[3] = 0.3; // tx
v[7] = 0.4; // ty
v[11] = 0.5; // tz
std::cout << "v: ";
for(unsigned int i=0; i<v.size(); i++)
std::cout << v[i] << " ";
std::cout << std::endl;
std::cout << "M:\n" << M << std::endl;
}

It produces the following printings:

v: 0 -1 0 0.3 1 0 0 0.4 0 0 -1 0.5
M:
0 -1 0 0.3000000119
1 0 0 0.400000006
0 0 -1 0.5
0 0 0 1

Definition at line 145 of file vpHomogeneousMatrix.cpp.

References buildFrom().

◆ vpHomogeneousMatrix() [8/9]

vpHomogeneousMatrix::vpHomogeneousMatrix ( const std::vector< double > &  v)
explicit

Construct an homogeneous matrix from a vector of double.

Parameters
v: Vector of 12 or 16 values corresponding to the values of the homogeneous matrix.

The following example shows how to use this function:

#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
std::vector<double> v(12, 0);
v[1] = -1.; // ry=-90
v[4] = 1.; // rx=90
v[10] = -1.; // rz=-90
v[3] = 0.3; // tx
v[7] = 0.4; // ty
v[11] = 0.5; // tz
std::cout << "v: ";
for(unsigned int i=0; i<v.size(); i++)
std::cout << v[i] << " ";
std::cout << std::endl;
std::cout << "M:\n" << M << std::endl;
}

It produces the following printings:

v: 0 -1 0 0.3 1 0 0 0.4 0 0 -1 0.5
M:
0 -1 0 0.3
1 0 0 0.4
0 0 -1 0.5
0 0 0 1

Definition at line 190 of file vpHomogeneousMatrix.cpp.

References buildFrom().

◆ vpHomogeneousMatrix() [9/9]

vpHomogeneousMatrix::vpHomogeneousMatrix ( double  tx,
double  ty,
double  tz,
double  tux,
double  tuy,
double  tuz 
)

Construct an homogeneous matrix from a translation vector ${\bf t}=(t_x, t_y, t_z)^T$ and a $\theta {\bf u}=(\theta u_x, \theta u_y, \theta u_z)^T$ rotation vector.

Definition at line 201 of file vpHomogeneousMatrix.cpp.

References buildFrom().

◆ ~vpHomogeneousMatrix()

virtual vpHomogeneousMatrix::~vpHomogeneousMatrix ( )
inlinevirtual

Member Function Documentation

◆ buildFrom() [1/7]

void vpHomogeneousMatrix::buildFrom ( const vpTranslationVector t,
const vpRotationMatrix R 
)

Build an homogeneous matrix from a translation vector and a rotation matrix.

Examples:
calibrate-hand-eye.cpp, mbtEdgeKltMultiTracking.cpp, mbtEdgeKltTracking.cpp, mbtEdgeMultiTracking.cpp, mbtEdgeTracking.cpp, mbtGenericTracking.cpp, mbtGenericTracking2.cpp, mbtGenericTrackingDepth.cpp, mbtGenericTrackingDepthOnly.cpp, mbtKltMultiTracking.cpp, mbtKltTracking.cpp, photometricVisualServoing.cpp, servoAfma6FourPoints2DCamVelocityLs_cur.cpp, servoAfma6FourPoints2DCamVelocityLs_des.cpp, servoFlirPtuIBVS.cpp, servoSimu3D_cdMc_CamVelocity.cpp, servoSimu3D_cMcd_CamVelocity.cpp, servoSimuPoint2DhalfCamVelocity1.cpp, servoSimuPoint2DhalfCamVelocity2.cpp, servoSimuPoint2DhalfCamVelocity3.cpp, servoSimuThetaUCamVelocity.cpp, servoViper850FourPoints2DArtVelocityLs_cur.cpp, servoViper850FourPoints2DCamVelocityLs_cur.cpp, servoViper850FourPointsKinect.cpp, testKeyPoint-2.cpp, testRobotAfma6Pose.cpp, testRobotViper650-frames.cpp, testRobotViper850-frames.cpp, testRobotViper850Pose.cpp, and tutorial-flir-ptu-ibvs.cpp.

Definition at line 222 of file vpHomogeneousMatrix.cpp.

References insert().

Referenced by vpHomography::buildFrom(), vpAfma6::init(), vpViper650::init(), vpViper850::init(), vpSimulatorAfma6::init(), vpSimulatorViper850::init(), vpMbTracker::initClick(), vpMbEdgeMultiTracker::initFromPose(), vpMbKltMultiTracker::initFromPose(), vpMbEdgeKltMultiTracker::initFromPose(), vpMbTracker::initFromPose(), vpMbTracker::loadCAOModel(), vpWireFrameSimulator::navigation(), vpAfma6::parseConfigFile(), vpPioneerPan::set_cMe(), vpViper::set_eMc(), vpWireFrameSimulator::setExternalCameraPosition(), vpSimulatorPioneer::setVelocity(), vpSimulatorPioneerPan::setVelocity(), vpAfma4::vpAfma4(), vpHomogeneousMatrix(), vpKinect::vpKinect(), and vpWireFrameSimulator::vpWireFrameSimulator().

◆ buildFrom() [2/7]

void vpHomogeneousMatrix::buildFrom ( const vpTranslationVector t,
const vpThetaUVector tu 
)

Build an homogeneous matrix from a translation vector and a $\theta {\bf u}$ rotation vector.

Definition at line 212 of file vpHomogeneousMatrix.cpp.

References insert().

◆ buildFrom() [3/7]

void vpHomogeneousMatrix::buildFrom ( const vpTranslationVector t,
const vpQuaternionVector q 
)

Build an homogeneous matrix from a translation vector and a quaternion rotation vector.

Definition at line 244 of file vpHomogeneousMatrix.cpp.

References insert().

◆ buildFrom() [4/7]

void vpHomogeneousMatrix::buildFrom ( const vpPoseVector p)

Build an homogeneous matrix from a pose vector.

Definition at line 231 of file vpHomogeneousMatrix.cpp.

References insert().

◆ buildFrom() [5/7]

void vpHomogeneousMatrix::buildFrom ( const std::vector< float > &  v)

Build an homogeneous matrix from a vector of float.

Parameters
v: Vector of 12 or 16 values corresponding to the values of the homogeneous matrix.

The following example shows how to use this function:

#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
std::vector<float> v(12, 0);
v[1] = -1.; // ry=-90
v[4] = 1.; // rx=90
v[10] = -1.; // rz=-90
v[3] = 0.3; // tx
v[7] = 0.4; // ty
v[11] = 0.5; // tz
std::cout << "v: ";
for(unsigned int i=0; i<v.size(); i++)
std::cout << v[i] << " ";
std::cout << std::endl;
M.buildFrom(v);
std::cout << "M:\n" << M << std::endl;
}

It produces the following printings:

v: 0 -1 0 0.3 1 0 0 0.4 0 0 -1 0.5
M:
0 -1 0 0.3000000119
1 0 0 0.400000006
0 0 -1 0.5
0 0 0 1

Definition at line 304 of file vpHomogeneousMatrix.cpp.

References vpArray2D< double >::data, and vpException::dimensionError.

◆ buildFrom() [6/7]

void vpHomogeneousMatrix::buildFrom ( const std::vector< double > &  v)

Build an homogeneous matrix from a vector of double.

Parameters
v: Vector of 12 or 16 values corresponding to the values of the homogeneous matrix.

The following example shows how to use this function:

#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
std::vector<double> v(12, 0);
v[1] = -1.; // ry=-90
v[4] = 1.; // rx=90
v[10] = -1.; // rz=-90
v[3] = 0.3; // tx
v[7] = 0.4; // ty
v[11] = 0.5; // tz
std::cout << "v: ";
for(unsigned int i=0; i<v.size(); i++)
std::cout << v[i] << " ";
std::cout << std::endl;
M.buildFrom(v);
std::cout << "M:\n" << M << std::endl;
}

It produces the following printings:

v: 0 -1 0 0.3 1 0 0 0.4 0 0 -1 0.5
M:
0 -1 0 0.3
1 0 0 0.4
0 0 -1 0.5
0 0 0 1

Definition at line 354 of file vpHomogeneousMatrix.cpp.

References vpArray2D< double >::data, and vpException::dimensionError.

◆ buildFrom() [7/7]

void vpHomogeneousMatrix::buildFrom ( double  tx,
double  ty,
double  tz,
double  tux,
double  tuy,
double  tuz 
)

Build an homogeneous matrix from a translation vector ${\bf t}=(t_x, t_y, t_z)^T$ and a $\theta {\bf u}=(\theta u_x, \theta u_y, \theta u_z)^T$ rotation vector.

Definition at line 255 of file vpHomogeneousMatrix.cpp.

References insert().

◆ convert() [1/2]

void vpHomogeneousMatrix::convert ( std::vector< float > &  M)

Converts an homogeneous matrix to a vector of 12 floats.

Parameters
M: Converted matrix.

Definition at line 764 of file vpHomogeneousMatrix.cpp.

References vpArray2D< double >::data.

Referenced by vpHomography::inverse().

◆ convert() [2/2]

void vpHomogeneousMatrix::convert ( std::vector< double > &  M)

Converts an homogeneous matrix to a vector of 12 doubles.

Parameters
M: Converted matrix.

Definition at line 775 of file vpHomogeneousMatrix.cpp.

References vpArray2D< double >::data.

◆ extract() [1/4]

void vpHomogeneousMatrix::extract ( vpRotationMatrix R) const

Extract the rotational matrix from the homogeneous matrix.

Parameters
R: rotational component as a rotation matrix.
Examples:
calibrate-hand-eye.cpp, exponentialMap.cpp, servoAfma6FourPoints2DCamVelocityLs_cur.cpp, servoMomentImage.cpp, servoMomentPoints.cpp, servoMomentPolygon.cpp, servoSimu3D_cdMc_CamVelocityWithoutVpServo.cpp, servoSimu3D_cMcd_CamVelocityWithoutVpServo.cpp, servoViper850FourPoints2DArtVelocityLs_cur.cpp, servoViper850FourPoints2DCamVelocityLs_cur.cpp, servoViper850FourPointsKinect.cpp, testRobotAfma6Pose.cpp, testRobotViper650-frames.cpp, testRobotViper850-frames.cpp, testRobotViper850.cpp, testRobotViper850Pose.cpp, testViper650.cpp, and testViper850.cpp.

Definition at line 551 of file vpHomogeneousMatrix.cpp.

Referenced by vpTranslationVector::buildFrom(), vpPoseVector::buildFrom(), vpThetaUVector::buildFrom(), vpFeatureThetaU::buildFrom(), vpPose::calculArbreDementhon(), vpMatrix::computeCovarianceMatrixVVS(), vpMbtDistanceKltPoints::computeHomography(), vpMbHiddenFaces< vpMbtPolygon >::computeScanLineQuery(), vpViper::get_eJe(), vpViper::get_fJe(), vpRobotAfma6::getDisplacement(), vpSimulatorCamera::getPosition(), vpRobotCamera::getPosition(), vpSimulatorPioneer::getPosition(), vpSimulatorPioneerPan::getPosition(), vpSimulatorAfma6::getPosition(), vpRobotAfma4::getPosition(), vpSimulatorViper850::getPosition(), vpRobotAfma6::getPosition(), vpRobotViper650::getPosition(), vpRobotViper850::getPosition(), getRotationMatrix(), getThetaUVector(), getTranslationVector(), vpRobotAfma6::getVelocity(), vpRobotViper650::getVelocity(), vpRobotViper850::getVelocity(), vpExponentialMap::inverse(), inverse(), isAnHomogeneousMatrix(), operator*(), vpPose::poseDementhonNonPlan(), vpPose::poseDementhonPlan(), vpPose::poseLowe(), vpViper::set_eMc(), vpImageSimulator::setCameraPosition(), vpWireFrameSimulator::setExternalCameraPosition(), vpMbKltTracker::setPose(), vpAROgre::setPosition(), vpSimulatorAfma6::setPosition(), vpRobotAfma4::setVelocity(), vpFeatureThetaU::vpFeatureThetaU(), and vpTranslationVector::vpTranslationVector().

◆ extract() [2/4]

void vpHomogeneousMatrix::extract ( vpThetaUVector tu) const

Extract the rotation as a $\theta \bf u$ vector.

Definition at line 570 of file vpHomogeneousMatrix.cpp.

References vpThetaUVector::buildFrom().

◆ extract() [3/4]

void vpHomogeneousMatrix::extract ( vpTranslationVector t) const

Extract the translation vector from the homogeneous matrix.

Definition at line 561 of file vpHomogeneousMatrix.cpp.

◆ extract() [4/4]

void vpHomogeneousMatrix::extract ( vpQuaternionVector q) const

Extract the rotation as a quaternion.

Definition at line 580 of file vpHomogeneousMatrix.cpp.

References vpQuaternionVector::buildFrom().

◆ eye()

◆ getCol()

vpColVector vpHomogeneousMatrix::getCol ( unsigned int  j) const

Extract a column vector from an homogeneous matrix.

Warning
All the indexes start from 0 in this function.
Parameters
j: Index of the column to extract. If j=0, the first column is extracted.
Returns
The extracted column vector.

The following example shows how to use this function:

#include <visp3/core/vpColVector.h>
#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
vpColVector t = M.getCol(3);
std::cout << "Last column: \n" << t << std::endl;
}

It produces the following output:

Last column:
0
0
1
0

Definition at line 841 of file vpHomogeneousMatrix.cpp.

References vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().

◆ getCols()

unsigned int vpArray2D< double >::getCols ( ) const
inlineinherited

Return the number of columns of the 2D array.

See also
getRows(), size()
Examples:
servoViper850Point2DArtVelocity-jointAvoidance-basic.cpp, testAprilTag.cpp, testColVector.cpp, testDisplacement.cpp, testImageFilter.cpp, testMatrix.cpp, testMatrixConditionNumber.cpp, testMatrixConvolution.cpp, testMatrixDeterminant.cpp, testMatrixInitialization.cpp, testMatrixInverse.cpp, testMatrixPseudoInverse.cpp, testPoseVector.cpp, testRowVector.cpp, testSvd.cpp, testTranslationVector.cpp, and tutorial-matlab.cpp.

Definition at line 279 of file vpArray2D.h.

References vpArray2D< Type >::colNum, vpArray2D< Type >::getMaxValue(), and vpArray2D< Type >::getMinValue().

Referenced by vpMatrix::cond(), vpRowVector::cppPrint(), vpMatrix::cppPrint(), vpRowVector::csvPrint(), vpMatrix::csvPrint(), vpMatrix::detByLUEigen3(), vpMatrix::extract(), vpRotationMatrix::getCol(), getCol(), vpMatrix::getCol(), vpMatrix::inducedL2Norm(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByQRLapack(), vpRotationMatrix::isARotationMatrix(), vpMatrix::kernel(), vpRowVector::maplePrint(), vpMatrix::maplePrint(), vpRowVector::matlabPrint(), vpMatrix::matlabPrint(), vpRowVector::operator*(), vpRowVector::operator+(), vpRowVector::operator+=(), vpRowVector::operator-(), vpRowVector::operator-=(), vpForceTwistMatrix::print(), vpVelocityTwistMatrix::print(), vpRowVector::print(), vpMatrix::print(), vpMatrix::pseudoInverse(), vpMatrix::row(), vpMatrix::svdEigen3(), vpMatrix::svdGsl(), vpMatrix::svdLapack(), and vpMatrix::svdOpenCV().

◆ getMaxValue()

double vpArray2D< double >::getMaxValue ( ) const
inherited

Return the array max value.

Examples:
servoMomentImage.cpp, and testArray2D.cpp.

Definition at line 913 of file vpArray2D.h.

References vpArray2D< Type >::data.

◆ getMinValue()

double vpArray2D< double >::getMinValue ( ) const
inherited

Return the array min value.

Examples:
servoMomentImage.cpp, and testArray2D.cpp.

Definition at line 896 of file vpArray2D.h.

References vpArray2D< Type >::data.

◆ getRotationMatrix()

◆ getRows()

unsigned int vpArray2D< double >::getRows ( ) const
inlineinherited

Return the number of rows of the 2D array.

See also
getCols(), size()
Examples:
mbtGenericTrackingDepth.cpp, mbtGenericTrackingDepthOnly.cpp, testAprilTag.cpp, testColVector.cpp, testDisplacement.cpp, testGenericTracker.cpp, testGenericTrackerDepth.cpp, testImageFilter.cpp, testMatrix.cpp, testMatrixConditionNumber.cpp, testMatrixConvolution.cpp, testMatrixDeterminant.cpp, testMatrixInitialization.cpp, testMatrixInverse.cpp, testMatrixPseudoInverse.cpp, testPoseVector.cpp, testRowVector.cpp, testSvd.cpp, testTranslationVector.cpp, tutorial-matlab.cpp, tutorial-mb-generic-tracker-rgbd-blender.cpp, and tutorial-mb-generic-tracker-rgbd-realsense.cpp.

Definition at line 289 of file vpArray2D.h.

References vpArray2D< Type >::rowNum.

Referenced by vpMatrix::column(), vpMatrix::cond(), vpColVector::cppPrint(), vpMatrix::cppPrint(), vpColVector::csvPrint(), vpMatrix::csvPrint(), vpMatrix::detByLUEigen3(), vpMatrix::extract(), vpRotationMatrix::getCol(), getCol(), vpMatrix::getCol(), vpMatrix::inducedL2Norm(), vpMatrix::inverseByCholeskyLapack(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByQRLapack(), vpRotationMatrix::isARotationMatrix(), vpMatrix::kernel(), vpColVector::maplePrint(), vpMatrix::maplePrint(), vpColVector::matlabPrint(), vpMatrix::matlabPrint(), vpColVector::operator+(), vpColVector::operator+=(), vpColVector::operator-(), vpColVector::operator-=(), vpForceTwistMatrix::print(), vpVelocityTwistMatrix::print(), vpPoseVector::print(), vpColVector::print(), vpMatrix::print(), vpMatrix::pseudoInverse(), vpMatrix::svdEigen3(), vpMatrix::svdGsl(), vpMatrix::svdLapack(), and vpMatrix::svdOpenCV().

◆ getThetaUVector()

vpThetaUVector vpHomogeneousMatrix::getThetaUVector ( ) const

Return the $\theta {\bf u}$ vector that corresponds to the rotation part of the homogeneous transformation.

Examples:
servoFrankaPBVS.cpp.

Definition at line 806 of file vpHomogeneousMatrix.cpp.

References extract().

◆ getTranslationVector()

vpTranslationVector vpHomogeneousMatrix::getTranslationVector ( ) const

◆ hadamard()

vpArray2D< double > vpArray2D< double >::hadamard ( const vpArray2D< double > &  m) const
inherited

Compute the Hadamard product (element wise matrix multiplication).

Parameters
m: Second matrix;
Returns
m1.hadamard(m2) The Hadamard product : $ m1 \circ m2 = (m1 \circ m2)_{i,j} = (m1)_{i,j} (m2)_{i,j} $
Examples:
testArray2D.cpp.

Definition at line 933 of file vpArray2D.h.

References vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::dsize, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and vpArray2D< Type >::resize().

◆ init()

vp_deprecated void vpHomogeneousMatrix::init ( )
inline
Deprecated:
Provided only for compat with previous releases. This function does nothing.
Examples:
HelloWorldOgreAdvanced.cpp.

Definition at line 244 of file vpHomogeneousMatrix.h.

Referenced by vpMbGenericTracker::init(), vpMbKltMultiTracker::initClick(), and vpMbEdgeMultiTracker::initFromPose().

◆ insert() [1/4]

◆ insert() [2/4]

void vpHomogeneousMatrix::insert ( const vpThetaUVector tu)

Insert the rotational component of the homogeneous matrix from a $theta {\bf u}$ rotation vector.

Definition at line 603 of file vpHomogeneousMatrix.cpp.

References insert().

◆ insert() [3/4]

void vpHomogeneousMatrix::insert ( const vpTranslationVector t)

Insert the translational component in a homogeneous matrix.

Definition at line 612 of file vpHomogeneousMatrix.cpp.

◆ insert() [4/4]

void vpHomogeneousMatrix::insert ( const vpQuaternionVector q)

Insert the rotational component of the homogeneous matrix from a quaternion rotation vector.

Definition at line 625 of file vpHomogeneousMatrix.cpp.

References insert().

◆ inverse() [1/2]

vpHomogeneousMatrix vpHomogeneousMatrix::inverse ( ) const

Invert the homogeneous matrix

Returns
$\left[\begin{array}{cc} {\bf R} & {\bf t} \\ {\bf 0}_{1\times 3} & 1 \end{array} \right]^{-1} = \left[\begin{array}{cc} {\bf R}^T & -{\bf R}^T {\bf t} \\ {\bf 0}_{1\times 3} & 1 \end{array} \right]$
Examples:
calibrate-hand-eye.cpp, manServo4PointsDisplay.cpp, manServoMomentsSimple.cpp, manSimu4Dots.cpp, manSimu4Points.cpp, mbtGenericTrackingDepthOnly.cpp, photometricVisualServoing.cpp, servoAfma62DhalfCamVelocity.cpp, servoBebop2.cpp, servoFrankaIBVS.cpp, servoFrankaPBVS.cpp, servoMomentImage.cpp, servoSimu3D_cdMc_CamVelocity.cpp, servoSimu3D_cdMc_CamVelocityWithoutVpServo.cpp, servoSimu3D_cMcd_CamVelocity.cpp, servoSimu3D_cMcd_CamVelocityWithoutVpServo.cpp, servoSimu4Points.cpp, servoSimuCircle2DCamVelocity.cpp, servoSimuCircle2DCamVelocityDisplay.cpp, servoSimuCylinder.cpp, servoSimuCylinder2DCamVelocityDisplay.cpp, servoSimuCylinder2DCamVelocityDisplaySecondaryTask.cpp, servoSimuFourPoints2DCamVelocity.cpp, servoSimuFourPoints2DCamVelocityDisplay.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, servoSimuLine2DCamVelocityDisplay.cpp, servoSimuPoint2DCamVelocity1.cpp, servoSimuPoint2DCamVelocity2.cpp, servoSimuPoint2DCamVelocity3.cpp, servoSimuPoint2DhalfCamVelocity1.cpp, servoSimuPoint2DhalfCamVelocity2.cpp, servoSimuPoint2DhalfCamVelocity3.cpp, servoSimuPoint3DCamVelocity.cpp, servoSimuSphere.cpp, servoSimuSphere2DCamVelocity.cpp, servoSimuSphere2DCamVelocityDisplay.cpp, servoSimuSphere2DCamVelocityDisplaySecondaryTask.cpp, servoSimuSquareLine2DCamVelocityDisplay.cpp, servoSimuThetaUCamVelocity.cpp, simulateCircle2DCamVelocity.cpp, simulateFourPoints2DCartesianCamVelocity.cpp, simulateFourPoints2DPolarCamVelocity.cpp, testFeatureSegment.cpp, testRobotViper650-frames.cpp, testRobotViper850-frames.cpp, testVirtuoseHapticBox.cpp, testVirtuoseWithGlove.cpp, tutorial-ibvs-4pts-display.cpp, tutorial-ibvs-4pts-image-tracking.cpp, tutorial-ibvs-4pts-ogre-tracking.cpp, tutorial-ibvs-4pts-ogre.cpp, tutorial-ibvs-4pts-plotter-continuous-gain-adaptive.cpp, tutorial-ibvs-4pts-plotter-gain-adaptive.cpp, tutorial-ibvs-4pts-plotter.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, tutorial-ibvs-4pts.cpp, tutorial-simu-pioneer-continuous-gain-adaptive.cpp, tutorial-simu-pioneer-continuous-gain-constant.cpp, tutorial-simu-pioneer-pan.cpp, and tutorial-simu-pioneer.cpp.

Definition at line 641 of file vpHomogeneousMatrix.cpp.

References extract(), insert(), and vpRotationMatrix::t().

Referenced by vpVirtualGrabber::acquire(), vpKeyPoint::compute3D(), vpKeyPoint::compute3DForPointsOnCylinders(), vpSimulatorViper850::compute_fMi(), vpMbtFaceDepthNormal::computeDesiredNormalAndCentroid(), vpPtu46::computeMGD(), vpBiclops::computeMGD(), vpPoseFeatures::computePose(), vpMbHiddenFaces< vpMbtPolygon >::computeScanLineQuery(), vpMbDepthDenseTracker::computeVVS(), vpMbDepthNormalTracker::computeVVS(), vpMbEdgeKltTracker::computeVVS(), vpMbKltMultiTracker::computeVVS(), vpMbEdgeKltMultiTracker::computeVVS(), vpMbEdgeMultiTracker::computeVVS(), vpMbGenericTracker::computeVVS(), vpMbKltTracker::computeVVS(), vpMbEdgeTracker::computeVVS(), vpMbEdgeMultiTracker::computeVVSFirstPhasePoseEstimation(), vpMbEdgeTracker::computeVVSFirstPhasePoseEstimation(), vpMbKltMultiTracker::computeVVSInteractionMatrixAndResidu(), vpMbEdgeKltMultiTracker::computeVVSInteractionMatrixAndResidu(), vpProjectionDisplay::displayCamera(), vpPtu46::get_cMe(), vpAfma4::get_cMe(), vpViper::get_cMe(), vpAfma6::get_cMe(), vpRobotWireFrameSimulator::get_cMo(), vpRobotFlirPtu::get_cVe(), vpAfma4::get_cVf(), vpViper::get_eJe(), vpViper::get_fJe(), vpBiclops::get_fMc(), vpRobotBiclops::getDisplacement(), vpRobotAfma6::getDisplacement(), vpSimulator::getExternalCameraPosition(), vpSimulatorAfma6::getExternalImage(), vpSimulatorViper850::getExternalImage(), vpWireFrameSimulator::getExternalImage(), vpRobotFranka::getForceTorque(), vpWireFrameSimulator::getInternalImage(), vpRobotWireFrameSimulator::getInternalView(), vpViper::getInverseKinematics(), vpAfma6::getInverseKinematics(), vpRobotAfma4::getVelocity(), vpRobotAfma6::getVelocity(), vpRobotViper650::getVelocity(), vpRobotViper850::getVelocity(), vpSimulatorAfma6::initialiseCameraRelativeToObject(), vpSimulatorViper850::initialiseCameraRelativeToObject(), inverse(), vpSimulator::moveInternalCamera(), vpPose::poseVirtualVS(), vpPose::poseVirtualVSrobust(), vpWireFrameSimulator::projectCameraTrajectory(), vpBiclops::set_cMe(), vpPioneerPan::set_cMe(), vpWireFrameSimulator::setCameraPositionRelObj(), vpWireFrameSimulator::setCameraPositionRelWorld(), vpWireFrameSimulator::setExternalCameraPosition(), vpMbKltTracker::setPose(), vpSimulatorAfma6::setPosition(), vpRobotCamera::setVelocity(), vpSimulatorPioneer::setVelocity(), vpSimulatorPioneerPan::setVelocity(), vpMbGenericTracker::track(), vpKinect::vpKinect(), vpSimulatorPioneer::vpSimulatorPioneer(), and vpSimulatorPioneerPan::vpSimulatorPioneerPan().

◆ inverse() [2/2]

void vpHomogeneousMatrix::inverse ( vpHomogeneousMatrix M) const

Invert the homogeneous matrix.

Parameters
M: The inverted homogeneous matrix: $\left[\begin{array}{cc} {\bf R} & {\bf t} \\ {\bf 0}_{1\times 3} & 1 \end{array} \right]^{-1} = \left[\begin{array}{cc} {\bf R}^T & -{\bf R}^T {\bf t} \\ {\bf 0}_{1\times 3} & 1 \end{array} \right]$

Definition at line 689 of file vpHomogeneousMatrix.cpp.

References inverse().

◆ isAnHomogeneousMatrix()

bool vpHomogeneousMatrix::isAnHomogeneousMatrix ( ) const

Test if the 3x3 rotational part of the homogeneous matrix is really a rotation matrix.

Definition at line 539 of file vpHomogeneousMatrix.cpp.

References extract(), and vpRotationMatrix::isARotationMatrix().

◆ load() [1/2]

void vpHomogeneousMatrix::load ( std::ifstream &  f)

Read an homogeneous matrix from an input file stream. The homogeneous matrix is considered as a 4 by 4 matrix.

Parameters
f: Input file stream.

The code below shows how to get an homogeneous matrix from a file.

std::ifstream f("homogeneous.dat");
M.load(f);
See also
save()
Examples:
mbtGenericTrackingDepth.cpp, mbtGenericTrackingDepthOnly.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, tutorial-mb-generic-tracker-rgbd-blender.cpp, tutorial-mb-generic-tracker-rgbd.cpp, tutorial-mb-generic-tracker-stereo.cpp, and tutorial-mb-tracker-stereo.cpp.

Definition at line 740 of file vpHomogeneousMatrix.cpp.

References vpException::ioError.

◆ load() [2/2]

static bool vpArray2D< double >::load ( const std::string &  filename,
vpArray2D< double > &  A,
bool  binary = false,
char *  header = NULL 
)
inlinestaticinherited

Load a matrix from a file.

Parameters
filename: Absolute file name.
A: Array to be loaded
binary: If true the matrix is loaded from a binary file, else from a text file.
header: Header of the file is loaded in this parameter.
Returns
Returns true if success.
See also
save()

Definition at line 541 of file vpArray2D.h.

References vpException::badValue, and vpArray2D< Type >::resize().

◆ loadYAML()

static bool vpArray2D< double >::loadYAML ( const std::string &  filename,
vpArray2D< double > &  A,
char *  header = NULL 
)
inlinestaticinherited

Load an array from a YAML-formatted file.

Parameters
filename: absolute file name.
A: array to be loaded from the file.
header: header of the file is loaded in this parameter.
Returns
Returns true on success.
See also
saveYAML()
Examples:
servoFlirPtuIBVS.cpp, servoFrankaIBVS.cpp, servoFrankaPBVS.cpp, tutorial-flir-ptu-ibvs.cpp, and tutorial-hand-eye-calibration.cpp.

Definition at line 653 of file vpArray2D.h.

References vpArray2D< Type >::resize().

◆ mean()

vpHomogeneousMatrix vpHomogeneousMatrix::mean ( const std::vector< vpHomogeneousMatrix > &  vec_M)
static

Compute the Euclidean mean of the homogeneous matrices. The Euclidean mean of the rotation matrices is computed following Moakher's method (SIAM 2002).

Parameters
[in]vec_M: Set of homogeneous matrices.
Returns
The Euclidian mean of the homogeneous matrices.
See also
vpTranslationVector::mean(), vpRotationMatrix::mean()

Definition at line 861 of file vpHomogeneousMatrix.cpp.

References getTranslationVector(), vpMatrix::pseudoInverse(), and vpMatrix::t().

◆ operator!=()

bool vpArray2D< double >::operator!= ( const vpArray2D< double > &  A) const
inherited

Not equal to comparison operator of a 2D array.

Definition at line 994 of file vpArray2D.h.

◆ operator*() [1/4]

vpHomogeneousMatrix vpHomogeneousMatrix::operator* ( const vpHomogeneousMatrix M) const

Operator that allow to multiply an homogeneous matrix by an other one.

#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
// Initialize aMb and bMc...
// Compute aMc * bMc
vpHomogeneousMatrix aMc = aMb * bMc;
}

Definition at line 396 of file vpHomogeneousMatrix.cpp.

References extract(), and insert().

◆ operator*() [2/4]

vpColVector vpHomogeneousMatrix::operator* ( const vpColVector v) const

Operator that allow to multiply an homogeneous matrix by a 4-dimension column vector.

Exceptions
vpException::dimensionError: If the vector v is not a 4-dimension vector.

Definition at line 449 of file vpHomogeneousMatrix.cpp.

References vpException::dimensionError, vpArray2D< Type >::getRows(), vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.

◆ operator*() [3/4]

vpTranslationVector vpHomogeneousMatrix::operator* ( const vpTranslationVector t) const

Since a translation vector could be seen as the origin point of a frame, this function computes the new coordinates of a translation vector after applying an homogeneous transformation.

Parameters
t: Translation vector seen as the 3D coordinates of a point.
Returns
A translation vector that contains the new 3D coordinates after applying the homogeneous transformation.

Definition at line 523 of file vpHomogeneousMatrix.cpp.

◆ operator*() [4/4]

vpPoint vpHomogeneousMatrix::operator* ( const vpPoint bP) const

From the coordinates of the point in camera frame b and the transformation between camera frame a and camera frame b computes the coordinates of the point in camera frame a.

Parameters
bP: 3D coordinates of the point in camera frame bP.
Returns
A point with 3D coordinates in the camera frame a. The coordinates in the world or object frame are set to the same coordinates than the one in the camera frame.

Definition at line 481 of file vpHomogeneousMatrix.cpp.

References vpPoint::get_W(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpPoint::set_oW(), vpPoint::set_oX(), vpPoint::set_oY(), vpPoint::set_oZ(), vpPoint::set_W(), vpPoint::set_X(), vpPoint::set_Y(), and vpPoint::set_Z().

◆ operator*=()

vpHomogeneousMatrix & vpHomogeneousMatrix::operator*= ( const vpHomogeneousMatrix M)

Operator that allow to multiply an homogeneous matrix by an other one.

#include <visp3/core/vpHomogeneousMatrix.h>
int main()
{
// Initialize M1 and M2...
// Compute M1 = M1 * M2
M1 *= M2;
}

Definition at line 436 of file vpHomogeneousMatrix.cpp.

◆ operator=()

vpHomogeneousMatrix & vpHomogeneousMatrix::operator= ( const vpHomogeneousMatrix M)

Copy operator that allows to set an homogeneous matrix from an other one.

Parameters
M: Matrix to copy.

Definition at line 369 of file vpHomogeneousMatrix.cpp.

References vpArray2D< double >::rowPtrs, and vpArray2D< Type >::rowPtrs.

◆ operator==() [1/2]

bool vpArray2D< double >::operator== ( const vpArray2D< double > &  A) const
inherited

Equal to comparison operator of a 2D array.

Definition at line 949 of file vpArray2D.h.

References vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpArray2D< Type >::operator==(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::size().

◆ operator==() [2/2]

bool vpArray2D< float >::operator== ( const vpArray2D< float > &  A) const
inlineinherited

◆ operator[]() [1/2]

double * vpArray2D< double >::operator[] ( unsigned int  i)
inlineinherited

Set element $A_{ij} = x$ using A[i][j] = x.

Definition at line 485 of file vpArray2D.h.

◆ operator[]() [2/2]

double * vpArray2D< double >::operator[] ( unsigned int  i) const
inlineinherited

Get element $x = A_{ij}$ using x = A[i][j].

Definition at line 487 of file vpArray2D.h.

◆ print()

void vpHomogeneousMatrix::print ( ) const

◆ reshape()

void vpArray2D< double >::reshape ( unsigned int  nrows,
unsigned int  ncols 
)
inlineinherited

◆ resize() [1/2]

void vpHomogeneousMatrix::resize ( unsigned int  nrows,
unsigned int  ncols,
bool  flagNullify = true 
)
inline

This function is not applicable to an homogeneous matrix that is always a 4-by-4 matrix.

Exceptions
vpException::fatalErrorWhen this function is called.

Definition at line 225 of file vpHomogeneousMatrix.h.

References vpException::fatalError.

◆ resize() [2/2]

void vpArray2D< double >::resize ( unsigned int  nrows,
unsigned int  ncols,
bool  flagNullify = true,
bool  recopy_ = true 
)
inlineinherited

Set the size of the array and initialize all the values to zero.

Parameters
nrows: number of rows.
ncols: number of column.
flagNullify: if true, then the array is re-initialized to 0 after resize. If false, the initial values from the common part of the array (common part between old and new version of the array) are kept. Default value is true.
recopy_: if true, will perform an explicit recopy of the old data if needed and if flagNullify is set to false.
Examples:
testArray2D.cpp, testMatrix.cpp, testMatrixConditionNumber.cpp, testMatrixDeterminant.cpp, testMatrixInitialization.cpp, testMatrixInverse.cpp, testMatrixPseudoInverse.cpp, and testSvd.cpp.

Definition at line 305 of file vpArray2D.h.

References vpArray2D< Type >::colNum, vpArray2D< Type >::dsize, vpException::memoryAllocationError, vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.

Referenced by vpMatrix::diag(), vpMatrix::eye(), vpMatrix::init(), vpMatrix::operator,(), vpMatrix::operator<<(), vpMatrix::operator=(), vpMatrix::stack(), and vpMatrix::svdOpenCV().

◆ save() [1/2]

void vpHomogeneousMatrix::save ( std::ofstream &  f) const

Write an homogeneous matrix in an output file stream.

Parameters
f: Output file stream. The homogeneous matrix is saved as a 4 by 4 matrix.

The code below shows how to save an homogeneous matrix in a file.

// Contruct an homogeneous matrix
vpRxyzVector r(M_PI, 0, -M_PI/4.);
// Save the content of the matrix in "homogeneous.dat"
std::ofstream f("homogeneous.dat");
M.save(f);
See also
load()
Examples:
servoAfma6Points2DCamVelocityEyeToHand.cpp, and tutorial-hand-eye-calibration.cpp.

Definition at line 713 of file vpHomogeneousMatrix.cpp.

References vpException::ioError.

Referenced by vpViewer::resize().

◆ save() [2/2]

static bool vpArray2D< double >::save ( const std::string &  filename,
const vpArray2D< double > &  A,
bool  binary = false,
const char *  header = "" 
)
inlinestaticinherited

Save a matrix to a file.

Parameters
filename: Absolute file name.
A: Array to be saved.
binary: If true the matrix is saved in a binary file, else a text file.
header: Optional line that will be saved at the beginning of the file.
Returns
Returns true if success.

Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.

See also
load()

Definition at line 738 of file vpArray2D.h.

References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().

◆ saveYAML()

static bool vpArray2D< double >::saveYAML ( const std::string &  filename,
const vpArray2D< double > &  A,
const char *  header = "" 
)
inlinestaticinherited

Save an array in a YAML-formatted file.

Parameters
filename: absolute file name.
A: array to be saved in the file.
header: optional lines that will be saved at the beginning of the file. Should be YAML-formatted and will adapt to the indentation if any.
Returns
Returns true if success.

Here is an example of outputs.

vpArray2D::saveYAML("matrix.yml", M, "example: a YAML-formatted header");
vpArray2D::saveYAML("matrixIndent.yml", M, "example:\n - a YAML-formatted
header\n - with inner indentation");

Content of matrix.yml:

example: a YAML-formatted header
rows: 3
cols: 4
- [0, 0, 0, 0]
- [0, 0, 0, 0]
- [0, 0, 0, 0]

Content of matrixIndent.yml:

example:
- a YAML-formatted header
- with inner indentation
rows: 3
cols: 4
- [0, 0, 0, 0]
- [0, 0, 0, 0]
- [0, 0, 0, 0]
See also
loadYAML()
Examples:
tutorial-chessboard-pose.cpp, tutorial-franka-acquire-calib-data.cpp, and tutorial-hand-eye-calibration.cpp.

Definition at line 831 of file vpArray2D.h.

References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().

◆ setIdentity()

void vpHomogeneousMatrix::setIdentity ( )
Deprecated:
You should rather use eye().
Deprecated:
You should rather use eye().

Set homogeneous matrix to identity.

See also
eye()

Definition at line 904 of file vpHomogeneousMatrix.cpp.

References eye().

◆ size()

Friends And Related Function Documentation

◆ vpGEMM()

void vpGEMM ( const vpArray2D< double > &  A,
const vpArray2D< double > &  B,
const double &  alpha,
const vpArray2D< double > &  C,
const double &  beta,
vpArray2D< double > &  D,
const unsigned int &  ops = 0 
)
related

This function performs generalized matrix multiplication: D = alpha*op(A)*op(B) + beta*op(C), where op(X) is X or X^T. Operation on A, B and C matrices is described by enumeration vpGEMMmethod().

For example, to compute D = alpha*A^T*B^T+beta*C we need to call :

vpGEMM(A, B, alpha, C, beta, D, VP_GEMM_A_T + VP_GEMM_B_T);

If C is not used, vpGEMM must be called using an empty array null. Thus to compute D = alpha*A^T*B, we have to call:

vpGEMM(A, B, alpha, null, 0, D, VP_GEMM_B_T);
Exceptions
vpException::incorrectMatrixSizeErrorif the sizes of the matrices do not allow the operations.
Parameters
A: An array that could be a vpMatrix.
B: An array that could be a vpMatrix.
alpha: A scalar.
C: An array that could be a vpMatrix.
beta: A scalar.
D: The resulting array that could be a vpMatrix.
ops: A scalar describing operation applied on the matrices. Possible values are the one defined in vpGEMMmethod(): VP_GEMM_A_T, VP_GEMM_B_T, VP_GEMM_C_T.

Definition at line 393 of file vpGEMM.h.

References vpException::functionNotImplementedError.

◆ vpGEMMmethod

enum vpGEMMmethod
related

Enumeration of the operations applied on matrices in vpGEMM() function.

Operations are :

  • VP_GEMM_A_T to use the transpose matrix of A instead of the matrix A
  • VP_GEMM_B_T to use the transpose matrix of B instead of the matrix B
  • VP_GEMM_C_T to use the transpose matrix of C instead of the matrix C

Definition at line 57 of file vpGEMM.h.

Member Data Documentation

◆ colNum

unsigned int vpArray2D< double >::colNum
protectedinherited

Number of columns in the array.

Definition at line 137 of file vpArray2D.h.

Referenced by vpMatrix::AAt(), vpMatrix::AtA(), vpColVector::clear(), vpMatrix::detByLU(), vpMatrix::detByLUEigen3(), vpMatrix::detByLUGsl(), vpMatrix::detByLULapack(), vpMatrix::detByLUOpenCV(), vpMatrix::diag(), vpMatrix::eigenValues(), vpMatrix::expm(), vpMatrix::eye(), vpMatrix::getDiag(), vpMatrix::getRow(), vpColVector::hadamard(), vpMatrix::hadamard(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpRowVector::insert(), vpMatrix::insert(), vpMatrix::inverseByCholeskyLapack(), vpMatrix::inverseByCholeskyOpenCV(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByLUGsl(), vpMatrix::inverseByLULapack(), vpMatrix::inverseByLUOpenCV(), vpMatrix::inverseByQRLapack(), vpMatrix::inverseTriangular(), vpRotationMatrix::operator*(), vpRowVector::operator*(), vpMatrix::operator*(), vpRotationMatrix::operator*=(), vpRowVector::operator*=(), vpMatrix::operator*=(), vpRowVector::operator+(), vpRowVector::operator+=(), vpMatrix::operator+=(), vpRowVector::operator,(), vpMatrix::operator,(), vpRowVector::operator-(), vpRowVector::operator-=(), vpMatrix::operator-=(), vpRowVector::operator/(), vpMatrix::operator/(), vpRowVector::operator/=(), vpMatrix::operator/=(), vpMatrix::operator<<(), vpColVector::operator<<(), vpSubRowVector::operator=(), vpSubMatrix::operator=(), vpRowVector::operator=(), vpColVector::operator=(), vpMatrix::operator=(), vpRowVector::operator==(), vpColVector::operator==(), vpMatrix::qr(), vpMatrix::qrPivot(), vpRowVector::reshape(), vpMatrix::setIdentity(), vpMatrix::solveByQR(), vpMatrix::solveBySVD(), vpMatrix::stack(), vpRowVector::stack(), vpMatrix::stackColumns(), vpMatrix::stackRows(), vpRowVector::sum(), vpMatrix::sum(), vpRowVector::sumSquare(), vpMatrix::sumSquare(), vpRowVector::t(), vpMatrix::transpose(), vpColVector::vpColVector(), vpMatrix::vpMatrix(), and vpRowVector::vpRowVector().

◆ data

double * vpArray2D< double >::data
inherited

Address of the first element of the data array.

Examples:
testArray2D.cpp, testDisplacement.cpp, testEigenConversion.cpp, testImageFilter.cpp, testMatrix.cpp, testTranslationVector.cpp, and tutorial-matlab.cpp.

Definition at line 145 of file vpArray2D.h.

Referenced by vpMatrix::AtA(), vpQuaternionVector::buildFrom(), buildFrom(), vpThetaUVector::buildFrom(), vpRzyzVector::buildFrom(), vpRxyzVector::buildFrom(), vpRzyxVector::buildFrom(), vpSubColVector::checkParentStatus(), vpSubRowVector::checkParentStatus(), vpSubMatrix::checkParentStatus(), vpColVector::clear(), convert(), vpMatrix::detByLUEigen3(), vpMatrix::detByLUOpenCV(), vpMatrix::expm(), vpThetaUVector::extract(), vpMatrix::frobeniusNorm(), vpMatrix::getRow(), vpThetaUVector::getTheta(), vpThetaUVector::getU(), vpColVector::hadamard(), vpMatrix::hadamard(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpColVector::insert(), vpMatrix::insert(), vpMatrix::inverseByCholeskyOpenCV(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByLUOpenCV(), vpTranslationVector::operator*(), vpRowVector::operator*(), vpHomography::operator*(), vpColVector::operator*(), vpMatrix::operator*(), vpRotationVector::operator,(), vpTranslationVector::operator,(), vpRotationMatrix::operator,(), vpRowVector::operator,(), vpColVector::operator,(), vpTranslationVector::operator-(), vpRowVector::operator-(), vpColVector::operator-(), vpTranslationVector::operator/(), vpRowVector::operator/(), vpHomography::operator/(), vpColVector::operator/(), vpHomography::operator/=(), vpRotationVector::operator<<(), vpTranslationVector::operator<<(), vpRotationMatrix::operator<<(), vpRowVector::operator<<(), vpColVector::operator<<(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpQuaternionVector::operator=(), vpTranslationVector::operator=(), vpRotationMatrix::operator=(), vpRxyzVector::operator=(), vpRzyzVector::operator=(), vpRzyxVector::operator=(), vpRowVector::operator=(), vpThetaUVector::operator=(), vpColVector::operator=(), vpMatrix::operator=(), vpRowVector::operator==(), vpColVector::operator==(), vpColVector::operator[](), vpMatrix::qr(), vpMatrix::qrPivot(), vpRowVector::reshape(), vpColVector::reshape(), vpQuaternionVector::set(), vpMatrix::stack(), vpMatrix::stackRows(), vpColVector::sum(), vpColVector::sumSquare(), vpMatrix::svdEigen3(), vpMatrix::svdGsl(), vpMatrix::svdLapack(), vpMatrix::svdOpenCV(), vpRotationVector::t(), vpTranslationVector::t(), vpPoseVector::t(), vpRowVector::t(), vpColVector::t(), vpRotationVector::toStdVector(), vpRowVector::toStdVector(), vpColVector::toStdVector(), vpColVector::vpColVector(), vpMatrix::vpMatrix(), vpRowVector::vpRowVector(), vpQuaternionVector::w(), vpQuaternionVector::x(), vpQuaternionVector::y(), vpQuaternionVector::z(), vpSubColVector::~vpSubColVector(), vpSubMatrix::~vpSubMatrix(), and vpSubRowVector::~vpSubRowVector().

◆ dsize

◆ rowNum

unsigned int vpArray2D< double >::rowNum
protectedinherited

Number of rows in the array.

Definition at line 135 of file vpArray2D.h.

Referenced by vpMatrix::AAt(), vpMatrix::AtA(), vpColVector::clear(), vpMatrix::detByLU(), vpMatrix::detByLUEigen3(), vpMatrix::detByLUGsl(), vpMatrix::detByLULapack(), vpMatrix::detByLUOpenCV(), vpMatrix::diag(), vpMatrix::eigenValues(), vpMatrix::expm(), vpColVector::extract(), vpMatrix::eye(), vpMatrix::getCol(), vpMatrix::getDiag(), vpMatrix::getRow(), vpColVector::hadamard(), vpMatrix::hadamard(), vpColVector::infinityNorm(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpMatrix::insert(), vpMatrix::inverseByCholeskyLapack(), vpMatrix::inverseByCholeskyOpenCV(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByLUGsl(), vpMatrix::inverseByLULapack(), vpMatrix::inverseByLUOpenCV(), vpMatrix::inverseByQRLapack(), vpMatrix::inverseTriangular(), vpTranslationVector::operator*(), vpRotationMatrix::operator*(), operator*(), vpColVector::operator*(), vpMatrix::operator*(), vpTranslationVector::operator*=(), vpRotationMatrix::operator*=(), vpColVector::operator*=(), vpMatrix::operator*=(), vpColVector::operator+(), vpColVector::operator+=(), vpMatrix::operator+=(), vpColVector::operator,(), vpColVector::operator-(), vpColVector::operator-=(), vpMatrix::operator-=(), vpColVector::operator/(), vpMatrix::operator/(), vpTranslationVector::operator/=(), vpColVector::operator/=(), vpMatrix::operator/=(), vpMatrix::operator<<(), vpColVector::operator<<(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpSubMatrix::operator=(), vpTranslationVector::operator=(), vpRowVector::operator=(), vpColVector::operator=(), vpMatrix::operator=(), vpRowVector::operator==(), vpColVector::operator==(), vpMatrix::qr(), vpMatrix::qrPivot(), vpColVector::reshape(), vpMatrix::setIdentity(), vpMatrix::stack(), vpColVector::stack(), vpMatrix::stackColumns(), vpMatrix::stackRows(), vpColVector::sum(), vpMatrix::sum(), vpRotationVector::sumSquare(), vpTranslationVector::sumSquare(), vpColVector::sumSquare(), vpMatrix::sumSquare(), vpTranslationVector::t(), vpPoseVector::t(), vpColVector::t(), vpMatrix::transpose(), vpColVector::vpColVector(), vpMatrix::vpMatrix(), and vpRowVector::vpRowVector().

◆ rowPtrs