Rewrite texture computation for FeatureExtraction application (ScalarImageTextureFunctor is doing too many allocations)

From OTBWiki
Jump to: navigation, search

Use the itkScalarImageTextureCalculator, itkGreyLevelCoocurenceMatrixTextureCoefficientClaculator to create neighborhood functors and functions that compute:

  1. Energy
  2. Inertia : equal to contrast
  3. ClusterShade
  4. ClusterProminence

Haralick descriptors, see [1] (use Scott formula for bin computation):

  1. Angular second moment
  2. Contrast
  3. Correlation : need validation
  4. Sum of squares: Variance
  5. Inverse difference moment (Homogeneity)
  6. Sum average
  7. Sum variance
  8. Sum entropy
  9. Entropy
  10. Difference variance
  11. Difference entropy
  12. Information measure of correlation(1)
  13. Information measure of correlation(2)

Cherry onthe cake:

  1. Mean

To gather the code used by the functors and functions, a TextureFunctorBase was made. It is templated with NeighborhoodIterators (one for the neighborhood, one for the offset neighborhood).

The method operator(), loops over each component of the pointed pixel, creates 2 Neighbordhoods that are given to a method ComputeOverSingleChannel declared pure virtual. The function class, calls directly this method using it.GetNeighborhood(). Each texture functor inherits from TextureFunctorBase and only has to overload ComputeOverSingleChannel.

Moreover, TextureFunctorBase deals with the offset setting (used in the computation).

MAJ: Haralick descriptors formula: [2]