pcl::VectorAverage< real, dimension > Class Template Reference
Module common

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

`#include <pcl/common/vector_average.h>`

## Public Member Functions

| VectorAverage ()
| Constructor - dimension gives the size of the vectors to work with. More...
| ~VectorAverage ()
| Destructor. More...
void | reset ()
| Reset the object to work with a new data set. More...
const Eigen::Matrix< real, dimension, 1 > & | getMean () const
| Get the mean of the added vectors. More...
const Eigen::Matrix< real, dimension, dimension > & | getCovariance () 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 Eigen::Matrix< real, dimension, 1 > &sample, real weight=1.0)
| Add a new sample. More...
void | doPCA (Eigen::Matrix< real, dimension, 1 > &eigen_values, Eigen::Matrix< real, dimension, 1 > &eigen_vector1, Eigen::Matrix< real, dimension, 1 > &eigen_vector2, Eigen::Matrix< real, dimension, 1 > &eigen_vector3) const
| Do Principal component analysis. More...
void | doPCA (Eigen::Matrix< real, dimension, 1 > &eigen_values) const
| Do Principal component analysis. More...
void | getEigenVector1 (Eigen::Matrix< real, dimension, 1 > &eigen_vector1) const
| Get the eigenvector corresponding to the smallest eigenvalue. More...
template<>
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
template<>
void | doPCA (Eigen::Matrix< float, 3, 1 > &eigen_values) const
template<>
void | getEigenVector1 (Eigen::Matrix< float, 3, 1 > &eigen_vector1) const
template<>
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
template<>
void | doPCA (Eigen::Matrix< double, 3, 1 > &eigen_values) const
template<>
void | getEigenVector1 (Eigen::Matrix< double, 3, 1 > &eigen_vector1) const

## Protected Attributes

unsigned int | noOfSamples_
real | accumulatedWeight_
Eigen::Matrix< real, dimension, 1 > | mean_
Eigen::Matrix< real, dimension, dimension > | covariance_

## 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 53 of file vector_average.h.

## Constructor & Destructor Documentation

template<typename real , int dimension>

pcl::VectorAverage< real, dimension >::VectorAverage | ( |  | ) |

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

Definition at line 44 of file vector_average.hpp.

References pcl::VectorAverage< real, dimension >::reset().

template<typename real , int dimension>

pcl::VectorAverage< real, dimension >::~VectorAverage | ( |  | ) |

inline

Destructor.

Definition at line 60 of file vector_average.h.

References pcl::VectorAverage< real, dimension >::reset().

## Member Function Documentation

template<typename real , int dimension>

void pcl::VectorAverage< real, dimension >::add | ( | const Eigen::Matrix< real, dimension, 1 > & | sample,
|  | real | weight = `1.0`
| ) |  |

inline

Add a new sample.

Definition at line 62 of file vector_average.hpp.

References pcl::VectorAverage< real, dimension >::accumulatedWeight_, pcl::VectorAverage< real, dimension >::covariance_, pcl::VectorAverage< real, dimension >::mean_, and pcl::VectorAverage< real, dimension >::noOfSamples_.

Referenced by pcl::RangeImageBorderExtractor::calculateMainPrincipalCurvature(), pcl::RangeImage::getCurvature(), pcl::VectorAverage< real, dimension >::getNoOfSamples(), pcl::RangeImage::getNormal(), pcl::RangeImage::getSurfaceInformation(), pcl::GridProjection< PointNT >::getVectorAtPoint(), and pcl::GridProjection< PointNT >::getVectorAtPointKNN().

template<typename real , int dimension>

void pcl::VectorAverage< real, dimension >::doPCA | ( | Eigen::Matrix< real, dimension, 1 > & | eigen_values,
|  | Eigen::Matrix< real, dimension, 1 > & | eigen_vector1,
|  | Eigen::Matrix< real, dimension, 1 > & | eigen_vector2,
|  | Eigen::Matrix< real, dimension, 1 > & | eigen_vector3
| ) |  | const

inline

Do Principal component analysis.

Definition at line 83 of file vector_average.hpp.

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

Referenced by pcl::RangeImageBorderExtractor::calculateMainPrincipalCurvature(), pcl::RangeImage::getCurvature(), pcl::VectorAverage< real, dimension >::getNoOfSamples(), pcl::RangeImage::getNormal(), and pcl::RangeImage::getSurfaceInformation().

template<typename real , int dimension>

void pcl::VectorAverage< real, dimension >::doPCA | ( | Eigen::Matrix< real, dimension, 1 > & | eigen_values | ) | const

inline

Do Principal component analysis.

Definition at line 107 of file vector_average.hpp.

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

template<>

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 146 of file vector_average.hpp.

References pcl::VectorAverage< real, dimension >::covariance_, and pcl::eigen33().

template<>

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

inline

Definition at line 157 of file vector_average.hpp.

References pcl::computeRoots(), and pcl::VectorAverage< real, dimension >::covariance_.

template<>

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 176 of file vector_average.hpp.

References pcl::VectorAverage< real, dimension >::covariance_, and pcl::eigen33().

template<>

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

inline

Definition at line 187 of file vector_average.hpp.

References pcl::computeRoots(), and pcl::VectorAverage< real, dimension >::covariance_.

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 77 of file vector_average.h.

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

template<typename real , int dimension>

const Eigen::Matrix<real, dimension, dimension>& pcl::VectorAverage< real, dimension >::getCovariance | ( |  | ) | const

inline

Get the covariance matrix of the added vectors.

Definition at line 73 of file vector_average.h.

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

template<typename real , int dimension>

void pcl::VectorAverage< real, dimension >::getEigenVector1 | ( | Eigen::Matrix< real, dimension, 1 > & | eigen_vector1 | ) | const

inline

Get the eigenvector corresponding to the smallest eigenvalue.

Definition at line 120 of file vector_average.hpp.

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

Referenced by pcl::VectorAverage< real, dimension >::getNoOfSamples(), and pcl::GridProjection< PointNT >::getVectorAtPointKNN().

template<>

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

inline

Definition at line 163 of file vector_average.hpp.

References pcl::VectorAverage< real, dimension >::covariance_, and pcl::eigen33().

template<>

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

inline

Definition at line 193 of file vector_average.hpp.

References pcl::VectorAverage< real, dimension >::covariance_, and pcl::eigen33().

template<typename real , int dimension>

const Eigen::Matrix<real, dimension, 1>& pcl::VectorAverage< real, dimension >::getMean | ( |  | ) | const

inline

Get the mean of the added vectors.

Definition at line 69 of file vector_average.h.

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

Referenced by pcl::RangeImage::getNormal(), pcl::RangeImage::getSurfaceInformation(), and pcl::GridProjection< PointNT >::getVectorAtPoint().

template<typename real , int dimension>

unsigned int pcl::VectorAverage< real, dimension >::getNoOfSamples | ( |  | ) |

inline

Get the number of added vectors.

Definition at line 81 of file vector_average.h.

References pcl::VectorAverage< real, dimension >::add(), pcl::VectorAverage< real, dimension >::doPCA(), pcl::VectorAverage< real, dimension >::getEigenVector1(), and pcl::VectorAverage< real, dimension >::noOfSamples_.

Referenced by pcl::RangeImageBorderExtractor::calculateMainPrincipalCurvature(), pcl::RangeImage::getCurvature(), pcl::RangeImage::getNormal(), and pcl::RangeImage::getSurfaceInformation().

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 53 of file vector_average.hpp.

References pcl::VectorAverage< real, dimension >::accumulatedWeight_, pcl::VectorAverage< real, dimension >::covariance_, pcl::VectorAverage< real, dimension >::mean_, and pcl::VectorAverage< real, dimension >::noOfSamples_.

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

## Member Data Documentation

template<typename real , int dimension>

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

protected

Definition at line 106 of file vector_average.h.

Referenced by pcl::VectorAverage< real, dimension >::add(), pcl::VectorAverage< real, dimension >::getAccumulatedWeight(), and pcl::VectorAverage< real, dimension >::reset().

template<typename real , int dimension>

Eigen::Matrix<real, dimension, dimension> pcl::VectorAverage< real, dimension >::covariance_

protected

Definition at line 108 of file vector_average.h.

Referenced by pcl::VectorAverage< real, dimension >::add(), pcl::VectorAverage< real, dimension >::doPCA(), pcl::VectorAverage< real, dimension >::getCovariance(), pcl::VectorAverage< real, dimension >::getEigenVector1(), and pcl::VectorAverage< real, dimension >::reset().

template<typename real , int dimension>

Eigen::Matrix<real, dimension, 1> pcl::VectorAverage< real, dimension >::mean_

protected

Definition at line 107 of file vector_average.h.

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

template<typename real , int dimension>

unsigned int pcl::VectorAverage< real, dimension >::noOfSamples_

protected

Definition at line 105 of file vector_average.h.

Referenced by pcl::VectorAverage< real, dimension >::add(), pcl::VectorAverage< real, dimension >::getNoOfSamples(), and pcl::VectorAverage< real, dimension >::reset().

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

- /build/pcl-6_P28C/pcl-1.7.2/common/include/pcl/common/vector_average.h
- /build/pcl-6_P28C/pcl-1.7.2/common/include/pcl/common/impl/vector_average.hpp