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 , compute_done_ (pca.compute_done_)
103 , basis_only_ (pca.basis_only_)
104 , eigenvectors_ (pca.eigenvectors_)
105 , coefficients_ (pca.coefficients_)
107 , eigenvalues_ (pca.eigenvalues_)
116 eigenvectors_ = pca.eigenvectors_;
117 coefficients_ = pca.coefficients_;
118 eigenvalues_ = pca.eigenvalues_;
130 compute_done_ =
false;
140 compute_done_ =
false;
150 compute_done_ =
false;
160 compute_done_ =
false;
172 setIndices (
size_t row_start,
size_t col_start,
size_t nb_rows,
size_t nb_cols)
175 compute_done_ =
false;
181 inline Eigen::Vector4f&
188 "[pcl::PCA::getMean] PCA initCompute failed");
195 inline Eigen::Matrix3f&
202 "[pcl::PCA::getEigenVectors] PCA initCompute failed");
203 return (eigenvectors_);
209 inline Eigen::Vector3f&
216 "[pcl::PCA::getEigenVectors] PCA getEigenValues failed");
217 return (eigenvalues_);
223 inline Eigen::MatrixXf&
230 "[pcl::PCA::getEigenVectors] PCA getCoefficients failed");
231 return (coefficients_);
279 Eigen::Matrix3f eigenvectors_;
280 Eigen::MatrixXf coefficients_;
281 Eigen::Vector4f mean_;
282 Eigen::Vector3f eigenvalues_;
286 #include <pcl/common/impl/pca.hpp> Base::PointCloud PointCloud
Principal Component analysis (PCA) class.
PointCloud::ConstPtr PointCloudConstPtr
preserve subspace dimension
boost::shared_ptr< std::vector< int > > IndicesPtr
Base::PointCloudPtr PointCloudPtr
This file defines compatibility wrappers for low level I/O functions.
FLAG
Updating method flag.
PCA & operator=(PCA const &pca)
Assignment operator.
Base::PointCloudConstPtr PointCloudConstPtr
IndicesPtr indices_
A pointer to the vector of point indices to use.
Base::PointIndicesConstPtr PointIndicesConstPtr
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.
virtual void setIndices(const PointIndicesConstPtr &indices)
Provide a pointer to the vector of indices that represents the input data.
boost::shared_ptr< PointIndices > PointIndicesPtr
pcl::PCLBase< PointT > Base
void update(const PointT &input, FLAG flag=preserve)
update PCA with a new point
virtual void setIndices(const IndicesPtr &indices)
Provide a pointer to the vector of indices that represents the input data.
bool initCompute()
This method should get called before starting the actual computation.
PointCloud::Ptr PointCloudPtr
PCA(PCA const &pca)
Copy Constructor.
void reconstruct(const PointT &projection, PointT &input)
Reconstruct point from its projection.
void project(const PointT &input, PointT &projection)
Project point on the eigenspace.
boost::shared_ptr< PointIndices const > PointIndicesConstPtr
An exception thrown when init can not be performed should be used in all the PCLBase class inheritant...
Eigen::Vector4f & getMean()
Mean accessor.
PointCloud represents the base class in PCL for storing collections of 3D points.
virtual void setIndices(const IndicesPtr &indices)
Provide a pointer to the vector of indices that represents the input data.
Base::PointIndicesPtr PointIndicesPtr
Eigen::Matrix3f & getEigenVectors()
Eigen Vectors accessor.
Eigen::MatrixXf & getCoefficients()
Coefficients accessor.
PCA(bool basis_only=false)
Default Constructor.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
boost::shared_ptr< const std::vector< int > > IndicesConstPtr
Eigen::Vector3f & getEigenValues()
Eigen Values accessor.
PointCloudConstPtr input_
The input point cloud dataset.
keep the new basis vectors if possible
A point structure representing Euclidean xyz coordinates, and the RGB color.
void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
virtual void setIndices(const IndicesConstPtr &indices)
Provide a pointer to the vector of indices that represents the input data.