Back to Aurora Vision Library website

You are here: Start » Function Reference » Image » Image Metrics » ImageCorrelation

ImageCorrelation


Header: AVL.h
Namespace: avl
Module: FoundationPro

Computes the correlation of pattern and image.

Syntax

C++
C#
 
void avl::ImageCorrelation
(
	const avl::Image& inImage,
	const avl::Image& inPatternImage,
	atl::Optional<const avl::Region&> inRoi,
	avl::CorrelationMeasure::Type inCorrelationMeasure,
	float& outCorrelation
)

Parameters

Name Type Default Description
Input value inImage const Image& Input image
Input value inPatternImage const Image& Pattern to be compared with input image
Input value inRoi Optional<const Region&> NIL Range of pixels to be processed
Input value inCorrelationMeasure CorrelationMeasure::Type Measure of correlation
Output value outCorrelation float& Value of correlation of pattern and image

Description

The operation computes the correlation between two images using the selected measure.

  • If the inCorrelationMeasure is set to CrossCorrelation then the resulting outCorrelation is the sum of products of corresponding pixel values of the images.
  • If the inCorrelationMeasure is set to NormalizedCrossCorrelation then the resulting outCorrelation is the normalized sum of products of corresponding pixel values of the images. This value always lies in closed interval \([-1,1]\), with \(1\) indicating the images ideal correlation.

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

Normalized cross correlation between the sample images equals 0.919.

Normalized cross correlation between the sample images equals 0.798.

Errors

List of possible exceptions:

Error type Description
DomainError Not supported correlation measure in ImageCorrelation.

See Also

  • ImageCorrelationImage – Computes an image of correlation between a pattern and the input image at each possible location.
  • LocateMultipleObjects_NCC – Finds all occurrences of a predefined template on an image by analysing the normalized correlation between pixel values.