correlation
2 views (last 30 days)
Show older comments
% check which one is target and which one is template using their size
if size(image1)>size(image2)
Target=image1;
Template=image2;
else
Target=image2;
Template=image1;
end
% find both images sizes
[r1,c1]=size(Target);
[r2,c2]=size(Template);
% mean of the template
image22=Template-mean(mean(Template));
%corrolate both images
M=[]; %FROM HERE
for i=1:(r1-r2+1)
for j=1:(c1-c2+1)
Nimage=Target(i:i+r2-1,j:j+c2-1);
Nimage=Nimage-mean(mean(Nimage)); % mean of image part under mask
corr=sum(sum(Nimage.*image22));
warning off
M(i,j)=corr/sqrt(sum(sum(Nimage.^2)));
end
end %TO HERE
what is the meaning of code marked "FROM HERE" to "TO HERE" ?
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!