Cross Correlation Map for stack of images
Show older comments
Hello guys,
I am wondering if someone here could help me with correlation map.
Basically I have some stacks of images and I would like to cross correlate them using the Pearson
Correlation coefficient formula below.

Ai and Bi are the intensity values for a particular pixel in the pattern, Abar and Bbar are the
mean values of the intensities and sigmaA and sigmaB are the standard deviations for the two CXD
patterns, A and B. The sum is evaluated over the 3D stack of images.
Anything would be nice. I have ran out of clues to implement this properly.
Basically in my script I have the following, sending to my pearson correlation function the stack of pixels:
for i=1:size(crop_cell,2)%Running over the cell stacks
for j=1:size(crop_cell,2)%Running over the cell stacks
for k=1:size(crop_cell{1},1)%Running over the rows
for L=1:size(crop_cell{1},2)%Running over the columns
corr_matrix{i,j}(k,L) = pearson_corr_scores_pix(crop_cell{i}(k,L,:),crop_cell{j}(k,L,:));
end
end
end
end
And the correlation function:
function [p] = pearson_corr_scores_pix(a,b)
mean_a = mean(a);
mean_b = mean(b);
fac_a = a - mean_a;
fac_b = b - mean_b;
std_a = std2(a);
std_b = std2(b);
score_a = fac_a/std_a;
score_b = fac_b/std_b;
p = (1/(length(a)-1))*sum(score_a.*score_b);
end
Attached is my result(first) and a reference result (second) I would like to reach.
Mine is somehow not taking into account the correlation with all the stack of pixels
in the image? I don't know.

Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Template Matching in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!