Correlate2D
- Updated2023-02-21
- 3 minute(s) read
Advanced Analysis Library Only
AnalysisLibErrType Correlate2D (void *arrayX, ssize_t m1, ssize_t n1, void *arrayY, ssize_t m2, ssize_t n2, int algorithm, void *outputArray);
Purpose
Finds the 2D correlation of the input arrays.Correlate2D computes two-dimensional cross correlation as follows:
for i = -(M1–1), ..., -1, 0, 1, ..., (M2–1) and j = -(N1–1), ..., -1, 0, 1, ..., (N2–1)
where M1 is the number of rows of matrix arrayX,
N1 is the number of columns of matrix arrayX,
M2 is the number of rows of matrix arrayY,
N2 is the number of columns of matrix arrayY,
the indexed elements outside the ranges of arrayX and arrayY are equal to zero, as shown in the following relationships:
x(m,n) = 0, m < 0 or m ≥ M1 or n < 0 or n ≥ N1
and
y(m,n) = 0, m < 0 or m ≥ M2 or n < 0 or n ≥ N2.
The elements of the output matrix outputArray, represented as Rxy in the following equation, are related to the elements in h as follows:
Rxy(i,j) = h(i–(M1–1), j–(N1–1)) for i = 0, 1, 2, ..., M1+M2–2 and j = 0, 1, 2, ..., N1+N2–2.
![]() |
Note This function temporarily allocates memory for use as a work area. If Correlate2D cannot allocate memory, the function returns an error code. |
Parameters
Input | |||||||||||
Name | Type | Description | |||||||||
arrayX | void * | First input array. | |||||||||
rowsInX | ssize_t | Number of rows in arrayX. | |||||||||
columnsInX | ssize_t | Number of columns in arrayX. | |||||||||
arrayY | void * | Second input array. | |||||||||
rowsInY | ssize_t | Number of rows in arrayY. | |||||||||
columnsInY | ssize_t | Number of columns in arrayY. | |||||||||
algorithm | int | Specifies the correlation method to use. algorithm must be one of the following values. Note that slight numerical differences can exist between the two methods.
|
|||||||||
Output | |||||||||||
Name | Type | Description | |||||||||
outputArray | void | The correlation of arrayX and arrayY. The size of outputArray is (m1 + m2 – 1)-by-(n1 + n2 – 1). |
Return Value
Name | Type | Description |
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants. |
Additional Information
Library: Advanced Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 2012 and later