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

AVL.ImageDifference

Measures dissimilarity between two images.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void ImageDifference
(
	AvlNet.Image inImage,
	AvlNet.Image inPatternImage,
	NullableRef<AvlNet.Region> inRoi,
	AvlNet.DistanceMeasure inDistanceMeasure,
	out float outDifference
)

Parameters

Name Type Range Default Description
inImageAvlNet.ImageInput image.
inPatternImageAvlNet.ImagePattern to be compared with input image.
inRoiAvlNet.NullableRef<AvlNet.Region>Range of pixels to be processed. Default value: atl::NIL.
inDistanceMeasureAvlNet.DistanceMeasureMeasure of distance.
outDifferencefloatValue 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 is optimized for SSE3 technology for pixels of types: UINT16 (for inDistanceMeasure = MeanError), UINT8 (for inDistanceMeasure = MeanSquaredError), REAL.

This operation is optimized for SSE4 technology for pixels of types: INT16, UINT16 (for inDistanceMeasure = MeanSquaredError).

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 Not supported distance measure in ImageDifference.

Function Overrides

See also