54 template <
typename real,
int dimension>
59 using MatrixType = Eigen::Matrix<real, dimension, dimension>;
121 #include <pcl/common/impl/vector_average.hpp>
Calculates the weighted average and the covariance matrix.
void add(const VectorType &sample, real weight=1.0)
Add a new sample.
void reset()
Reset the object to work with a new data set.
VectorAverage()
Constructor - dimension gives the size of the vectors to work with.
Eigen::Matrix< real, dimension, 1 > VectorType
const MatrixType & getCovariance() const
Get the covariance matrix of the added vectors.
void doPCA(VectorType &eigen_values, VectorType &eigen_vector1, VectorType &eigen_vector2, VectorType &eigen_vector3) const
Do Principal component analysis.
Eigen::Matrix< real, dimension, dimension > MatrixType
real getAccumulatedWeight() const
Get the summed up weight of all added vectors.
const VectorType & getMean() const
Get the mean of the added vectors.
void getEigenVector1(VectorType &eigen_vector1) const
Get the eigenvector corresponding to the smallest eigenvalue.
unsigned int getNoOfSamples()
Get the number of added vectors.
unsigned int noOfSamples_
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.