Point Cloud Library (PCL)  1.12.0-dev
List of all members | Public Types | Public Member Functions | Protected Attributes
pcl::VectorAverage< real, dimension > Class Template Reference

Calculates the weighted average and the covariance matrix. More...

#include <pcl/common/vector_average.h>

Public Types

using VectorType = Eigen::Matrix< real, dimension, 1 >
 
using MatrixType = Eigen::Matrix< real, dimension, dimension >
 

Public Member Functions

 VectorAverage ()
 Constructor - dimension gives the size of the vectors to work with. More...
 
void reset ()
 Reset the object to work with a new data set. More...
 
const VectorTypegetMean () const
 Get the mean of the added vectors. More...
 
const MatrixTypegetCovariance () const
 Get the covariance matrix of the added vectors. More...
 
real getAccumulatedWeight () const
 Get the summed up weight of all added vectors. More...
 
unsigned int getNoOfSamples ()
 Get the number of added vectors. More...
 
void add (const VectorType &sample, real weight=1.0)
 Add a new sample. More...
 
void doPCA (VectorType &eigen_values, VectorType &eigen_vector1, VectorType &eigen_vector2, VectorType &eigen_vector3) const
 Do Principal component analysis. More...
 
void doPCA (VectorType &eigen_values) const
 Do Principal component analysis. More...
 
void getEigenVector1 (VectorType &eigen_vector1) const
 Get the eigenvector corresponding to the smallest eigenvalue. More...
 
void doPCA (Eigen::Matrix< float, 3, 1 > &eigen_values, Eigen::Matrix< float, 3, 1 > &eigen_vector1, Eigen::Matrix< float, 3, 1 > &eigen_vector2, Eigen::Matrix< float, 3, 1 > &eigen_vector3) const
 
void doPCA (Eigen::Matrix< float, 3, 1 > &eigen_values) const
 
void getEigenVector1 (Eigen::Matrix< float, 3, 1 > &eigen_vector1) const
 
void doPCA (Eigen::Matrix< double, 3, 1 > &eigen_values, Eigen::Matrix< double, 3, 1 > &eigen_vector1, Eigen::Matrix< double, 3, 1 > &eigen_vector2, Eigen::Matrix< double, 3, 1 > &eigen_vector3) const
 
void doPCA (Eigen::Matrix< double, 3, 1 > &eigen_values) const
 
void getEigenVector1 (Eigen::Matrix< double, 3, 1 > &eigen_vector1) const
 

Protected Attributes

unsigned int noOfSamples_ = 0
 
real accumulatedWeight_ = 0
 
VectorType mean_ = VectorType::Identity ()
 
MatrixType covariance_ = MatrixType::Identity ()
 

Detailed Description

template<typename real, int dimension>
class pcl::VectorAverage< real, dimension >

Calculates the weighted average and the covariance matrix.

A class to calculate the weighted average and the covariance matrix of a set of vectors with given weights. The original data is not saved. Mean and covariance are calculated iteratively.

Author
Bastian Steder

Definition at line 55 of file vector_average.h.

Member Typedef Documentation

◆ MatrixType

template<typename real , int dimension>
using pcl::VectorAverage< real, dimension >::MatrixType = Eigen::Matrix<real, dimension, dimension>

Definition at line 59 of file vector_average.h.

◆ VectorType

template<typename real , int dimension>
using pcl::VectorAverage< real, dimension >::VectorType = Eigen::Matrix<real, dimension, 1>

Definition at line 58 of file vector_average.h.

Constructor & Destructor Documentation

◆ VectorAverage()

template<typename real , int dimension>
pcl::VectorAverage< real, dimension >::VectorAverage

Constructor - dimension gives the size of the vectors to work with.

Definition at line 48 of file vector_average.hpp.

Member Function Documentation

◆ add()

template<typename real , int dimension>
void pcl::VectorAverage< real, dimension >::add ( const VectorType sample,
real  weight = 1.0 
)
inline

◆ doPCA() [1/6]

void pcl::VectorAverage< double, 3 >::doPCA ( Eigen::Matrix< double, 3, 1 > &  eigen_values) const
inline

Definition at line 188 of file vector_average.hpp.

References pcl::computeRoots().

◆ doPCA() [2/6]

void pcl::VectorAverage< double, 3 >::doPCA ( Eigen::Matrix< double, 3, 1 > &  eigen_values,
Eigen::Matrix< double, 3, 1 > &  eigen_vector1,
Eigen::Matrix< double, 3, 1 > &  eigen_vector2,
Eigen::Matrix< double, 3, 1 > &  eigen_vector3 
) const
inline

Definition at line 177 of file vector_average.hpp.

References pcl::eigen33().

◆ doPCA() [3/6]

void pcl::VectorAverage< float, 3 >::doPCA ( Eigen::Matrix< float, 3, 1 > &  eigen_values) const
inline

Definition at line 158 of file vector_average.hpp.

References pcl::computeRoots().

◆ doPCA() [4/6]

void pcl::VectorAverage< float, 3 >::doPCA ( Eigen::Matrix< float, 3, 1 > &  eigen_values,
Eigen::Matrix< float, 3, 1 > &  eigen_vector1,
Eigen::Matrix< float, 3, 1 > &  eigen_vector2,
Eigen::Matrix< float, 3, 1 > &  eigen_vector3 
) const
inline

Definition at line 147 of file vector_average.hpp.

References pcl::eigen33().

◆ doPCA() [5/6]

template<typename real , int dimension>
void pcl::VectorAverage< real, dimension >::doPCA ( VectorType eigen_values) const
inline

Do Principal component analysis.

Definition at line 108 of file vector_average.hpp.

◆ doPCA() [6/6]

template<typename real , int dimension>
void pcl::VectorAverage< real, dimension >::doPCA ( VectorType eigen_values,
VectorType eigen_vector1,
VectorType eigen_vector2,
VectorType eigen_vector3 
) const
inline

◆ getAccumulatedWeight()

template<typename real , int dimension>
real pcl::VectorAverage< real, dimension >::getAccumulatedWeight ( ) const
inline

Get the summed up weight of all added vectors.

Definition at line 79 of file vector_average.h.

References pcl::VectorAverage< real, dimension >::accumulatedWeight_.

◆ getCovariance()

template<typename real , int dimension>
const MatrixType& pcl::VectorAverage< real, dimension >::getCovariance ( ) const
inline

Get the covariance matrix of the added vectors.

Definition at line 75 of file vector_average.h.

References pcl::VectorAverage< real, dimension >::covariance_.

◆ getEigenVector1() [1/3]

void pcl::VectorAverage< double, 3 >::getEigenVector1 ( Eigen::Matrix< double, 3, 1 > &  eigen_vector1) const
inline

Definition at line 194 of file vector_average.hpp.

References pcl::eigen33().

◆ getEigenVector1() [2/3]

void pcl::VectorAverage< float, 3 >::getEigenVector1 ( Eigen::Matrix< float, 3, 1 > &  eigen_vector1) const
inline

Definition at line 164 of file vector_average.hpp.

References pcl::eigen33().

◆ getEigenVector1() [3/3]

template<typename real , int dimension>
void pcl::VectorAverage< real, dimension >::getEigenVector1 ( VectorType eigen_vector1) const
inline

Get the eigenvector corresponding to the smallest eigenvalue.

Definition at line 121 of file vector_average.hpp.

Referenced by pcl::GridProjection< PointNT >::getVectorAtPointKNN().

◆ getMean()

template<typename real , int dimension>
const VectorType& pcl::VectorAverage< real, dimension >::getMean ( ) const
inline

◆ getNoOfSamples()

template<typename real , int dimension>
unsigned int pcl::VectorAverage< real, dimension >::getNoOfSamples ( )
inline

◆ reset()

template<typename real , int dimension>
void pcl::VectorAverage< real, dimension >::reset
inline

Reset the object to work with a new data set.

Definition at line 54 of file vector_average.hpp.

Member Data Documentation

◆ accumulatedWeight_

template<typename real , int dimension>
real pcl::VectorAverage< real, dimension >::accumulatedWeight_ = 0
protected

◆ covariance_

template<typename real , int dimension>
MatrixType pcl::VectorAverage< real, dimension >::covariance_ = MatrixType::Identity ()
protected

◆ mean_

template<typename real , int dimension>
VectorType pcl::VectorAverage< real, dimension >::mean_ = VectorType::Identity ()
protected

Definition at line 112 of file vector_average.h.

Referenced by pcl::VectorAverage< real, dimension >::getMean().

◆ noOfSamples_

template<typename real , int dimension>
unsigned int pcl::VectorAverage< real, dimension >::noOfSamples_ = 0
protected

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