vision.Crosscorrelator System object

Package: vision

2-D cross-correlation of two input matrices


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


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.



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 output

Set this property to true to normalize the output. If you set this property to true, the object divides the output by (I1pI1p)×(I2I2), where I1p is the portion of the input matrix, I1that aligns with the input matrix, I2. This property must be set to false for fixed-point inputs. The default is false.

 Fixed-Point Properties


cloneCreate 2-D cross correlator object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
release Allow property value and input characteristics changes
stepCompute 2-D correlation of input matrices


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);


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.

Introduced in R2012a

Was this topic helpful?