You are here: Start » AVL.NET » Function Reference » Image » Image Metrics » AVL.ColorDistance

AVL.ColorDistance

Compares two pixels using chromatic and non-chromatic information. Assumes RGB color space.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void ColorDistance
(
	AvlNet.Pixel inPixelA,
	AvlNet.Pixel inPixelB,
	float inChromaAmount,
	out float outDistance
)

Parameters

Name Type Range Default Description
inPixelAAvlNet.Pixel
inPixelBAvlNet.Pixel
inChromaAmountfloat<0.0f, 1.0f>0.7fProportion of chromatic information in distance computation. Default value: 0.7f.
outDistancefloat

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

List of possible exceptions:

Error type Description
RuntimeError Each pixel component must be nonnegative in ColorDistance.

See also