DGtal  0.9.3beta
Public Types | Public Member Functions | Private Attributes
DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder > Class Template Reference

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

Collaboration diagram for DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >:
[legend]

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
 
const SCellEmbeddermyEmbedder
 
double myH
 
RealPoint myReceiver
 
SimpleMatrix< double, 3, 3 > myAccum
 
SimpleMatrix< double, 3, 3 > myId
 
SimpleMatrix< double, 3, 3 > myVote
 
double myArea
 

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 [53])

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

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

Definition at line 88 of file TensorVotingFeatureExtraction.h.

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

Definition at line 87 of file TensorVotingFeatureExtraction.h.

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

Definition at line 86 of file TensorVotingFeatureExtraction.h.

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

Definition at line 85 of file TensorVotingFeatureExtraction.h.

Constructor & Destructor Documentation

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.

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.

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

Member Function Documentation

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.

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

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  }
DGtal::uint32_t Dimension
Definition: Common.h:120
SimpleMatrix< double, 3, 3 > myAccum
Covariance accumulator.
static void getEigenDecomposition(const Matrix &matrix, Matrix &eigenVectors, Vector &eigenValues)
Compute both eigen vectors and eigen values from an input matrix.
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.

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().

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  }
DGtal::uint32_t Dimension
Definition: Common.h:120
const SCellEmbedder * myEmbedder
Alias of the geometrical embedder.
SimpleMatrix< double, 3, 3 > myAccum
Covariance accumulator.
RealPoint myReceiver
Receiver (embedding of the starting surfel)
void setComponent(const DGtal::Dimension i, const DGtal::Dimension j, const Component &aValue)
template<typename TSurfel , typename TEmbedder >
void DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::reset ( )
inline

Field Documentation

template<typename TSurfel , typename TEmbedder >
SimpleMatrix<double, 3, 3> DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myAccum
private
template<typename TSurfel , typename TEmbedder >
double DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myArea
private
template<typename TSurfel , typename TEmbedder >
const SCellEmbedder* DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myEmbedder
private
template<typename TSurfel , typename TEmbedder >
bool DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myFirstSurfel
private
template<typename TSurfel , typename TEmbedder >
double DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myH
private

Definition at line 191 of file TensorVotingFeatureExtraction.h.

template<typename TSurfel , typename TEmbedder >
SimpleMatrix<double, 3, 3> DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::myId
private
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().

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: