You are here: Start » AVL.NET » AVL.ColorDistanceImage(AvlNet.Image, AvlNet.Region, AvlNet.Pixel, float, AvlNet.Image)

AVL.ColorDistanceImage(AvlNet.Image, AvlNet.Region, AvlNet.Pixel, float, AvlNet.Image)

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

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax


public static void ColorDistanceImage(
	AvlNet.Image inImage,
	AvlNet.Region inRoi,
	AvlNet.Pixel inRgbColor,
	float inChromaAmount,
	out AvlNet.Image outValueImage
)

Parameters

inImage
Type: AvlNet.Image
Unsigned color image used in comparison
inRoi
Type: AvlNet.Region
Range of pixels to be processed, or null.
inRgbColor
Type: AvlNet.Pixel
Color to compare the image to
inChromaAmount
Type: System.Single
Proportion of chromatic information in distance computation
outValueImage
Type: AvlNet.Image
Unsigned 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.

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.

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

Error type Description
RuntimeError Each pixel component of inRgbColor must be nonnegative in ColorDistanceImage

See also