Class DescriptorDistance

java.lang.Object
boofcv.alg.descriptor.DescriptorDistance

public class DescriptorDistance
extends Object
Series of simple functions for computing difference distance measures between two descriptors.
  • Constructor Details

    • DescriptorDistance

      public DescriptorDistance()
  • Method Details

    • euclidean

      public static double euclidean​(TupleDesc_F64 a, TupleDesc_F64 b)
      Returns the Euclidean distance (L2-norm) between the two descriptors.
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      Euclidean distance
    • euclideanSq

      public static double euclideanSq​(TupleDesc_F64 a, TupleDesc_F64 b)
      Returns the Euclidean distance squared between the two descriptors.
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      Euclidean distance squared
    • euclideanSq

      public static double euclideanSq​(TupleDesc_U8 a, TupleDesc_U8 b)
      Returns the Euclidean distance squared between the two descriptors.
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      Euclidean distance squared
    • euclideanSq

      public static double euclideanSq​(TupleDesc_S8 a, TupleDesc_S8 b)
      Returns the Euclidean distance squared between the two descriptors.
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      Euclidean distance squared
    • euclideanSq

      public static double euclideanSq​(TupleDesc_F32 a, TupleDesc_F32 b)
      Returns the Euclidean distance squared between the two descriptors.
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      Euclidean distance squared
    • correlation

      public static double correlation​(TupleDesc_F64 a, TupleDesc_F64 b)
      Correlation score
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      Correlation score
    • ncc

      public static double ncc​(NccFeature a, NccFeature b)

      Normalized cross correlation (NCC) computed using a faster technique.

      NCC = sum(a[i]*b[i]) / (N*sigma_a * sigma_b)
      where a[i] = I[i]-mean(a), I[i] is the image pixel intensity around the feature, and N is the number of elements.

      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      NCC score
    • sad

      public static int sad​(TupleDesc_U8 a, TupleDesc_U8 b)
      Sum of absolute difference (SAD) score
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      SAD score
    • sad

      public static int sad​(TupleDesc_S8 a, TupleDesc_S8 b)
      Sum of absolute difference (SAD) score
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      SAD score
    • sad

      public static float sad​(TupleDesc_F32 a, TupleDesc_F32 b)
      Sum of absolute difference (SAD) score
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      SAD score
    • sad

      public static double sad​(TupleDesc_F64 a, TupleDesc_F64 b)
      Sum of absolute difference (SAD) score
      Parameters:
      a - First descriptor
      b - Second descriptor
      Returns:
      SAD score
    • hamming

      public static int hamming​(TupleDesc_B a, TupleDesc_B b)
      Computes the hamming distance between two binary feature descriptors
      Parameters:
      a - First variable
      b - Second variable
      Returns:
      The hamming distance
    • hamming

      public static int hamming​(int val)

      Computes the hamming distance. A bit = 0 is a match and 1 is not match

      Based on code snippet from Sean Eron Anderson Bit Twiddling Hacks.

      Parameters:
      val - Hamming encoding
      Returns:
      The hamming distance
    • hamming

      public static int hamming​(long val)