Back to Adaptive Vision Library website
You are here: Start » Function Reference » Histogram Metrics » HistogramDistance
HistogramDistance
Computes the numeric distance between two histograms.
Syntax
C++
C#
void avl::HistogramDistance ( const avl::Histogram& inHistogram1, const avl::Histogram& inHistogram2, avl::DistanceMeasure::Type inDistanceMeasure, float& outDistance )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
inHistogram1 | const Histogram& | First input histogram | ||
inHistogram2 | const Histogram& | Second input histogram | ||
inDistanceMeasure | DistanceMeasure::Type | Measure of distance | ||
outDistance | float& | Output distance value |
Description
The operation computes the approximate difference between two histograms using the selected distance measure.
- If the inDistanceMeasure is set to MeanError then the resulting outDistance is the average difference between corresponding bins of the histograms.
- If the inDistanceMeasure is set to MeanSquaredError then the resulting outDistance is the average squared difference between corresponding bins of the histograms.
Examples
Remarks
- inHistogram1 and inHistogram2 must have the same BinSizes, otherwise an error with appropriate description occurs.
Errors
Error type | Description |
---|---|
DomainError | Inconsistent histogram bin sizes / domains in HistogramDistance. |
DomainError | Empty histograms on input in HistogramDistance. |
DomainError | Not supported DistanceMeasure in HistogramDistance. |