Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpRBFeatureTracker.cpp
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2024 by Inria. All rights reserved.
4
*
5
* This software is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
* See the file LICENSE.txt at the root directory of this source
10
* distribution for additional information about the GNU GPL.
11
*
12
* For using ViSP with software that can not be combined with the GNU
13
* GPL, please contact Inria about acquiring a ViSP Professional
14
* Edition License.
15
*
16
* See https://visp.inria.fr for more information.
17
*
18
* This software was developed at:
19
* Inria Rennes - Bretagne Atlantique
20
* Campus Universitaire de Beaulieu
21
* 35042 Rennes Cedex
22
* France
23
*
24
* If you have questions regarding the use of this file, please contact
25
* Inria at visp@inria.fr
26
*
27
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29
*/
30
31
#include <visp3/rbt/vpRBFeatureTracker.h>
32
33
#if defined(VISP_HAVE_SIMDLIB)
34
#include <Simd/SimdLib.h>
35
#endif
36
37
BEGIN_VISP_NAMESPACE
38
39
vpRBFeatureTracker::vpRBFeatureTracker
()
40
{
41
m_numFeatures
= 0;
42
m_weighting
= std::make_shared<vpFixedTemporalWeighting>(1.0);
43
m_vvsConverged
=
false
;
44
m_enableDisplay
=
true
;
45
setEstimatedDofs
({
true
,
true
,
true
,
true
,
true
,
true
});
46
m_jacobianInObjectSpace
=
false
;
47
}
48
49
void
vpRBFeatureTracker::updateCovariance
(
const
double
lambda)
50
{
51
vpMatrix
D;
52
D.
diag
(
m_covWeightDiag
);
53
m_cov
=
computeCovarianceMatrix
(
m_L
, lambda *
m_error
, D);
54
}
55
56
void
vpRBFeatureTracker::computeJTR
(
const
vpMatrix
&interaction,
const
vpColVector
&error,
vpColVector
&JTR)
57
{
58
if
(interaction.
getRows
() != error.getRows() || interaction.
getCols
() != 6) {
59
throw
vpMatrixException
(
vpMatrixException::incorrectMatrixSizeError
,
"Incorrect matrices size in computeJTR."
);
60
}
61
62
JTR.
resize
(6,
false
);
63
#if defined(VISP_HAVE_SIMDLIB)
64
SimdComputeJtR(interaction.
data
, interaction.
getRows
(), error.data, JTR.
data
);
65
#else
66
const
unsigned
int
N = interaction.
getRows
();
67
68
for
(
unsigned
int
i = 0; i < 6; ++i) {
69
double
ssum = 0;
70
for
(
unsigned
int
j = 0; j < N; ++j) {
71
ssum += interaction[j][i] * error[j];
72
}
73
JTR[i] = ssum;
74
}
75
#endif
76
}
77
78
vpMatrix
vpRBFeatureTracker::computeCovarianceMatrix
(
const
vpMatrix
&DJ,
const
vpColVector
&e,
const
vpMatrix
&covDiag)
79
{
80
const
vpColVector
covDiagE = covDiag * e;
81
double
sigma2 = (covDiagE.
t
() * covDiag * e) / (
static_cast<
double
>
(e.getRows()));
82
return
(DJ.
t
() * covDiag * DJ).pseudoInverse() * sigma2;
83
}
84
85
END_VISP_NAMESPACE
vpArray2D::getCols
unsigned int getCols() const
Definition
vpArray2D.h:423
vpArray2D::data
Type * data
Address of the first element of the data array.
Definition
vpArray2D.h:149
vpArray2D::getRows
unsigned int getRows() const
Definition
vpArray2D.h:433
vpColVector
Implementation of column vector and the associated operations.
Definition
vpColVector.h:191
vpColVector::t
vpRowVector t() const
Definition
vpColVector.cpp:558
vpColVector::resize
void resize(unsigned int i, bool flagNullify=true)
Definition
vpColVector.h:1159
vpMatrixException
error that can be emitted by the vpMatrix class and its derivatives
Definition
vpMatrixException.h:50
vpMatrixException::incorrectMatrixSizeError
@ incorrectMatrixSizeError
Incorrect matrix size.
Definition
vpMatrixException.h:69
vpMatrix
Implementation of a matrix and operations on matrices.
Definition
vpMatrix.h:175
vpMatrix::diag
void diag(const double &val=1.0)
Definition
vpMatrix_operations.cpp:878
vpMatrix::t
vpMatrix t() const
Definition
vpMatrix_operations.cpp:46
vpRBFeatureTracker::vpRBFeatureTracker
vpRBFeatureTracker()
Definition
vpRBFeatureTracker.cpp:39
vpRBFeatureTracker::m_weighting
std::shared_ptr< vpTemporalWeighting > m_weighting
Number of considered features.
Definition
vpRBFeatureTracker.h:310
vpRBFeatureTracker::m_jacobianInObjectSpace
bool m_jacobianInObjectSpace
Matrix representation of the estimated DOFS.
Definition
vpRBFeatureTracker.h:317
vpRBFeatureTracker::m_error
vpColVector m_error
Definition
vpRBFeatureTracker.h:304
vpRBFeatureTracker::m_enableDisplay
bool m_enableDisplay
Whether VVS has converged, should be updated every VVS iteration.
Definition
vpRBFeatureTracker.h:314
vpRBFeatureTracker::m_L
vpMatrix m_L
Definition
vpRBFeatureTracker.h:298
vpRBFeatureTracker::computeCovarianceMatrix
static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &b, const vpMatrix &W)
Definition
vpRBFeatureTracker.cpp:78
vpRBFeatureTracker::m_covWeightDiag
vpColVector m_covWeightDiag
Covariance matrix.
Definition
vpRBFeatureTracker.h:302
vpRBFeatureTracker::setEstimatedDofs
void setEstimatedDofs(const std::array< bool, 6 > &dofs)
Definition
vpRBFeatureTracker.h:255
vpRBFeatureTracker::computeJTR
static void computeJTR(const vpMatrix &interaction, const vpColVector &error, vpColVector &JTR)
Definition
vpRBFeatureTracker.cpp:56
vpRBFeatureTracker::m_vvsConverged
bool m_vvsConverged
User-defined weight for this specific type of feature.
Definition
vpRBFeatureTracker.h:312
vpRBFeatureTracker::updateCovariance
virtual void updateCovariance(const double lambda)
Update the covariance matrix.
Definition
vpRBFeatureTracker.cpp:49
vpRBFeatureTracker::m_numFeatures
unsigned m_numFeatures
Error weights.
Definition
vpRBFeatureTracker.h:309
vpRBFeatureTracker::m_cov
vpMatrix m_cov
Right side of the Gauss Newton minimization.
Definition
vpRBFeatureTracker.h:301
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
modules
tracker
rbt
src
features
vpRBFeatureTracker.cpp
Generated by
1.17.0