Panoramic Picture Creation

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
S1 = imread('p4-in1.jpg');
S2 = imread('p4-in2.jpg');


2. Showing Images
1st Image
ShowColorImage(S1,'0');



2nd Image

ShowColorImage(S2,'0');



3. Extract red layer of the image for processing using Sum of Absolute Differences (SAD)

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

plot(data);
[minval,ind] = min(data);
plot(ind,minval,'r*');



6. Combine the images at the minimum error region.

Sc = S1(1:$,1:y-sz-ind+1,:);
Sfinal = [Sc S2];

7. Final Result

ShowColorImage(Sfinal,'0');