Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
UnscentedTransform.hh
1 
2 /*
3 This file is part of the BIAS library (Basic ImageAlgorithmS).
4 
5 Copyright (C) 2003-2009 (see file CONTACT for details)
6  Multimediale Systeme der Informationsverarbeitung
7  Institut fuer Informatik
8  Christian-Albrechts-Universitaet Kiel
9 
10 
11 BIAS is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
15 
16 BIAS is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU Lesser General Public License for more details.
20 
21 You should have received a copy of the GNU Lesser General Public License
22 along with BIAS; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25 
26 #ifndef _UnscentedTransform_hh_
27 #define _UnscentedTransform_hh_
28 
29 #include <MathAlgo/UncertaintyTransformBase.hh>
30 #include <Base/Math/Vector.hh>
31 
32 #include <vector>
33 
34 namespace BIAS {
35 
36  // forward declaration
37  template <class T> class BIASMathBase_EXPORT Matrix;
38 
39  struct BIASMathAlgo_EXPORT WeightedSigmaPoint
40  {
42  double weight_mean;
43  double weight_cov;
44  };
45 
46  /** @class UnscentedTransform
47  * @ingroup g_mathalgo
48  @brief uses the unscented transformation to map a normal distribututed
49  random variable using a nonlinear transformation
50 
51  See S.J.Julier and J.K.Uhlmann "A New Extension of the Kalman Filter to
52  Nonlinear Systems" for a detailed description of the unscented transform.
53  The unscented transform approximates the transformation of the covariance
54  matrix up to second order of the according Taylor series.
55 
56  To use this class derive from it and implement the non linear
57  transformation function Transform_().
58 
59  @author woelk 01/2006 (tested) */
60  class BIASMathAlgo_EXPORT UnscentedTransform
62  {
63  public:
65 
66  virtual ~UnscentedTransform();
67 
68  /** @brief computes the second order approximation of the
69  transformations of the mean and the associated covariance for the
70  point transformation Transform_().
71  @returns 0 on success
72  -1 when transformation of mean failed
73  +1 when transfromation of sigma point failed */
74  int Transform(const Vector<double>& src_mean,
75  const Matrix<double>& src_cov,
76  Vector<double>& dst_mean, Matrix<double>& dst_cov) const;
77 
78  /** Sets the alpha parameter.
79  The alpha parameter determines the spread of the sigma points */
80  inline void SetAlpha(const double alpha)
81  { Alpha_ = alpha; }
82 
83  /** Sets the beta parameter.
84  beta is used to incorporate prior knowledge of the distribution of x.
85  For Gaussian distributions beta = 2.0 is optiomal */
86  inline void SetBeta(const double beta)
87  { Beta_ = beta; }
88 
89  inline void SetUseSVD(const bool use_svd)
90  { UseSVD_ = use_svd; }
91 
92  protected:
93  /** the alpha parameter determines the spread of the sigma points */
94  double Alpha_;
95  /** beta is used to incorporate prior knowledge of the distribution of x.
96  For Gaussian distributions beta = 2.0 is optiomal */
97  double Beta_;
98  /** kappa is a secondary scaling parameter. In other papers from Uhlman
99  kappa is fixed to 1.0 */
100  double Kappa_;
101 
102  bool UseSVD_;
103 
104  /** The covariance of a n-dimensional vector is approximated using 2n+1
105  so called sigma points with associated weights. The points and weights
106  are computed in this function
107  @return 0=ok, <0 on error (bad cov, ...)
108  */
109  int ComputeSigmaPoints_(const Vector<double>& src_mean,
110  const Matrix<double>& src_cov,
111  std::vector<WeightedSigmaPoint>& sigma_points)
112  const;
113 
114  /** @brief implements a point transformation
115  @returns 0 on success */
116  virtual int Transform_(const Vector<double>& src,
117  Vector<double>& dst) const = 0;
118 
119  }; // class
120 
121 } // namespace
122 
123 #endif // _UnscentedTransform_hh_
void SetBeta(const double beta)
Sets the beta parameter.
class BIASMathBase_EXPORT Matrix
Definition: Operators.hh:37
void SetUseSVD(const bool use_svd)
base class for all uncertainty transforms
double Alpha_
the alpha parameter determines the spread of the sigma points
uses the unscented transformation to map a normal distribututed random variable using a nonlinear tra...
double Beta_
beta is used to incorporate prior knowledge of the distribution of x.
double Kappa_
kappa is a secondary scaling parameter.
void SetAlpha(const double alpha)
Sets the alpha parameter.