37 #include <visp3/core/vpColVector.h>
38 #include <visp3/core/vpConfig.h>
39 #include <visp3/core/vpHomogeneousMatrix.h>
40 #include <visp3/core/vpMatrix.h>
41 #include <visp3/core/vpMatrixException.h>
42 #include <visp3/core/vpTranslationVector.h>
59 double denom = (
static_cast<double>(A.
getRows()));
61 if (denom <= std::numeric_limits<double>::epsilon()) {
63 "Impossible to compute covariance matrix: not enough data");
68 double sigma2 = (b - (A * x)).t() * (b - (A * x));
93 unsigned int w_cols = W.
getCols();
94 for (
unsigned int i = 0; i < w_cols; ++i) {
96 W2[i][i] = W[i][i] * W[i][i];
99 if (denom <= std::numeric_limits<double>::epsilon()) {
101 "Impossible to compute covariance matrix: not enough data");
106 double sigma2 = ((W * b) - (W * A * x)).
t() * ((W * b) - (W * A * x));
109 return (A.
t() * W2 * A).
pseudoInverse(A.
getCols() * std::numeric_limits<double>::epsilon()) * sigma2;
164 const unsigned int index_0 = 0;
165 const unsigned int index_1 = 1;
166 const unsigned int index_2 = 2;
167 LpInv[index_0][index_0] = -1.0;
168 LpInv[index_1][index_1] = -1.0;
169 LpInv[index_2][index_2] = -1.0;
180 const unsigned int val_3 = 3;
181 for (
unsigned int i = 0; i < val_3; ++i) {
185 double theta = sqrt(tu.sumSquare());
192 LthetauInvAnalytic = -I3;
194 if ((theta / (2.0 * M_PI)) > std::numeric_limits<double>::epsilon()) {
197 for (
unsigned int i = 0; i < val_3; ++i) {
198 theta2u[i] = tu[i] / 2.0;
203 for (
unsigned int i = 0; i < val_3; ++i) {
204 u[i] = tu[i] / theta;
208 LthetauInvAnalytic +=
214 ctoInitSkew = ctoInitSkew * LthetauInvAnalytic;
216 const unsigned int index_3 = 3;
217 for (
unsigned int a = 0; a < val_3; ++a) {
218 for (
unsigned int b = 0; b < val_3; ++b) {
219 LpInv[a][b + index_3] = ctoInitSkew[a][b];
223 for (
unsigned int a = 0; a < val_3; ++a) {
224 for (
unsigned int b = 0; b < val_3; ++b) {
225 LpInv[a + index_3][b + index_3] = LthetauInvAnalytic[a][b];
unsigned int getCols() const
unsigned int getRows() const
Implementation of column vector and the associated operations.
static vpMatrix skew(const vpColVector &v)
@ divideByZeroError
Division by zero.
Implementation of an homogeneous matrix and operations on such kind of matrices.
void extract(vpRotationMatrix &R) const
static double sinc(double x)
static double sqr(double x)
error that can be emitted by the vpMatrix class and its derivatives
Implementation of a matrix and operations on matrices.
static vpMatrix computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS, const vpMatrix &Ls, const vpMatrix &W)
vpMatrix pseudoInverse(double svThreshold=1e-6) const
static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &x, const vpColVector &b)
Implementation of a rotation vector as axis-angle minimal representation.
Class that consider the case of a translation vector.