DocumentationHelp Center
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
A modified version of this example exists on your system. Do you want to open this version instead?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office