MATLAB: Calculate correlation between the blocks

correlation between the blocks

i've divided the image into 16×16 blocks i.e total of 256 blocks.
now i want to calculate the correlation between the blocks…
can anybody help me…

Best Answer

Blocks=mat2tiles(grayImage,[16,16]);
data=cellfun(@(x)x(:)-mean(x(:)), Blocks, 'uni',0 );
data=[data{:}];
Correlations = data.'*data;
Here, Correlations(i,j) is the correlation (my definition) of the i-th and j-th block. I'm not sure if this suits your definition (see my comments above).