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)
101 PCL_DEPRECATED (
"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;
147 compute_done_ =
false;
157 compute_done_ =
false;
167 compute_done_ =
false;
179 setIndices (
size_t row_start,
size_t col_start,
size_t nb_rows,
size_t nb_cols)
182 compute_done_ =
false;
188 inline Eigen::Vector4f&
195 "[pcl::PCA::getMean] PCA initCompute failed");
202 inline Eigen::Matrix3f&
209 "[pcl::PCA::getEigenVectors] PCA initCompute failed");
210 return (eigenvectors_);
216 inline Eigen::Vector3f&
223 "[pcl::PCA::getEigenVectors] PCA getEigenValues failed");
224 return (eigenvalues_);
230 inline Eigen::MatrixXf&
237 "[pcl::PCA::getEigenVectors] PCA getCoefficients failed");
238 return (coefficients_);
287 Eigen::Matrix3f eigenvectors_;
288 Eigen::MatrixXf coefficients_;
289 Eigen::Vector4f mean_;
290 Eigen::Vector3f eigenvalues_;
294 #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
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
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.