# ImageCorrelate

ImageCorrelate[image,ker]

gives the correlation of image with kernel ker.

ImageCorrelate[image,ker,f]

computes a generalized correlation in which the function f is used in place of Dot.

# Details and Options

• ImageCorrelate performs the correlation operation on an image. It is a spatial filtering operation commonly used to find matches between images.
• The correlation kernel ker is given as a two-dimensional numerical matrix, a one-channel image or a multichannel image with the same number of channels as image.
• ImageCorrelate works with 2D and 3D images, operating separately on each channel.
• ImageCorrelate[image,ker] by default gives an image of the same dimensions as image.
• With a setting , ImageCorrelate[image,ker] normally gives an image smaller than image.
• ImageCorrelate gives an image of a real type.
• In ImageCorrelate[image,ker,f], typical settings for the correlation operator f include:
•  Dot standard correlation ManhattanDistance Manhattan or "city block" distance EuclideanDistance Euclidean distance SquaredEuclideanDistance squared Euclidean distance NormalizedSquaredEuclideanDistance normalized squared Euclidean distance CosineDistance angular cosine distance CorrelationDistance correlation coefficient distance
• ImageCorrelate takes a PerformanceGoal option to specify what aspect of performance to try to optimize. The default setting is PerformanceGoal"Speed".

# Examples

open allclose all

## Basic Examples(2)

Blur an image by correlating it with a Gaussian matrix:

Find occurrences of a template in an image:

## Scope(5)

### Data(3)

Correlate a binary image with a disk-shaped kernel:

Correlate a grayscale image:

Correlate a 3D image:

### Parameters(2)

Use a Laplacian kernel:

Use a template:

The default correlation operator f is Dot:

Use a different correlation operator:

## Generalizations & Extensions(2)

Nonrectangular templates are better matched when used with a mask:

The correlation obtained using a mask is more robust to background changes:

Result of the template matching without using the mask:

Match rotated occurrences of a template by matching the template rotated using a range of angles:

Visualize the best matches:

Result of the template matching without taking into account multiple orientations:

## Options(3)

By default, a "Fixed" padding is used:

normally returns an image smaller than the input image:

## Applications(2)

Isolate regions of interest in an image:

A basic face detector that uses the normalized correlation with an image of a pair of eyes:

## Properties & Relations(1)

ImageCorrelate gives an image of a real type:

Wolfram Research (2008), ImageCorrelate, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageCorrelate.html (updated 2012).

#### Text

Wolfram Research (2008), ImageCorrelate, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageCorrelate.html (updated 2012).

#### CMS

Wolfram Language. 2008. "ImageCorrelate." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/ImageCorrelate.html.

#### APA

Wolfram Language. (2008). ImageCorrelate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageCorrelate.html

#### BibTeX

@misc{reference.wolfram_2024_imagecorrelate, author="Wolfram Research", title="{ImageCorrelate}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/ImageCorrelate.html}", note=[Accessed: 13-July-2024 ]}

#### BibLaTeX

@online{reference.wolfram_2024_imagecorrelate, organization={Wolfram Research}, title={ImageCorrelate}, year={2012}, url={https://reference.wolfram.com/language/ref/ImageCorrelate.html}, note=[Accessed: 13-July-2024 ]}