Class LocalWeightedHistogramRotRect<T extends ImageBase<T>>


public class LocalWeightedHistogramRotRect<T extends ImageBase<T>> extends Object
Computes a local histogram weighted using a Gaussian function. The weighting function is shaped using a rotated rectangle, where the sigma along each axis is set by the rectangle's width and height. For use with TrackerMeanShiftComaniciu2003. The histogram is stored in a row major format.
  • Field Details

    • maxPixelValue

      protected float maxPixelValue
    • c

      protected float c
    • s

      protected float s
    • imageX

      public float imageX
    • imageY

      public float imageY
    • sampleHistIndex

      protected int[] sampleHistIndex
    • weights

      protected float[] weights
    • histogram

      protected float[] histogram
    • samplePts

      protected List<Point2D_F32> samplePts
  • Constructor Details

    • LocalWeightedHistogramRotRect

      public LocalWeightedHistogramRotRect(int numSamples, double numSigmas, int numHistogramBins, int numBands, float maxPixelValue, InterpolatePixelMB<T> interpolate)
      Configures histogram calculation.
      numSamples - Number of points it samples along each axis of the rectangle.
      numSigmas - Number of standard deviations away the sides will be from the center. Try 3
      numHistogramBins - Number of bins in the histogram
      numBands - Number of bands in the input image
      maxPixelValue - Maximum value of a pixel across all bands
      interpolate - Function used to interpolate the image
  • Method Details

    • computeWeights

      protected void computeWeights(int numSamples, double numSigmas)
      compute the weights by convolving 1D gaussian kernel
    • createSamplePoints

      protected void createSamplePoints(int numSamples)
      create the list of points in square coordinates that it will sample. values will range from -0.5 to 0.5 along each axis.
    • computeHistogram

      public void computeHistogram(T image, RectangleRotate_F32 region)
      Computes the histogram inside the specified region. Results are returned by calling getHistogram().
      image - Input image
      region - Region which is to be sampled
    • computeHistogramInside

      protected void computeHistogramInside(RectangleRotate_F32 region)
      Computes the histogram quickly inside the image
    • computeHistogramBorder

      protected void computeHistogramBorder(T image, RectangleRotate_F32 region)
      Computes the histogram and skips pixels which are outside the image border
    • computeHistogramBin

      protected int computeHistogramBin(float[] value)
      Given the value of a pixel, compute which bin in the histogram it belongs in
    • isInFastBounds

      protected boolean isInFastBounds(RectangleRotate_F32 region)
      Checks to see if the region can be sampled using the fast algorithm
    • normalizeHistogram

      protected void normalizeHistogram()
    • squareToImageSample

      protected void squareToImageSample(float x, float y, RectangleRotate_F32 region)
      Converts a point from square coordinates into image coordinates
    • getHistogram

      public float[] getHistogram()
    • getSampleHistIndex

      public int[] getSampleHistIndex()
    • getSamplePts

      public List<Point2D_F32> getSamplePts()