Class Histogram_F64

java.lang.Object
boofcv.struct.feature.TupleDesc_F64
boofcv.alg.feature.color.Histogram_F64
All Implemented Interfaces:
TupleDesc<TupleDesc_F64>, Serializable

public class Histogram_F64 extends TupleDesc_F64

A multi dimensional histogram. This is an extension of TupleDesc_F64 to faciliate comparision of different histograms. Each dimension in the histogram coverages a range from the minimum to maximum value. This range is divided by the number of bins in a dimension. Data is stored in a row major format from lower dimension to upper dimension. For a 3D histogram a coordinate (a,b,c) would have index = c + b*length[0] + a*length[0]*length[1].

Usage example for RGB image:

 Histogram_F64 hist = new Histogram_F64(20,20,20);
 hist.setRange(0,0,255);
 hist.setRange(1,0,255);
 hist.setRange(2,0,255);
 GHistogramFeatureOps.histogram(image,hist);
See Also:
  • Field Summary

    Fields inherited from class boofcv.struct.feature.TupleDesc_F64

    data
  • Constructor Summary

    Constructors
    Constructor
    Description
    Histogram_F64(int... lengths)
    Creates a multi dimensional histogram where each dimension has the specified lengths.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates an exact copy of "this" histogram
    double
    get(int[] coordinate)
    Returns the value at the N-D coordinate
    double
    get(int i, int j)
    Returns the value at the 2D coordinate
    double
    get(int i, int j, int k)
    Returns the value at the 3D coordinate
    int
    getDimensionIndex(int dimension, double value)
    Given a value it returns the corresponding bin index in this histogram for the specified dimension.
    int
    getDimensionIndex(int dimension, int value)
    Given a value it returns the corresponding bin index in this histogram for integer values.
    int
    The number of dimensions in the histogram.
    final int
    getIndex(int[] coordinate)
    For a N-Dimensional histogram it will return the array index for the N-D coordinate
    final int
    getIndex(int i, int j)
    For a 2D histogram it returns the array index for coordinate (i,j)
    final int
    getIndex(int i, int j, int k)
    For a 3D histogram it returns the array index for coordinate (i,j,k)
    int
    getLength(int dimension)
    Number of elements/bins along the specified dimension
    double
    getMaximum(int dimension)
    Returns the maximum allowed value in a dimension
    double
    getMinimum(int dimension)
    Returns the minimum allowed value in a dimension
    boolean
    Returns true if the min and max value for each dimension has been set
    Creates a new instance of this histogram which has the same "shape" and min / max values.
    void
    setMaximum(int dimension, double value)
    Sets the maximum allowed value in a particular dimension
    void
    setMinimum(int dimension, double value)
    Sets the minimum allowed value in a particular dimension
    void
    setRange(int dimension, double min, double max)
    Specifies the minimum and maximum values for a specific dimension

    Methods inherited from class boofcv.struct.feature.TupleDesc_F64

    fill, get, getDouble, setTo, setTo, size

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Histogram_F64

      public Histogram_F64(int... lengths)
      Creates a multi dimensional histogram where each dimension has the specified lengths.
      Parameters:
      lengths - Number of elements in each dimension
  • Method Details

    • isRangeSet

      public boolean isRangeSet()
      Returns true if the min and max value for each dimension has been set
      Returns:
      true if range has been set
    • getDimensions

      public int getDimensions()
      The number of dimensions in the histogram.
      Returns:
      dimensions
    • getLength

      public int getLength(int dimension)
      Number of elements/bins along the specified dimension
      Parameters:
      dimension - Which dimension
      Returns:
      Number of bins
    • setRange

      public void setRange(int dimension, double min, double max)
      Specifies the minimum and maximum values for a specific dimension
      Parameters:
      dimension - Which dimension
      min - The minimum value
      max - The maximum value
    • setMinimum

      public void setMinimum(int dimension, double value)
      Sets the minimum allowed value in a particular dimension
      Parameters:
      dimension - Which dimension
      value - minimum value
    • setMaximum

      public void setMaximum(int dimension, double value)
      Sets the maximum allowed value in a particular dimension
      Parameters:
      dimension - Which dimension
      value - maximum value
    • getMinimum

      public double getMinimum(int dimension)
      Returns the minimum allowed value in a dimension
      Parameters:
      dimension - Which dimension
      Returns:
      minimum value
    • getMaximum

      public double getMaximum(int dimension)
      Returns the maximum allowed value in a dimension
      Parameters:
      dimension - Which dimension
      Returns:
      maximum value
    • getDimensionIndex

      public int getDimensionIndex(int dimension, double value)
      Given a value it returns the corresponding bin index in this histogram for the specified dimension. This is for floating point values.
      Parameters:
      dimension - Which dimension the value belongs to
      value - Floating point value between min and max, inclusive.
      Returns:
      The index/bin
    • getDimensionIndex

      public int getDimensionIndex(int dimension, int value)
      Given a value it returns the corresponding bin index in this histogram for integer values. The discretion is taken in account and 1 is added to the range.
      Parameters:
      dimension - Which dimension the value belongs to
      value - Floating point value between min and max, inclusive.
      Returns:
      The index/bin
    • getIndex

      public final int getIndex(int i, int j)
      For a 2D histogram it returns the array index for coordinate (i,j)
      Parameters:
      i - index along axis 0
      j - index along axis 1
      Returns:
      array index
    • getIndex

      public final int getIndex(int i, int j, int k)
      For a 3D histogram it returns the array index for coordinate (i,j,k)
      Parameters:
      i - index along axis 0
      j - index along axis 1
      k - index along axis 2
      Returns:
      array index
    • getIndex

      public final int getIndex(int[] coordinate)
      For a N-Dimensional histogram it will return the array index for the N-D coordinate
      Parameters:
      coordinate - N-D coordinate
      Returns:
      index
    • get

      public double get(int i, int j)
      Returns the value at the 2D coordinate
      Parameters:
      i - index along axis-0
      j - index along axis-1
      Returns:
      histogram value
    • get

      public double get(int i, int j, int k)
      Returns the value at the 3D coordinate
      Parameters:
      i - index along axis-0
      j - index along axis-1
      k - index along axis-2
      Returns:
      histogram value
    • get

      public double get(int[] coordinate)
      Returns the value at the N-D coordinate
      Parameters:
      coordinate - N-D coordinate
      Returns:
      histogram value
    • copy

      public Histogram_F64 copy()
      Creates an exact copy of "this" histogram
      Returns:
      Copy
    • newInstance

      public Histogram_F64 newInstance()
      Creates a new instance of this histogram which has the same "shape" and min / max values.
      Specified by:
      newInstance in interface TupleDesc<TupleDesc_F64>
      Overrides:
      newInstance in class TupleDesc_F64