Correlation formula Matlab
-
02-03-2021 - |
Question
I am working towards my degree thesis in image processing, and I'm using the Matlab Image Processing toolbox. I'm calculate the correlation of an image with the co-occurrence matrix using the Matlab function graycoprops
. My problem is that I can't understand the meaning of the formula that defines the correlation property (see the previous link):
In particular, what are \mu_i
, \mu_j
, \sigma_i
, \sigma_j
,if i
and j
are graylevels of the image?
Solution
I have had the same question, and the paper "Statistical Texture Measures Computed from Gray Level Coocurrence Matrices" by Fritz Albregtsen (2008) was of great help, as it gives a precise definition of all the formulas.
OTHER TIPS
I would imagine it's the mean and standard deviation in the x
and y
directions. i
probably corresponds to x
, and j
to y
. That's just a guess, though.
EDIT: This is supported by looking at the function code. I highly recommend you check it out yourself (simply type edit graycoprops
), but here's the relevant part:
function Corr = calculateCorrelation(glcm,r,c)
...
% Calculate the mean and standard deviation of a pixel value in the row
% direction direction. e.g., for glcm = [0 0;1 0] mr is 2 and Sr is 0.
mr = meanIndex(r,glcm);
Sr = stdIndex(r,glcm,mr);
% mean and standard deviation of pixel value in the column direction, e.g.,
% for glcm = [0 0;1 0] mc is 1 and Sc is 0.
mc = meanIndex(c,glcm);
Sc = stdIndex(c,glcm,mc);