Accelerating the pace of engineering and science

# vision.Crosscorrelator System object

Package: vision

2-D cross-correlation of two input matrices

## Description

The Crosscorrelator object computes 2-D cross-correlation of two input matrices.

## Construction

H = vision.Crosscorrelator returns a System object, H, that performs two-dimensional cross-correlation between two inputs.

H = vision.Crosscorrelator(Name,Value) returns a 2-D cross correlation System object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).

Code Generation Support
Supports MATLAB® Function block: Yes
System Objects in MATLAB Code Generation.
Code Generation Support, Usage Notes, and Limitations.

## Properties

 OutputSize Specify dimensions of output This property controls the size of the output scalar, vector, or matrix produced as a result of the cross-correlation between the two inputs. This property can be set to one of Full, Same as first input, Valid. If this property is set to Full, the output is the full two-dimensional cross-correlation with dimensions (Ma+Mb-1, Na+Nb-1). if this property is set to same as first input, the output is the central part of the cross-correlation with the same dimensions as the first input. if this property is set to valid, the output is only those parts of the cross-correlation that are computed without the zero-padded edges of any input. this output has dimensions (Ma-Mb+1, Na-Nb+1). (Ma, Na) is the size of the first input matrix and (Mb, Nb) is the size of the second input matrix. The default is Full. Normalize Normalize output Set this property to true to normalize the output. If you set this property to true, the object divides the output by $\sqrt{\sum \left({I}_{1p}•{I}_{1p}\right)×\sum \left({I}_{2}•{I}_{2}\right)}$, where ${I}_{1p}$ is the portion of the input matrix, ${I}_{1}$that aligns with the input matrix, ${I}_{2}$. This property must be set to false for fixed-point inputs. The default is false.

## Methods

 clone Create 2-D cross correlator object with same property values getNumInputs Number of expected inputs to step method getNumOutputs Number of outputs from step method isLocked Locked status for input attributes and nontunable properties release Allow property value and input characteristics changes step Compute 2-D correlation of input matrices

## Examples

Compute the 2-D correlation of two matrices.

``` hcorr2d = vision.Crosscorrelator;
x1 = [1 2;2 1];
x2 = [1 -1;-1 1];
y = step(hcorr2d,x1,x2);
```

## Algorithms

This object implements the algorithm, inputs, and outputs described on the 2-D Correlation block reference page. The object properties correspond to the block parameters.