This example illustrates simple method of panoramic picture creation using sum of absolute differences. It assumes no zooming, rotational variation in 2 images.
1. Reading Images for processing
1. Reading Images for processing
S1 = imread('p4-in1.jpg');
S2 = imread('p4-in2.jpg');
2. Showing Images
1st Image
S2 = imread('p4-in2.jpg');
2. Showing Images
1st Image
ShowColorImage(S1,'0');
2nd Image
ShowColorImage(S2,'0');
S1r = S1(:,:,1);
S2r = S2(:,:,1);
4. Sum of Absolute Differences (SAD) of a selected block is from each image are computed.
sz = 50;
roi2 = S2r(1:sz,1:sz);
[x,y]=size(S2r);
for cnt = y:-1:x/2
roi1 = S1r(1:sz,cnt-sz+1:cnt);
data(y-cnt+1)=sum(sum(abs(double(roi2)-double(roi1))));
end
5. Finding minimum error among all comparison
2nd Image
ShowColorImage(S2,'0');
S1r = S1(:,:,1);
S2r = S2(:,:,1);
4. Sum of Absolute Differences (SAD) of a selected block is from each image are computed.
sz = 50;
roi2 = S2r(1:sz,1:sz);
[x,y]=size(S2r);
for cnt = y:-1:x/2
roi1 = S1r(1:sz,cnt-sz+1:cnt);
data(y-cnt+1)=sum(sum(abs(double(roi2)-double(roi1))));
end
5. Finding minimum error among all comparison