42 #include <pcl/pcl_base.h>
43 #include <pcl/pcl_macros.h>
59 template <
typename Po
intT>
87 PCA (
bool basis_only =
false)
89 , compute_done_ (false)
90 , basis_only_ (basis_only)
102 "Use PCA (bool basis_only); setInputCloud (X.makeShared ()); instead");
109 , compute_done_ (pca.compute_done_)
110 , basis_only_ (pca.basis_only_)
111 , eigenvectors_ (pca.eigenvectors_)
112 , coefficients_ (pca.coefficients_)
114 , eigenvalues_ (pca.eigenvalues_)
123 eigenvectors_ = pca.eigenvectors;
124 coefficients_ = pca.coefficients;
125 eigenvalues_ = pca.eigenvalues;
137 compute_done_ =
false;
143 inline Eigen::Vector4f&
150 "[pcl::PCA::getMean] PCA initCompute failed");
157 inline Eigen::Matrix3f&
164 "[pcl::PCA::getEigenVectors] PCA initCompute failed");
165 return (eigenvectors_);
171 inline Eigen::Vector3f&
178 "[pcl::PCA::getEigenVectors] PCA getEigenValues failed");
179 return (eigenvalues_);
185 inline Eigen::MatrixXf&
192 "[pcl::PCA::getEigenVectors] PCA getCoefficients failed");
193 return (coefficients_);
242 Eigen::Matrix3f eigenvectors_;
243 Eigen::MatrixXf coefficients_;
244 Eigen::Vector4f mean_;
245 Eigen::Vector3f eigenvalues_;
249 #include <pcl/common/impl/pca.hpp>
keep the new basis vectors if possible
PointCloud::Ptr PointCloudPtr
void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
void project(const PointT &input, PointT &projection)
Project point on the eigenspace.
Eigen::Vector4f & getMean()
Mean accessor.
Eigen::Vector3f & getEigenValues()
Eigen Values accessor.
Base::PointIndicesConstPtr PointIndicesConstPtr
Base::PointCloud PointCloud
Principal Component analysis (PCA) class.
Base::PointCloudConstPtr PointCloudConstPtr
void reconstruct(const PointT &projection, PointT &input)
Reconstruct point from its projection.
void update(const PointT &input, FLAG flag=preserve)
update PCA with a new point
pcl::PCLBase< PointT > Base
Eigen::MatrixXf & getCoefficients()
Coefficients accessor.
preserve subspace dimension
Eigen::Matrix3f & getEigenVectors()
Eigen Vectors accessor.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
bool initCompute()
This method should get called before starting the actual computation.
An exception thrown when init can not be performed should be used in all the PCLBase class inheritant...
IndicesPtr indices_
A pointer to the vector of point indices to use.
PointCloud::ConstPtr PointCloudConstPtr
FLAG
Updating method flag.
Base::PointCloudPtr PointCloudPtr
Base::PointIndicesPtr PointIndicesPtr
PCA & operator=(PCA const &pca)
Assignment operator.
PCA(PCA const &pca)
Copy Constructor.
boost::shared_ptr< PointIndices > PointIndicesPtr
boost::shared_ptr< PointIndices const > PointIndicesConstPtr
PCL_DEPRECATED(PCA(const pcl::PointCloud< PointT > &X, bool basis_only=false),"Use PCA (bool basis_only); setInputCloud (X.makeShared ()); instead")
Constructor with direct computation X input m*n matrix (ie n vectors of R(m)) basis_only flag to comp...
PCA(bool basis_only=false)
Default Constructor.
PointCloudConstPtr input_
The input point cloud dataset.
A point structure representing Euclidean xyz coordinates, and the RGB color.