Back to Adaptive Vision Library website
You are here: Start » Function Reference » Image Metrics » ColorDistance
ColorDistance
Compares two pixels using chromatic and non-chromatic information. Assumes RGB-like color space.
Header: | AVL.h |
---|
Syntax
C++
C#
void avl::ColorDistance ( const avl::Pixel& inPixelA, const avl::Pixel& inPixelB, float inChromaAmount, float& outDistance )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
inPixelA | const Pixel& | ||||
inPixelB | const Pixel& | ||||
inChromaAmount | float | 0.0 - 1.0 | 0.7f | Proportion of chromatic information in distance computation | |
outDistance | float& |
Description
The operation computes the distance between two pixels.
The distance between pixels is computed using two measures:
- Value distance - the difference between average channel values
- Chromatic distance - euclidean distance between pixels normalized to the same value level
The resulting distance is computed as a weighted average of these two values, parameter inChromaAmount ( 0.0 - 1.0 ) being the weight of the chromatic distance, and 1 - inChromaAmount being the weight of the value distance.
Errors
Error type | Description |
---|---|
RuntimeError | Each pixel component must be nonnegative in ColorDistance |
See Also
- ColorDistanceImage – Compares each pixel with the specified color using chromatic and non-chromatic information.