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

AVL.ImageDifference(AvlNet.Image, AvlNet.Image, AvlNet.Region, AvlNet.DistanceMeasure, float)

Measures dissimilarity between two images.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax


public static void ImageDifference(
	AvlNet.Image inImage,
	AvlNet.Image inPatternImage,
	AvlNet.Region inRoi,
	AvlNet.DistanceMeasure inDistanceMeasure,
	out float outDifference
)

Parameters

inImage
Type: AvlNet.Image
Input image
inPatternImage
Type: AvlNet.Image
Pattern to be compared with input image
inRoi
Type: AvlNet.Region
Range of pixels to be processed, or null.
inDistanceMeasure
Type: AvlNet.DistanceMeasure
Measure of distance
outDifference
Type: System.Single
Value of difference between pattern and image

Description

The operation computes the approximate difference between two images using the selected distance measure.

  • If the inDistanceMeasure is set to MeanError then the resulting outDifference is the average difference between corresponding pixel values of the images.
  • If the inDistanceMeasure is set to MeanSquaredError then the resulting outDifference is the average squared difference between corresponding pixel values of the images.

The operation requires that the images being processed have equal format and dimensions, otherwise an error with appropriate description occurs. To obtain an image of desired dimensions one can use ResizeImage or CropImage filter. To alter the format of an image one can use filters contained in ImageConversions category.

Examples

Mean error between the sample images equals 16.034.

Mean squared error between the sample images equals 2754.164.

Hardware Acceleration

This operation is optimized for SSE2 technology for pixels of types: UINT8 (for inDistanceMeasure = MeanError).

This operation supports automatic parallelization for multicore and multiprocessor systems.

Hardware acceleration settings may be manipulated with Settings class.

Errors

Error type Description
DomainError Not supported distance measure in ImageDifference.

See also