MATLAB: Image processing Sum Square Diffrence

image analysisimage processingssd

I'm having trouble getting my code to work in Matlab. I try to write code witch use the below formulawzor.png
I have to find in image (I) template (T) with other dimensions
My actual code
clear;clc;
I=imread('00.bmp');
I=im2double(I);
[W H]=size(I);
T=imread('wzorp.png');
T=rgb2gray(T);
T=im2double(T);
[w h]=size(T);
for x=1:W-w+1
for y=1:H-h+1
for x1=1:w-1
for y1=1:h-1
R(x,y)=(T(x1,y1)-I(x+x1,y+y1))^2
end
end
end
end

Best Answer

What exactly is the problem you're having? If the idea is just o find a template in the image you can probably find better results using image correlation, as example the normxcorr2 function.
Related Question