Visual Servoing Platform version 3.7.0
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
38
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 });
47}
48
49void vpRBFeatureTracker::updateCovariance(const double lambda)
50{
51 vpMatrix D;
54}
55
56void 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
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
85END_VISP_NAMESPACE
unsigned int getCols() const
Definition vpArray2D.h:423
Type * data
Address of the first element of the data array.
Definition vpArray2D.h:149
unsigned int getRows() const
Definition vpArray2D.h:433
Implementation of column vector and the associated operations.
vpRowVector t() const
void resize(unsigned int i, bool flagNullify=true)
error that can be emitted by the vpMatrix class and its derivatives
@ incorrectMatrixSizeError
Incorrect matrix size.
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:175
void diag(const double &val=1.0)
vpMatrix t() const
std::shared_ptr< vpTemporalWeighting > m_weighting
Number of considered features.
bool m_jacobianInObjectSpace
Matrix representation of the estimated DOFS.
bool m_enableDisplay
Whether VVS has converged, should be updated every VVS iteration.
static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &b, const vpMatrix &W)
vpColVector m_covWeightDiag
Covariance matrix.
void setEstimatedDofs(const std::array< bool, 6 > &dofs)
static void computeJTR(const vpMatrix &interaction, const vpColVector &error, vpColVector &JTR)
bool m_vvsConverged
User-defined weight for this specific type of feature.
virtual void updateCovariance(const double lambda)
Update the covariance matrix.
unsigned m_numFeatures
Error weights.
vpMatrix m_cov
Right side of the Gauss Newton minimization.