DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder > Class Template Reference

Aim: Implements a functor to detect feature points from normal tensor voting strategy. More...

#include <DGtal/geometry/surfaces/estimation/estimationFunctors/TensorVotingFeatureExtraction.h>

Public Types

typedef TSurfel Surfel
 
typedef TEmbedder SCellEmbedder
 
typedef SCellEmbedder::RealPoint RealPoint
 
typedef double Quantity
 

Public Member Functions

 TensorVotingFeatureExtraction (ConstAlias< SCellEmbedder > anEmbedder, const double h)
 
void pushSurfel (const Surfel &aSurf, const double aDistance)
 
Quantity eval ()
 
void reset ()
 

Private Attributes

bool myFirstSurfel
 First surfel flag.
 
const SCellEmbeddermyEmbedder
 Alias of the geometrical embedder.
 
double myH
 
RealPoint myReceiver
 Receiver (embedding of the starting surfel)
 
SimpleMatrix< double, 3, 3 > myAccum
 Covariance accumulator.
 
SimpleMatrix< double, 3, 3 > myId
 
SimpleMatrix< double, 3, 3 > myVote
 
double myArea
 Convolution kernel area.
 

Detailed Description

template<typename TSurfel, typename TEmbedder>
class DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >

Aim: Implements a functor to detect feature points from normal tensor voting strategy.

Description of template class 'TensorVotingFeatureExtraction'

More precisely, the functor accumulates tensor votes \(I - vv^T/\|vv^T\|\) for each surfel added during the scan ( \(v\) being the vector from the center of the neighborhood to the added surfel). Then, the eval() method returns the ratio \(\frac{\lambda_1+\lambda_2}{\lambda_3}\) of the eigenvalues ( \( \lambda_1\leq\lambda_2\leq\lambda_3\)) of the accumulated tensor votes.

(see [95])

model of concepts::CLocalEstimatorFromSurfelFunctor

Template Parameters
TSurfeltype of surfels
TEmbeddertype of functors which embed surfel to \( \mathbb{R}^3\)

Definition at line 81 of file TensorVotingFeatureExtraction.h.

Member Typedef Documentation

◆ Quantity

template<typename TSurfel , typename TEmbedder >
typedef double DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::Quantity

Definition at line 88 of file TensorVotingFeatureExtraction.h.

◆ RealPoint

template<typename TSurfel , typename TEmbedder >
typedef SCellEmbedder::RealPoint DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::RealPoint

Definition at line 87 of file TensorVotingFeatureExtraction.h.

◆ SCellEmbedder

template<typename TSurfel , typename TEmbedder >
typedef TEmbedder DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::SCellEmbedder

Definition at line 86 of file TensorVotingFeatureExtraction.h.

◆ Surfel

template<typename TSurfel , typename TEmbedder >
typedef TSurfel DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::Surfel

Definition at line 85 of file TensorVotingFeatureExtraction.h.

Constructor & Destructor Documentation

◆ TensorVotingFeatureExtraction()

template<typename TSurfel , typename TEmbedder >
DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::TensorVotingFeatureExtraction ( ConstAlias< SCellEmbedder > anEmbedder,
const double h )
inline

Constructor.

Parameters
anEmbedderembedder to map surfel to R^n.
hgrid step

Definition at line 96 of file TensorVotingFeatureExtraction.h.

97 :
98 myEmbedder(&anEmbedder), myH(h)
99 {
100 myId.identity();
101 myArea = 0.0;
102 myFirstSurfel = true;
103 myAccum.constant(0.0);
104 }
void constant(const Component &aScalar)
const SCellEmbedder * myEmbedder
Alias of the geometrical embedder.
SimpleMatrix< double, 3, 3 > myAccum
Covariance accumulator.

References DGtal::SimpleMatrix< TComponent, TM, TN >::constant(), DGtal::SimpleMatrix< TComponent, TM, TN >::identity(), DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myAccum, DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myArea, DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myFirstSurfel, and DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myId.

Member Function Documentation

◆ eval()

template<typename TSurfel , typename TEmbedder >
Quantity DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::eval ( )
inline

Evaluate the feature score.

I.e. (l_1+l_2)/l_3 of the tensor eigenvalues (l_1<l_2<l_3).

Returns
the feature score

Definition at line 154 of file TensorVotingFeatureExtraction.h.

155 {
156 SimpleMatrix<double, 3, 3> eigenvectors;
157 RealPoint eigenvalues;
158
159 myAccum /= myArea;
161
162#ifdef DEBUG
163 for( Dimension i_dim = 1; i_dim < 3; ++i_dim )
164 ASSERT ( std::abs(eigenvalues[i_dim - 1]) <= std::abs(eigenvalues[i_dim]) );
165#endif
166
167 return ((eigenvalues[0] + eigenvalues[1])/(eigenvalues[2]));
168 }
static void getEigenDecomposition(const Matrix &matrix, Matrix &eigenVectors, Vector &eigenValues)
Compute both eigen vectors and eigen values from an input matrix.
DGtal::uint32_t Dimension
Definition Common.h:136
PointVector< 3, double > RealPoint

References DGtal::EigenDecomposition< TN, TComponent, TMatrix >::getEigenDecomposition(), DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myAccum, and DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myArea.

◆ pushSurfel()

template<typename TSurfel , typename TEmbedder >
void DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::pushSurfel ( const Surfel & aSurf,
const double aDistance )
inline

Add the geometrical embedding of a surfel to the point list and update the tensor voting.

Parameters
aSurfa surfel to add
aDistancedistance of aSurf to the neighborhood boundary

Definition at line 113 of file TensorVotingFeatureExtraction.h.

115 {
116 if (myFirstSurfel)
117 {
118 myReceiver = myEmbedder->operator()(aSurf);
119 myFirstSurfel = false;
120 }
121 else
122 {
123 myArea+= aDistance;
124 const RealPoint p = myEmbedder->operator()(aSurf);
125 const RealPoint v = p - myReceiver;
126
127 double maxcol = 0.0;
128 double matnorm = 0.0;
129
130 // I - vv^t/||vv^t||
131 for(DGtal::Dimension i= 0; i <3; i++)
132 {
133 maxcol = 0.0;
134 for(DGtal::Dimension j=0; j < 3; j++)
135 {
136 myVote.setComponent(i,j, v(i)*v(j));
137 if (std::abs(v(i)*v(j)) > maxcol)
138 maxcol = std::abs(v(i)*v(j));
139 }
140 matnorm += maxcol;
141 }
142
143 myAccum += (myId - myVote/matnorm)*aDistance;
144 }
145 }
void setComponent(const DGtal::Dimension i, const DGtal::Dimension j, const Component &aValue)
RealPoint myReceiver
Receiver (embedding of the starting surfel)

References DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myAccum, DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myArea, DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myEmbedder, DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myFirstSurfel, DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myId, DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myReceiver, DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myVote, and DGtal::SimpleMatrix< TComponent, TM, TN >::setComponent().

◆ reset()

Field Documentation

◆ myAccum

◆ myArea

◆ myEmbedder

template<typename TSurfel , typename TEmbedder >
const SCellEmbedder* DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myEmbedder
private

◆ myFirstSurfel

◆ myH

template<typename TSurfel , typename TEmbedder >
double DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myH
private

Definition at line 191 of file TensorVotingFeatureExtraction.h.

◆ myId

◆ myReceiver

template<typename TSurfel , typename TEmbedder >
RealPoint DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myReceiver
private

Receiver (embedding of the starting surfel)

Definition at line 194 of file TensorVotingFeatureExtraction.h.

Referenced by DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::pushSurfel().

◆ myVote

template<typename TSurfel , typename TEmbedder >
SimpleMatrix<double, 3, 3> DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myVote
private

The documentation for this class was generated from the following file: