Start » Filter Reference » Image » Image Metrics » ImageDifference

ImageDifference


Module: FoundationBasic

Measures dissimilarity between two images.

Name Type Description
Input value
inImage Image Input image
Input value
inPatternImage Image Pattern to be compared with input image
Input value
inRoi Region* Range of pixels to be processed
Input value
inDistanceMeasure DistanceMeasure Measure of distance
Output value
outDifference Real 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 Image Conversions 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 is optimized for AVX2 technology for pixels of types: UINT8, INT16, UINT16, REAL.

This operation is optimized for NEON technology for pixels of types: UINT8, UINT16 (for inDistanceMeasure = MeanError), INT16 (for inDistanceMeasure = MeanError), REAL.

This operation supports automatic parallelization for multicore and multiprocessor systems.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Not supported distance measure in ImageDifference.

Complexity Level

This filter is available on Advanced Complexity Level.

See Also

  • ImageDifferenceImage – Computes an image of differences between a moving pattern and the input image.
  • LocateMultipleObjects_SAD – Finds multiple occurrences of a predefined template on an image by analysing the Square Average Difference between pixel values.
  • DifferenceImage – Computes the non-negative distances between corresponding pixel values.