You are here: Start » AVL.NET » AVL.ColorDistance(AvlNet.Pixel, AvlNet.Pixel, float, float)

AVL.ColorDistance(AvlNet.Pixel, AvlNet.Pixel, float, float)

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax


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

Parameters

inPixelA
Type: AvlNet.Pixel
inPixelB
Type: AvlNet.Pixel
inChromaAmount
Type: System.Single
outDistance
Type: System.Single

Description

The operation computes the distance between two pixels.

Distance between pixels is computed using two measures:

  • Value distance - difference between pixel average values.
  • Chromatic distance - euclidean distance between pixel colors interpreted as points in N-dimensional space ( where N denotes the number of pixel channels ) rescaled to the (0.0 - 255.0) range.

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