Class TldFernClassifier<T extends ImageGray<T>>

java.lang.Object
boofcv.alg.tracker.tld.TldFernClassifier<T>

public class TldFernClassifier<T extends ImageGray<T>> extends Object
Manages ferns, creates their descriptions, compute their values, and handles their probabilities.
  • Field Details

  • Constructor Details

    • TldFernClassifier

      public TldFernClassifier(Random rand, int numFerns, int descriptorSize, int numLearnRandom, float fernLearnNoise, InterpolatePixelS<T> interpolate)
      Configures fern algorithm
      Parameters:
      rand - Random number generated used for creating ferns
      numFerns - Number of ferns to created. Typically 10
      descriptorSize - Size of each fern's descriptor. Typically 10
      numLearnRandom - Number of ferns which will be generated by adding noise to the image
      fernLearnNoise - The noise's standard deviation
      interpolate - Interpolation function for the image
    • TldFernClassifier

      protected TldFernClassifier()
  • Method Details

    • reset

      public void reset()
      Discard all information on fern values and their probabilities
    • setImage

      public void setImage(T gray)
      Call before any other functions. Provides the image that is being sampled.
      Parameters:
      gray - Input image.
    • learnFern

      public void learnFern(boolean positive, ImageRectangle r)
      Learns a fern from the specified region. No noise is added.
    • learnFernNoise

      public void learnFernNoise(boolean positive, ImageRectangle r)
      Computes the value for each fern inside the region and update's their P and N value. Noise is added to the image measurements to take in account the variability.
    • lookupFernPN

      public boolean lookupFernPN(TldRegionFernInfo info)
      For the specified regions, computes the values of each fern inside of it and then retrives their P and N values. The sum of which is stored inside of info.
      Parameters:
      info - (Input) Location/Rectangle (output) P and N values
      Returns:
      true if a known value for any of the ferns was observed in this region
    • computeFernValue

      protected int computeFernValue(float c_x, float c_y, float rectWidth, float rectHeight, TldFernDescription fern)
      Computes the value of the specified fern at the specified location in the image.
    • computeFernValueRand

      protected int computeFernValueRand(float c_x, float c_y, float rectWidth, float rectHeight, TldFernDescription fern)
      Computes the value of a fern after adding noise to the image being sampled.
    • renormalizeP

      public void renormalizeP()
      Renormalizes fern.numP to avoid overflow
    • renormalizeN

      public void renormalizeN()
      Renormalizes fern.numN to avoid overflow
    • getMaxP

      public int getMaxP()
    • getMaxN

      public int getMaxN()