xcorr2 {gsignal}R Documentation

2-D cross-correlation

Description

Compute the 2D cross-correlation of matrices a and b.

Usage

xcorr2(a, b = a, scale = c("none", "biased", "unbiased", "coeff"))

Arguments

a

Input matrix, coerced to numeric. Must not be missing.

b

Input matrix, coerced to numeric. Default: a.

scale

Character string. Specifies the type of scaling applied to the correlation matrix. matched to one of:

"none"

no scaling

"biased"

Scales the raw cross-correlation by the maximum number of elements of a and b involved in the generation of any element of the output matrix.

"unbiased"

Scales the raw correlation by dividing each element in the cross-correlation matrix by the number of products a and b used to generate that element.

"coeff"

Scales the normalized cross-correlation on the range of [0 1] so that a value of 1 corresponds to a correlation coefficient of 1.

Details

If b is not specified, computes autocorrelation of a, i.e., same as xcorr2 (a, a).

Value

2-D cross-correlation or autocorrelation matrix, returned as a matrix

Author(s)

Dave Cogdell, cogdelld@asme.org,
Paul Kienzle, pkienzle@users.sf.net,
Carne Draug, carandraug+dev@gmail.com.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.

See Also

conv2, xcorr.

Examples

m1 <- matrix(c(17, 24,  1,  8, 15,
               23,  5,  7, 14, 16,
                4,  6, 13, 20, 22,
               10, 12, 19, 21,  3,
               11, 18, 25,  2,  9), 5, 5, byrow = TRUE)
m2 <- matrix(c(8, 1, 6,
               3, 5, 7,
               4, 9, 2), 3, 3, byrow = TRUE)
R <- xcorr2(m1, m2)


[Package gsignal version 0.3-5 Index]