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_);
218 project (
const PointCloud& input, PointCloud& projection);
234 reconstruct (
const PointCloud& projection, PointCloud& input);
242 Eigen::Matrix3f eigenvectors_;
243 Eigen::MatrixXf coefficients_;
244 Eigen::Vector4f mean_;
245 Eigen::Vector3f eigenvalues_;
249 #include <pcl/common/impl/pca.hpp>
PointCloud::ConstPtr PointCloudConstPtr
PCA & operator=(PCA const &pca)
Assignment operator.
Principal Component analysis (PCA) class.
An exception thrown when init can not be performed should be used in all the PCLBase class inheritant...
void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
boost::shared_ptr< PointIndices const > PointIndicesConstPtr
boost::shared_ptr< PointIndices > PointIndicesPtr
IndicesPtr indices_
A pointer to the vector of point indices to use.
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.
Base::PointIndicesPtr PointIndicesPtr
PointCloudConstPtr input_
The input point cloud dataset.
Eigen::MatrixXf & getCoefficients()
Coefficients accessor.
PointCloud::Ptr PointCloudPtr
FLAG
Updating method flag.
void project(const PointT &input, PointT &projection)
Project point on the eigenspace.
keep the new basis vectors if possible
preserve subspace dimension
Base::PointIndicesConstPtr PointIndicesConstPtr
PCA(PCA const &pca)
Copy Constructor.
Base::PointCloud PointCloud
PCA(bool basis_only=false)
Default Constructor.
void reconstruct(const PointT &projection, PointT &input)
Reconstruct point from its projection.
Base::PointCloudPtr PointCloudPtr
Eigen::Vector3f & getEigenValues()
Eigen Values accessor.
A point structure representing Euclidean xyz coordinates, and the RGB color.
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...
Eigen::Matrix3f & getEigenVectors()
Eigen Vectors accessor.
pcl::PCLBase< PointT > Base
PointCloud represents the base class in PCL for storing collections of 3D points. ...
Base::PointCloudConstPtr PointCloudConstPtr
void update(const PointT &input, FLAG flag=preserve)
update PCA with a new point
Eigen::Vector4f & getMean()
Mean accessor.