2-D correlation coefficient
R = corr2(A,B)
example
R = corr2(A,B) returns the 2-D correlation coefficient R between arrays A and B.
R
A
B
collapse all
Compute the correlation coefficient between an image and the same image processed with a median filter.
I = imread('pout.tif'); J = medfilt2(I); R = corr2(I,J)
R = 0.9959
First input array, specified as a numeric or logical array.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical
single
double
int8
int16
int32
int64
uint8
uint16
uint32
uint64
logical
Second input array, specified as a numeric or logical array. B has the same size as the first input array, A.
Correlation coefficient, returned as a numeric scalar.
Data Types: double
corr2 computes the correlation coefficient using
corr2
r=∑m∑n(Amn−A¯)(Bmn−B¯)(∑m∑n(Amn−A¯)2)(∑m∑n(Bmn−B¯)2)
where A¯ = mean2(A), and B¯ = mean2(B).
=
mean2(A)
mean2(B)
This function fully supports GPU arrays. For more information, see Image Processing on a GPU.
corrcoef | std2
corrcoef
std2
You have a modified version of this example. Do you want to open this example with your edits?