demonstation of image collineation with interp2 bicubic interpolation

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

Contents

clear all;

load passpoints

load zso-gtrans.mat;

% load straight image (should be the result of inverse transformation)
imref = im2double(rgb2gray(imread('img1.jpg')));

show input image with the passpoints

figure(1); clf;
imshow(imref);
axis on;
hold on;
%      X             Y component of ptAi correspondence
plot(ptA3(1,:),ptA3(2,:),'+b','MarkerSize',10,'LineWidth',1);

load input collineated image

im1 = im2double(rgb2gray(imread('img8.jpg')));

show input image with the passpoints

figure(2); clf;
imshow(im1);
axis on;
hold on;
%      X             Y component of ptAi correspondence
plot(ptB3(1,:),ptB3(2,:),'+b','MarkerSize',10,'LineWidth',1);

calculate A matrix for transformation

note that A is transf. from collineated (img8) into straight (img1).

A = amat(ptB3,ptA3);

collineate using bicubic interp.

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

[imo T1] = imcollinf(proinv(A),im1,2);
1: min= 1.837683e+002 max= 8.851274e+002 
2: min= -4.701853e+001 max= 6.715024e+002 
size 644,804

compute also the passponits

this can be done more efficiently but who cares...

[imx T1] = imcollinf(A,im1,2);

% get passpoints from T1 transf. matrix
ptA=ptB3+2; % padding also
eval;
1: min= -8.025870e+003 max= 1.177024e+003 
2: min= -8.808061e+002 max= 7.012612e+002 
size 644,804

show output image with the passpoints

figure(3); clf;
imshow(imo);
axis on;
hold on;
plot(ptB(1,:),ptB(2,:),'+r','MarkerSize',10,'LineWidth',1);