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

AVL.ColorDistanceImage

Compares each pixel with the specified color using chromatic and non-chromatic information.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void ColorDistanceImage
(
	AvlNet.Image inImage,
	AvlNet.Pixel inRgbColor,
	float inChromaAmount,
	AvlNet.Image outValueImage
)

Parameters

Name Type Range Default Description
inImageAvlNet.ImageUnsigned color image used in comparison.
inRgbColorAvlNet.PixelColor to compare the image to.
inChromaAmountfloat<0.0f, 1.0f>0.7fProportion of chromatic information in distance computation. Default value: 0.7f.
outValueImageAvlNet.ImageUnsigned image of distances.

Description

The operation computes the distance between each pixel of inImage and a specified color, presenting result as a monochromatic image. Input image should be in RGB color space.

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.

Examples

ColorDistanceImage run with inRgbColor = , inChromaAmount = 0.8

Hardware Acceleration

This operation supports automatic parallelization for multicore and multiprocessor systems.

Hardware acceleration settings may be manipulated with Settings class.

Errors

List of possible exceptions:

Error type Description
DomainError Invalid image Depth in ColorDistanceImage.
DomainError Not supported inImage pixel format in ColorDistanceImage. Supported formats: 1xUInt8, 2xUInt8, 3xUInt8, 4xUInt8.
RuntimeError Each pixel component of inRgbColor must be nonnegative in ColorDistanceImage.

Function Overrides

See also