SLAMflex SE  0.1.0
SLAMflex provides detection and tracking of dominant planes for smartphone devices. This plane can then be used to show AR content relative to the plane orientation. The detection of plane is performed in the field of view of the smartphone camera. In subsequent frames it is tracked. The interface returns the plane position and orientation.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TooN::WLS< Size, Precision, Decomposition > Class Template Reference

#include <wls.h>

Public Member Functions

 WLS (int size=0)
 Default constructor or construct with the number of dimensions for the Dynamic case. More...
 
void clear ()
 Clear all the measurements and apply a constant regularisation term. More...
 
void add_prior (Precision val)
 
template<class B2 >
void add_prior (const Vector< Size, Precision, B2 > &v)
 
template<class B2 >
void add_prior (const Matrix< Size, Size, Precision, B2 > &m)
 
template<class B2 >
void add_mJ (Precision m, const Vector< Size, Precision, B2 > &J, Precision weight=1)
 
template<int N, class B1 , class B2 , class B3 >
void add_mJ (const Vector< N, Precision, B1 > &m, const Matrix< Size, N, Precision, B2 > &J, const Matrix< N, N, Precision, B3 > &invcov)
 
template<int N, class B1 , class B2 , class B3 >
void add_mJ_rows (const Vector< N, Precision, B1 > &m, const Matrix< N, Size, Precision, B2 > &J, const Matrix< N, N, Precision, B3 > &invcov)
 
template<int N, int S1, class B1 , class B2 , class B3 >
void add_sparse_mJ_rows (const Vector< N, Precision, B1 > &m, const Matrix< N, S1, Precision, B2 > &J1, const int index1, const Matrix< N, N, Precision, B3 > &invcov)
 
template<int N, int S1, int S2, class B1 , class B2 , class B3 , class B4 >
void add_sparse_mJ_rows (const Vector< N, Precision, B1 > &m, const Matrix< N, S1, Precision, B2 > &J1, const int index1, const Matrix< N, S2, Precision, B3 > &J2, const int index2, const Matrix< N, N, Precision, B4 > &invcov)
 
void compute ()
 
void operator+= (const WLS &meas)
 
Matrix< Size, Size, Precision > & get_C_inv ()
 Returns the inverse covariance matrix. More...
 
const Matrix< Size, Size, Precision > & get_C_inv () const
 Returns the inverse covariance matrix. More...
 
Vector< Size, Precision > & get_mu ()
 Returns the update. With no prior, this is the result of $J^\dagger e$. More...
 
const Vector< Size, Precision > & get_mu () const
 Returns the update. With no prior, this is the result of $J^\dagger e$. More...
 
Vector< Size, Precision > & get_vector ()
 Returns the vector $J^{\mathsf T} e$. More...
 
const Vector< Size, Precision > & get_vector () const
 Returns the vector $J^{\mathsf T} e$. More...
 
Decomposition< Size, Precision > & get_decomposition ()
 Return the decomposition object used to compute $(J^{\mathsf T} J + P)^{-1}$. More...
 
const Decomposition< Size, Precision > & get_decomposition () const
 Return the decomposition object used to compute $(J^{\mathsf T} J + P)^{-1}$. More...
 

Private Member Functions

 WLS (WLS &copyof)
 
int operator= (WLS &copyof)
 

Private Attributes

Matrix< Size, Size, Precision > my_C_inv
 
Vector< Size, Precision > my_vector
 
Decomposition< Size, Precision > my_decomposition
 
Vector< Size, Precision > my_mu
 

Detailed Description

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
class TooN::WLS< Size, Precision, Decomposition >

Performs Gauss-Newton weighted least squares computation.

Parameters
SizeThe number of dimensions in the system
PrecisionThe numerical precision used (double, float etc)
DecompositionThe class used to invert the inverse Covariance matrix (must have one integer size and one typename precision template arguments) this is Cholesky by default, but could also be SQSVD

Definition at line 48 of file wls.h.

Constructor & Destructor Documentation

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
TooN::WLS< Size, Precision, Decomposition >::WLS ( int  size = 0)
inline

Default constructor or construct with the number of dimensions for the Dynamic case.

Definition at line 52 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
TooN::WLS< Size, Precision, Decomposition >::WLS ( WLS< Size, Precision, Decomposition > &  copyof)
private

Member Function Documentation

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
template<class B2 >
void TooN::WLS< Size, Precision, Decomposition >::add_mJ ( Precision  m,
const Vector< Size, Precision, B2 > &  J,
Precision  weight = 1 
)
inline

Add a single measurement

Parameters
mThe value of the measurement
JThe Jacobian for the measurement $\frac{\partial\text{m}}{\partial\text{param}_i}$
weightThe inverse variance of the measurement (default = 1)

Definition at line 100 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
template<int N, class B1 , class B2 , class B3 >
void TooN::WLS< Size, Precision, Decomposition >::add_mJ ( const Vector< N, Precision, B1 > &  m,
const Matrix< Size, N, Precision, B2 > &  J,
const Matrix< N, N, Precision, B3 > &  invcov 
)
inline

Add multiple measurements at once (much more efficiently)

Parameters
mThe measurements to add
JThe Jacobian matrix $\frac{\partial\text{m}_i}{\partial\text{param}_j}$
invcovThe inverse covariance of the measurement values

Definition at line 117 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
template<int N, class B1 , class B2 , class B3 >
void TooN::WLS< Size, Precision, Decomposition >::add_mJ_rows ( const Vector< N, Precision, B1 > &  m,
const Matrix< N, Size, Precision, B2 > &  J,
const Matrix< N, N, Precision, B3 > &  invcov 
)
inline

Add multiple measurements at once (much more efficiently)

Parameters
mThe measurements to add
JThe Jacobian matrix $\frac{\partial\text{m}_i}{\partial\text{param}_j}$
invcovThe inverse covariance of the measurement values

Definition at line 130 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
void TooN::WLS< Size, Precision, Decomposition >::add_prior ( Precision  val)
inline

Applies a constant regularisation term. Equates to a prior that says all the parameters are zero with $\sigma^2 = \frac{1}{\text{val}}$.

Parameters
valThe strength of the prior

Definition at line 70 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
template<class B2 >
void TooN::WLS< Size, Precision, Decomposition >::add_prior ( const Vector< Size, Precision, B2 > &  v)
inline

Applies a regularisation term with a different strength for each parameter value. Equates to a prior that says all the parameters are zero with $\sigma_i^2 = \frac{1}{\text{v}_i}$.

Parameters
vThe vector of priors

Definition at line 80 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
template<class B2 >
void TooN::WLS< Size, Precision, Decomposition >::add_prior ( const Matrix< Size, Size, Precision, B2 > &  m)
inline

Applies a whole-matrix regularisation term. This is the same as adding the $m$ to the inverse covariance matrix.

Parameters
mThe inverse covariance matrix to add

Definition at line 91 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
template<int N, int S1, class B1 , class B2 , class B3 >
void TooN::WLS< Size, Precision, Decomposition >::add_sparse_mJ_rows ( const Vector< N, Precision, B1 > &  m,
const Matrix< N, S1, Precision, B2 > &  J1,
const int  index1,
const Matrix< N, N, Precision, B3 > &  invcov 
)
inline

Add multiple measurements at once with a sparse Jacobian (much, much more efficiently)

Parameters
mThe measurements to add
J1The first block of the Jacobian matrix $\frac{\partial\text{m}_i}{\partial\text{param}_j}$
index1starting index for the first block
invcovThe inverse covariance of the measurement values

Definition at line 144 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
template<int N, int S1, int S2, class B1 , class B2 , class B3 , class B4 >
void TooN::WLS< Size, Precision, Decomposition >::add_sparse_mJ_rows ( const Vector< N, Precision, B1 > &  m,
const Matrix< N, S1, Precision, B2 > &  J1,
const int  index1,
const Matrix< N, S2, Precision, B3 > &  J2,
const int  index2,
const Matrix< N, N, Precision, B4 > &  invcov 
)
inline

Add multiple measurements at once with a sparse Jacobian (much, much more efficiently)

Parameters
mThe measurements to add
J1The first block of the Jacobian matrix $\frac{\partial\text{m}_i}{\partial\text{param}_j}$
index1starting index for the first block
J2The second block of the Jacobian matrix $\frac{\partial\text{m}_i}{\partial\text{param}_j}$
index2starting index for the second block
invcovThe inverse covariance of the measurement values

Definition at line 161 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
void TooN::WLS< Size, Precision, Decomposition >::clear ( )
inline

Clear all the measurements and apply a constant regularisation term.

Definition at line 62 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
void TooN::WLS< Size, Precision, Decomposition >::compute ( )
inline

Process all the measurements and compute the weighted least squares set of parameter values stores the result internally which can then be accessed by calling get_mu()

Definition at line 180 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
Matrix<Size,Size,Precision>& TooN::WLS< Size, Precision, Decomposition >::get_C_inv ( )
inline

Returns the inverse covariance matrix.

Definition at line 199 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
const Matrix<Size,Size,Precision>& TooN::WLS< Size, Precision, Decomposition >::get_C_inv ( ) const
inline

Returns the inverse covariance matrix.

Definition at line 201 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
Decomposition<Size,Precision>& TooN::WLS< Size, Precision, Decomposition >::get_decomposition ( )
inline

Return the decomposition object used to compute $(J^{\mathsf T} J + P)^{-1}$.

Definition at line 206 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
const Decomposition<Size,Precision>& TooN::WLS< Size, Precision, Decomposition >::get_decomposition ( ) const
inline

Return the decomposition object used to compute $(J^{\mathsf T} J + P)^{-1}$.

Definition at line 207 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
Vector<Size,Precision>& TooN::WLS< Size, Precision, Decomposition >::get_mu ( )
inline

Returns the update. With no prior, this is the result of $J^\dagger e$.

Definition at line 202 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
const Vector<Size,Precision>& TooN::WLS< Size, Precision, Decomposition >::get_mu ( ) const
inline

Returns the update. With no prior, this is the result of $J^\dagger e$.

Definition at line 203 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
Vector<Size,Precision>& TooN::WLS< Size, Precision, Decomposition >::get_vector ( )
inline

Returns the vector $J^{\mathsf T} e$.

Definition at line 204 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
const Vector<Size,Precision>& TooN::WLS< Size, Precision, Decomposition >::get_vector ( ) const
inline

Returns the vector $J^{\mathsf T} e$.

Definition at line 205 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
void TooN::WLS< Size, Precision, Decomposition >::operator+= ( const WLS< Size, Precision, Decomposition > &  meas)
inline

Combine measurements from two WLS systems

Parameters
measThe measurements to combine with

Definition at line 193 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
int TooN::WLS< Size, Precision, Decomposition >::operator= ( WLS< Size, Precision, Decomposition > &  copyof)
private

Member Data Documentation

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
Matrix<Size,Size,Precision> TooN::WLS< Size, Precision, Decomposition >::my_C_inv
private

Definition at line 211 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
Decomposition<Size,Precision> TooN::WLS< Size, Precision, Decomposition >::my_decomposition
private

Definition at line 213 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
Vector<Size,Precision> TooN::WLS< Size, Precision, Decomposition >::my_mu
private

Definition at line 214 of file wls.h.

template<int Size = Dynamic, class Precision = DefaultPrecision, template< int DecompSize, class DecompPrecision > class Decomposition = Cholesky>
Vector<Size,Precision> TooN::WLS< Size, Precision, Decomposition >::my_vector
private

Definition at line 212 of file wls.h.


The documentation for this class was generated from the following file: