Point Cloud Library (PCL)  1.8.1-dev
List of all members | Public Types | Public Member Functions
pcl::PCA< PointT > Class Template Reference

Principal Component analysis (PCA) class. More...

#include <pcl/common/pca.h>

+ Inheritance diagram for pcl::PCA< PointT >:

Public Types

enum  FLAG { increase, preserve }
 Updating method flag. More...
 
typedef pcl::PCLBase< PointTBase
 
typedef Base::PointCloud PointCloud
 
typedef Base::PointCloudPtr PointCloudPtr
 
typedef Base::PointCloudConstPtr PointCloudConstPtr
 
typedef Base::PointIndicesPtr PointIndicesPtr
 
typedef Base::PointIndicesConstPtr PointIndicesConstPtr
 
- Public Types inherited from pcl::PCLBase< PointT >
typedef pcl::PointCloud< PointTPointCloud
 
typedef PointCloud::Ptr PointCloudPtr
 
typedef PointCloud::ConstPtr PointCloudConstPtr
 
typedef boost::shared_ptr
< PointIndices
PointIndicesPtr
 
typedef boost::shared_ptr
< PointIndices const > 
PointIndicesConstPtr
 

Public Member Functions

 PCA (bool basis_only=false)
 Default Constructor. More...
 
 PCA (PCA const &pca)
 Copy Constructor. More...
 
PCAoperator= (PCA const &pca)
 Assignment operator. More...
 
void setInputCloud (const PointCloudConstPtr &cloud)
 Provide a pointer to the input dataset. More...
 
virtual void setIndices (const IndicesPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (const IndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (const PointIndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (size_t row_start, size_t col_start, size_t nb_rows, size_t nb_cols)
 Set the indices for the points laying within an interest region of the point cloud. More...
 
Eigen::Vector4f & getMean ()
 Mean accessor. More...
 
Eigen::Matrix3f & getEigenVectors ()
 Eigen Vectors accessor. More...
 
Eigen::Vector3f & getEigenValues ()
 Eigen Values accessor. More...
 
Eigen::MatrixXf & getCoefficients ()
 Coefficients accessor. More...
 
void update (const PointT &input, FLAG flag=preserve)
 update PCA with a new point More...
 
void project (const PointT &input, PointT &projection)
 Project point on the eigenspace. More...
 
void project (const PointCloud &input, PointCloud &projection)
 Project cloud on the eigenspace. More...
 
void reconstruct (const PointT &projection, PointT &input)
 Reconstruct point from its projection. More...
 
void reconstruct (const PointCloud &projection, PointCloud &input)
 Reconstruct cloud from its projection. More...
 
- Public Member Functions inherited from pcl::PCLBase< PointT >
 PCLBase ()
 Empty constructor. More...
 
 PCLBase (const PCLBase &base)
 Copy constructor. More...
 
virtual ~PCLBase ()
 Destructor. More...
 
PointCloudConstPtr const getInputCloud () const
 Get a pointer to the input point cloud dataset. More...
 
IndicesPtr const getIndices ()
 Get a pointer to the vector of indices used. More...
 
IndicesConstPtr const getIndices () const
 Get a pointer to the vector of indices used. More...
 
const PointToperator[] (size_t pos) const
 Override PointCloud operator[] to shorten code. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pcl::PCLBase< PointT >
bool initCompute ()
 This method should get called before starting the actual computation. More...
 
bool deinitCompute ()
 This method should get called after finishing the actual computation. More...
 
- Protected Attributes inherited from pcl::PCLBase< PointT >
PointCloudConstPtr input_
 The input point cloud dataset. More...
 
IndicesPtr indices_
 A pointer to the vector of point indices to use. More...
 
bool use_indices_
 Set to true if point indices are used. More...
 
bool fake_indices_
 If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud. More...
 

Detailed Description

template<typename PointT>
class pcl::PCA< PointT >

Principal Component analysis (PCA) class.


Principal components are extracted by singular values decomposition on the covariance matrix of the centered input cloud. Available data after pca computation are the mean of the input data, the eigenvalues (in descending order) and corresponding eigenvectors.
Other methods allow projection in the eigenspace, reconstruction from eigenspace and update of the eigenspace with a new datum (according Matej Artec, Matjaz Jogan and Ales Leonardis: "Incremental PCA for On-line Visual Learning and Recognition").

Author
Nizar Sallem

Definition at line 60 of file pca.h.

Member Typedef Documentation

template<typename PointT >
typedef pcl::PCLBase<PointT> pcl::PCA< PointT >::Base

Definition at line 63 of file pca.h.

template<typename PointT >
typedef Base::PointCloud pcl::PCA< PointT >::PointCloud

Definition at line 64 of file pca.h.

template<typename PointT >
typedef Base::PointCloudConstPtr pcl::PCA< PointT >::PointCloudConstPtr

Definition at line 66 of file pca.h.

template<typename PointT >
typedef Base::PointCloudPtr pcl::PCA< PointT >::PointCloudPtr

Definition at line 65 of file pca.h.

template<typename PointT >
typedef Base::PointIndicesConstPtr pcl::PCA< PointT >::PointIndicesConstPtr

Definition at line 68 of file pca.h.

template<typename PointT >
typedef Base::PointIndicesPtr pcl::PCA< PointT >::PointIndicesPtr

Definition at line 67 of file pca.h.

Member Enumeration Documentation

template<typename PointT >
enum pcl::PCA::FLAG

Updating method flag.

Enumerator
increase 

keep the new basis vectors if possible

preserve 

preserve subspace dimension

Definition at line 76 of file pca.h.

Constructor & Destructor Documentation

template<typename PointT >
pcl::PCA< PointT >::PCA ( bool  basis_only = false)
inline

Default Constructor.

Parameters
basis_onlyflag to compute only the PCA basis

Definition at line 87 of file pca.h.

template<typename PointT >
pcl::PCA< PointT >::PCA ( PCA< PointT > const &  pca)
inline

Copy Constructor.

Parameters
[in]pcaPCA object

Definition at line 100 of file pca.h.

Member Function Documentation

template<typename PointT >
Eigen::MatrixXf& pcl::PCA< PointT >::getCoefficients ( )
inline

Coefficients accessor.

Exceptions
InitFailedException

Definition at line 224 of file pca.h.

template<typename PointT >
Eigen::Vector3f& pcl::PCA< PointT >::getEigenValues ( )
inline

Eigen Values accessor.

Exceptions
InitFailedException

Definition at line 210 of file pca.h.

template<typename PointT >
Eigen::Matrix3f& pcl::PCA< PointT >::getEigenVectors ( )
inline

Eigen Vectors accessor.

Exceptions
InitFailedException

Definition at line 196 of file pca.h.

template<typename PointT >
Eigen::Vector4f& pcl::PCA< PointT >::getMean ( )
inline

Mean accessor.

Exceptions
InitFailedException

Definition at line 182 of file pca.h.

template<typename PointT >
PCA& pcl::PCA< PointT >::operator= ( PCA< PointT > const &  pca)
inline

Assignment operator.

Parameters
[in]pcaPCA object

Definition at line 114 of file pca.h.

template<typename PointT >
void pcl::PCA< PointT >::project ( const PointT input,
PointT projection 
)
inline

Project point on the eigenspace.

Parameters
[in]inputpoint from original dataset
[out]projectionthe point in eigen vectors space
Exceptions
InitFailedException

Definition at line 161 of file pca.hpp.

template<typename PointT >
void pcl::PCA< PointT >::project ( const PointCloud input,
PointCloud projection 
)
inline

Project cloud on the eigenspace.

Parameters
[in]inputcloud from original dataset
[out]projectionthe cloud in eigen vectors space
Exceptions
InitFailedException

Definition at line 174 of file pca.hpp.

References pcl::PointCloud< T >::is_dense, pcl::PointCloud< T >::push_back(), pcl::PointCloud< T >::resize(), and pcl::PointCloud< T >::size().

template<typename PointT >
void pcl::PCA< PointT >::reconstruct ( const PointT projection,
PointT input 
)
inline

Reconstruct point from its projection.

Parameters
[in]projectionpoint from eigenvector space
[out]inputreconstructed point
Exceptions
InitFailedException

Definition at line 203 of file pca.hpp.

template<typename PointT >
void pcl::PCA< PointT >::reconstruct ( const PointCloud projection,
PointCloud input 
)
inline

Reconstruct cloud from its projection.

Parameters
[in]projectioncloud from eigenvector space
[out]inputreconstructed cloud
Exceptions
InitFailedException

Definition at line 216 of file pca.hpp.

References pcl::PointCloud< T >::is_dense, pcl::PointCloud< T >::push_back(), pcl::PointCloud< T >::resize(), and pcl::PointCloud< T >::size().

template<typename PointT >
virtual void pcl::PCA< PointT >::setIndices ( const IndicesPtr indices)
inlinevirtual

Provide a pointer to the vector of indices that represents the input data.

Parameters
[in]indicesa pointer to the indices that represent the input data.

Reimplemented from pcl::PCLBase< PointT >.

Definition at line 137 of file pca.h.

References pcl::PCLBase< PointT >::setIndices().

template<typename PointT >
virtual void pcl::PCA< PointT >::setIndices ( const IndicesConstPtr indices)
inlinevirtual

Provide a pointer to the vector of indices that represents the input data.

Parameters
[in]indicesa pointer to the indices that represent the input data.

Reimplemented from pcl::PCLBase< PointT >.

Definition at line 147 of file pca.h.

References pcl::PCLBase< PointT >::setIndices().

template<typename PointT >
virtual void pcl::PCA< PointT >::setIndices ( const PointIndicesConstPtr indices)
inlinevirtual

Provide a pointer to the vector of indices that represents the input data.

Parameters
[in]indicesa pointer to the indices that represent the input data.

Reimplemented from pcl::PCLBase< PointT >.

Definition at line 157 of file pca.h.

References pcl::PCLBase< PointT >::setIndices().

template<typename PointT >
virtual void pcl::PCA< PointT >::setIndices ( size_t  row_start,
size_t  col_start,
size_t  nb_rows,
size_t  nb_cols 
)
inlinevirtual

Set the indices for the points laying within an interest region of the point cloud.

Note
you shouldn't call this method on unorganized point clouds!
Parameters
[in]row_startthe offset on rows
[in]col_startthe offset on columns
[in]nb_rowsthe number of rows to be considered row_start included
[in]nb_colsthe number of columns to be considered col_start included

Reimplemented from pcl::PCLBase< PointT >.

Definition at line 172 of file pca.h.

References pcl::PCLBase< PointT >::setIndices().

template<typename PointT >
void pcl::PCA< PointT >::setInputCloud ( const PointCloudConstPtr cloud)
inlinevirtual

Provide a pointer to the input dataset.

Parameters
cloudthe const boost shared pointer to a PointCloud message

Reimplemented from pcl::PCLBase< PointT >.

Definition at line 127 of file pca.h.

References pcl::PCLBase< PointT >::setInputCloud().

template<typename PointT >
void pcl::PCA< PointT >::update ( const PointT input,
FLAG  flag = preserve 
)
inline

update PCA with a new point

Parameters
[in]inputinput point
[in]flagupdate flag
Exceptions
InitFailedException

Definition at line 91 of file pca.hpp.


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