41 #include <pcl/pcl_base.h>
60 template <
typename Po
intT>
88 PCA (
bool basis_only =
false)
90 , basis_only_ (basis_only)
98 , compute_done_ (pca.compute_done_)
99 , basis_only_ (pca.basis_only_)
100 , eigenvectors_ (pca.eigenvectors_)
101 , coefficients_ (pca.coefficients_)
103 , eigenvalues_ (pca.eigenvalues_)
112 eigenvectors_ = pca.eigenvectors_;
113 coefficients_ = pca.coefficients_;
114 eigenvalues_ = pca.eigenvalues_;
126 compute_done_ =
false;
136 compute_done_ =
false;
146 compute_done_ =
false;
156 compute_done_ =
false;
168 setIndices (std::size_t row_start, std::size_t col_start, std::size_t nb_rows, std::size_t nb_cols)
override
171 compute_done_ =
false;
177 inline Eigen::Vector4f&
184 "[pcl::PCA::getMean] PCA initCompute failed");
192 inline Eigen::Matrix3f&
199 "[pcl::PCA::getEigenVectors] PCA initCompute failed");
200 return (eigenvectors_);
206 inline Eigen::Vector3f&
213 "[pcl::PCA::getEigenVectors] PCA getEigenValues failed");
214 return (eigenvalues_);
220 inline Eigen::MatrixXf&
227 "[pcl::PCA::getEigenVectors] PCA getCoefficients failed");
228 return (coefficients_);
274 bool compute_done_{
false};
276 Eigen::Matrix3f eigenvectors_;
277 Eigen::MatrixXf coefficients_;
278 Eigen::Vector4f mean_;
279 Eigen::Vector3f eigenvalues_;
283 #include <pcl/common/impl/pca.hpp>
An exception thrown when init can not be performed should be used in all the PCLBase class inheritant...
Principal Component analysis (PCA) class.
typename Base::PointCloudConstPtr PointCloudConstPtr
Eigen::Vector4f & getMean()
Mean accessor.
void setInputCloud(const PointCloudConstPtr &cloud) override
Provide a pointer to the input dataset.
FLAG
Updating method flag.
@ preserve
preserve subspace dimension
@ increase
keep the new basis vectors if possible
void project(const PointT &input, PointT &projection)
Project point on the eigenspace.
PCA & operator=(PCA const &pca)
Assignment operator.
Eigen::Vector3f & getEigenValues()
Eigen Values accessor.
void update(const PointT &input, FLAG flag=preserve)
update PCA with a new point
void setIndices(std::size_t row_start, std::size_t col_start, std::size_t nb_rows, std::size_t nb_cols) override
Set the indices for the points laying within an interest region of the point cloud.
typename Base::PointCloudPtr PointCloudPtr
Eigen::MatrixXf & getCoefficients()
Coefficients accessor.
PCA(bool basis_only=false)
Default Constructor.
PCA(PCA const &pca)
Copy Constructor.
void setIndices(const PointIndicesConstPtr &indices) override
Provide a pointer to the vector of indices that represents the input data.
typename Base::PointIndicesConstPtr PointIndicesConstPtr
Eigen::Matrix3f & getEigenVectors()
Eigen Vectors accessor.
typename Base::PointCloud PointCloud
void setIndices(const IndicesConstPtr &indices) override
Provide a pointer to the vector of indices that represents the input data.
void reconstruct(const PointT &projection, PointT &input)
Reconstruct point from its projection.
void setIndices(const IndicesPtr &indices) override
Provide a pointer to the vector of indices that represents the input data.
typename Base::PointIndicesPtr PointIndicesPtr
PointCloudConstPtr input_
The input point cloud dataset.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
typename PointCloud::Ptr PointCloudPtr
typename PointCloud::ConstPtr PointCloudConstPtr
pcl::PointCloud< PointT > PointCloud
IndicesPtr indices_
A pointer to the vector of point indices to use.
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.
PointIndices::ConstPtr PointIndicesConstPtr
PointIndices::Ptr PointIndicesPtr
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< const Indices > IndicesConstPtr
shared_ptr< Indices > IndicesPtr
Defines all the PCL and non-PCL macros used.
A point structure representing Euclidean xyz coordinates, and the RGB color.