demonstation of image correction: skyscraper

Petr Sladek (sladep1) & Milan Kratochvil (kratom4) at CTU Prague

Contents

clear all;


% load image
imref = im2double(imread('skyscraper.jpg'));

show input image with the passpoints:

figure(1); clf;
imshow(imref);
axis on;
hold on;
%from passpoints:
ptAx= [1 480 1 480];
ptAy= [1 1 640 640];
ptA(1,:)=ptAx;
ptA(2,:)=ptAy;
%to passpoints:
ptBx= [-89 460 232 457];
ptBy= [10 -87 578 652];
ptB(1,:)=ptBx;
ptB(2,:)=ptBy;
plot(ptA(1,:),ptA(2,:),'+y','MarkerSize',10,'LineWidth',3);

im1=imref;

calculate A matrix for transformation

A = amat(ptA,ptB);

collineate using bicubic interp.

see also imcollinf() and associated functions, using backward transf. for interpolation.

[imo T] = imcollinfrgb(proinv(A),im1,2);
1: min= -2.832123e+003 max= 5.252948e+002 
2: min= 3.664643e+000 max= 2.271927e+003 
size 644,484

show output image with the passpoints

figure(3); clf;
imshow(imo);
axis on;
hold on;