|
Ponca
7d8ac87a7de01d881c9fde3c42e397b44bffb901
Point Cloud Analysis library
|
Procedure that compute and decompose the covariance matrix of the neighbors positions in \(3d\). More...
#include <covarianceFit.h>
Inheritance diagram for Ponca::CovarianceFitBase< DataPoint, _NFilter, T >:
Collaboration diagram for Ponca::CovarianceFitBase< DataPoint, _NFilter, T >:Public Types | |
| using | Scalar = typename DataPoint::Scalar |
| Alias to scalar type. | |
| using | VectorType = typename Base::VectorType |
| Alias to vector type. | |
| using | NeighborFilter = typename Base::NeighborFilter |
| Alias to the filter applied on the neighbors. | |
| using | MatrixType = typename DataPoint::MatrixType |
| Alias to matrix type. | |
| using | Solver = Eigen::SelfAdjointEigenSolver< MatrixType > |
| Solver used to analyse the covariance matrix. | |
Public Member Functions | |
| CovarianceFitBase< DataPoint, _NFilter, T > & | covarianceFit () |
| Explicit conversion to CovarianceFitBase , to access methods potentially hidden by heritage. | |
| const CovarianceFitBase< DataPoint, _NFilter, T > & | covarianceFit () const |
| Explicit conversion to CovarianceFitBase , to access methods potentially hidden by heritage. | |
| void | init () |
| Set the evaluation position and reset the internal states. | |
| void | addLocalNeighbor (Scalar w, const VectorType &localQ, const DataPoint &attributes) |
| Add a neighbor to perform the fit. | |
| FIT_RESULT | finalize () |
| Finalize the procedure. | |
| Scalar | surfaceVariation () const |
| Implements [12] surface variation. | |
| Scalar | planarity () const |
| Implements the planarity [7] . | |
| Scalar | linearity () const |
| Implements the linearity [7] . | |
| Scalar | sphericity () const |
| Implements the sphericity [7] . | |
| Scalar | anisotropy () const |
| Implements the anisotropy [7] . | |
| Scalar | eigenentropy () const |
| Implements the eigenentropy [7] . | |
| Scalar | lambda_0 () const |
| The minimum eigenvalue \( \lambda_0 \). | |
| Scalar | lambda_1 () const |
| The second eigenvalue \( \lambda_1 \). | |
| Scalar | lambda_2 () const |
| The maximum eigenvalue \( \lambda_2 \). | |
| const Solver & | solver () const |
| Reading access to the Solver used to analyse the covariance matrix. | |
Protected Types | |
| enum | { Check = Base::PROVIDES_MEAN_POSITION , PROVIDES_POSITION_COVARIANCE } |
| using | Base = T |
| Base class of the procedure. | |
Protected Attributes | |
| MatrixType | m_cov {MatrixType::Zero()} |
| Covariance matrix. | |
| Solver | m_solver |
| Solver used to analyse the covariance matrix. | |
Procedure that compute and decompose the covariance matrix of the neighbors positions in \(3d\).
This process is commonly used for plane fitting and local variance analysis. It is often called Principal Component Analysis (PCA) of the neighborhood, and used in Geometry Processing and Computer Vision.
Standard PCA algorithm involves a two-steps process where the barycenter \(\mathbf{b}\) is first computed, and then the covariance matrix \(\text{C}\) (in the following, the weights are ignored for clarity but without loss of generality):
\begin{align} \mathbf{b} &= \frac{1}{n}\sum_i\mathbf{p}_i \\ \text{C} &= \frac{1}{n}\sum_i(\mathbf{p}_i-\mathbf{b})(\mathbf{p}_i-\mathbf{b})^T \end{align}
This class implements a single-pass version, where the first formulation is re-expressed as follows:
\begin{align} \text{C} &= \frac{1}{n}\sum_i (\mathbf{p}_i\mathbf{p}_i^T - \mathbf{b}\mathbf{p}_i^T - \mathbf{p}_i\mathbf{b}^T + \mathbf{b}\mathbf{b}^T) \\ &= \frac{1}{n}\sum_i (\mathbf{p}_i\mathbf{p}_i^T) - \frac{1}{n}\sum_i(\mathbf{b}\mathbf{p}_i^T) - \frac{1}{n}\sum_i(\mathbf{p}_i\mathbf{b}^T) + \frac{1}{n}\sum_i (\mathbf{b}\mathbf{b}^T) \\ &= \frac{1}{n}\sum_i (\mathbf{p}_i\mathbf{p}_i^T) - \mathbf{b}\frac{1}{n}\sum_i(\mathbf{p}_i^T) - \frac{1}{n}\sum_i(\mathbf{p}_i)\mathbf{b}^T + \frac{1}{n}\sum_i(1) \mathbf{b}\mathbf{b}^T \\ &= \frac{1}{n}\sum_i (\mathbf{p}_i\mathbf{p}_i^T) - \mathbf{b}\mathbf{b}^T - \mathbf{b}\mathbf{b}^T + \mathbf{b}\mathbf{b}^T \end{align}
Leading to a single pass where \(\text{C}\) is express by subtracting two terms that can be computed independently in one run:
\[ \text{C} = \frac{1}{n}\sum_i (\mathbf{p}_i\mathbf{p}_i^T) - \mathbf{b}\mathbf{b}^T \]
All the computed features are defined for the 3 eigenvalues \( 0 < \lambda_0 \leq \lambda_1 \leq \lambda_2 \).
Definition at line 59 of file covarianceFit.h.
|
protected |
Base class of the procedure.
Definition at line 61 of file covarianceFit.h.
| using Ponca::CovarianceFitBase< DataPoint, _NFilter, T >::MatrixType = typename DataPoint::MatrixType |
Alias to matrix type.
Definition at line 71 of file covarianceFit.h.
| using Ponca::CovarianceFitBase< DataPoint, _NFilter, T >::NeighborFilter = typename Base::NeighborFilter |
Alias to the filter applied on the neighbors.
Definition at line 61 of file covarianceFit.h.
| using Ponca::CovarianceFitBase< DataPoint, _NFilter, T >::Scalar = typename DataPoint::Scalar |
Alias to scalar type.
Definition at line 61 of file covarianceFit.h.
| using Ponca::CovarianceFitBase< DataPoint, _NFilter, T >::Solver = Eigen::SelfAdjointEigenSolver<MatrixType> |
Solver used to analyse the covariance matrix.
Definition at line 73 of file covarianceFit.h.
| using Ponca::CovarianceFitBase< DataPoint, _NFilter, T >::VectorType = typename Base::VectorType |
Alias to vector type.
Definition at line 61 of file covarianceFit.h.
Definition at line 64 of file covarianceFit.h.
|
inline |
Add a neighbor to perform the fit.
Definition at line 18 of file covarianceFit.hpp.
|
inline |
Implements the anisotropy [7] .
Anisotropy is defined as:
\[ \frac{\lambda_2 - \lambda_0}{\lambda_2} \]
Definition at line 78 of file covarianceFit.hpp.
|
inline |
Explicit conversion to CovarianceFitBase , to access methods potentially hidden by heritage.
Definition at line 81 of file covarianceFit.h.
|
inline |
Explicit conversion to CovarianceFitBase , to access methods potentially hidden by heritage.
Definition at line 81 of file covarianceFit.h.
|
inline |
Implements the eigenentropy [7] .
Eigenentropy is defined as:
\[ - \lambda_0 * \ln{\lambda_0} - \lambda_1 * \ln{\lambda_1} - \lambda_2 * \ln{\lambda_2} \]
Definition at line 85 of file covarianceFit.hpp.
|
inline |
Finalize the procedure.
Definition at line 26 of file covarianceFit.hpp.
Set the evaluation position and reset the internal states.
Definition at line 11 of file covarianceFit.hpp.
|
inline |
The minimum eigenvalue \( \lambda_0 \).
Definition at line 94 of file covarianceFit.hpp.
|
inline |
The second eigenvalue \( \lambda_1 \).
Definition at line 100 of file covarianceFit.hpp.
|
inline |
The maximum eigenvalue \( \lambda_2 \).
Definition at line 106 of file covarianceFit.hpp.
|
inline |
Implements the linearity [7] .
Linearity is defined as:
\[ \frac{\lambda_2 - \lambda_1}{\lambda_2} \]
Definition at line 64 of file covarianceFit.hpp.
|
inline |
Implements the planarity [7] .
Planarity is defined as:
\[ \frac{\lambda_1 - \lambda_0}{\lambda_2} \]
Definition at line 57 of file covarianceFit.hpp.
|
inline |
Reading access to the Solver used to analyse the covariance matrix.
Definition at line 134 of file covarianceFit.h.
|
inline |
Implements the sphericity [7] .
Sphericity is defined as:
\[ \frac{\lambda_0}{\lambda_2} \]
Definition at line 71 of file covarianceFit.hpp.
|
inline |
Implements [12] surface variation.
It computes the ratio \( d \frac{\lambda_0}{\sum_i \lambda_i} \) with d the dimension of the ambient space.
Definition at line 50 of file covarianceFit.hpp.
|
protected |
Covariance matrix.
Definition at line 77 of file covarianceFit.h.
|
protected |
Solver used to analyse the covariance matrix.
Definition at line 78 of file covarianceFit.h.