Package boofcv.alg.feature.color
Class Histogram_F64
java.lang.Object
boofcv.struct.feature.TupleDesc_F64
boofcv.alg.feature.color.Histogram_F64
- All Implemented Interfaces:
TupleDesc<TupleDesc_F64>,Serializable
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
ConstructorsConstructorDescriptionHistogram_F64(int... lengths) Creates a multi dimensional histogram where each dimension has the specified lengths. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates an exact copy of "this" histogramdoubleget(int[] coordinate) Returns the value at the N-D coordinatedoubleget(int i, int j) Returns the value at the 2D coordinatedoubleget(int i, int j, int k) Returns the value at the 3D coordinateintgetDimensionIndex(int dimension, double value) Given a value it returns the corresponding bin index in this histogram for the specified dimension.intgetDimensionIndex(int dimension, int value) Given a value it returns the corresponding bin index in this histogram for integer values.intThe number of dimensions in the histogram.final intgetIndex(int[] coordinate) For a N-Dimensional histogram it will return the array index for the N-D coordinatefinal intgetIndex(int i, int j) For a 2D histogram it returns the array index for coordinate (i,j)final intgetIndex(int i, int j, int k) For a 3D histogram it returns the array index for coordinate (i,j,k)intgetLength(int dimension) Number of elements/bins along the specified dimensiondoublegetMaximum(int dimension) Returns the maximum allowed value in a dimensiondoublegetMinimum(int dimension) Returns the minimum allowed value in a dimensionbooleanReturns true if the min and max value for each dimension has been setCreates a new instance of this histogram which has the same "shape" and min / max values.voidsetMaximum(int dimension, double value) Sets the maximum allowed value in a particular dimensionvoidsetMinimum(int dimension, double value) Sets the minimum allowed value in a particular dimensionvoidsetRange(int dimension, double min, double max) Specifies the minimum and maximum values for a specific dimension
-
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 dimensionmin- The minimum valuemax- The maximum value
-
setMinimum
public void setMinimum(int dimension, double value) Sets the minimum allowed value in a particular dimension- Parameters:
dimension- Which dimensionvalue- minimum value
-
setMaximum
public void setMaximum(int dimension, double value) Sets the maximum allowed value in a particular dimension- Parameters:
dimension- Which dimensionvalue- 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 tovalue- 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 tovalue- 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 0j- 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 0j- index along axis 1k- 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-0j- 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-0j- index along axis-1k- 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
Creates an exact copy of "this" histogram- Returns:
- Copy
-
newInstance
Creates a new instance of this histogram which has the same "shape" and min / max values.- Specified by:
newInstancein interfaceTupleDesc<TupleDesc_F64>- Overrides:
newInstancein classTupleDesc_F64
-