Petr Sladek (sladep1) & Milan Kratochvil (kratom4) at CTU Prague
clear all;
load zso-gtrans.mat; % load straight image (should be the result of inverse transformation) imref = im2double(rgb2gray(imread('img1.jpg')));
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);
im1 = im2double(rgb2gray(imread('img8.jpg')));
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);
note that A is transf. from collineated (img8) into straight (img1).
A = amat(ptB3,ptA3);
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
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
figure(3); clf; imshow(imo); axis on; hold on; plot(ptB(1,:),ptB(2,:),'+r','MarkerSize',10,'LineWidth',1);