DEMO - differencies in passpoints, collineation.

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

Contents

note: bohuzel publish() neumi zpracovavat i obrazy ve volanych skriptech takze se to musi delat takhle blbe:-(((

clear all;
load zso-gtrans.mat;

load straight image (should be the result of inverse transformation)

reference image

imref = im2double(rgb2gray(imread('img1.jpg')));
figure(1); clf;
imshow(imref); axis on; hold on;
plot(ptA1(1,:),ptA1(2,:),'+g','MarkerSize',10,'LineWidth',2);

very close passpoints results in an inaccuracy

Experience: do not put passpoints very close, spread them over the whole image

%see imc.m (imc.html) for details of function.

% load input collineated image
im1 = im2double(rgb2gray(imread('img8.jpg')));
figure(2); clf; imshow(im1); axis on; hold on;
plot(ptB1(1,:),ptB1(2,:),'+y','MarkerSize',10,'LineWidth',1);
A = amat(ptB1,ptA1);
[imo T1] = imcollinf(proinv(A),im1,2);
[imx T1] = imcollinf(A,im1,2);
ptA=ptB1+2; % padding also
eval;
% collineated image:
figure(3); clf; imshow(imo); axis on; hold on;
plot(ptB(1,:),ptB(2,:),'+r','MarkerSize',10,'LineWidth',1);
1: min= -5.820079e+007 max= 3.094210e+007 
2: min= -1.447412e+007 max= 8.956591e+006 
size 644,8041: min= -1.594221e+008 max= 1.275250e+008 
2: min= -1.367571e+008 max= 6.954706e+007 
size 644,804

load reference image

figure(4); clf;
imref = im2double(rgb2gray(imread('img1.jpg')));
imshow(imref); axis on; hold on;
plot(ptA2(1,:),ptA2(2,:),'+g','MarkerSize',10,'LineWidth',2);

passpoints in one straight line results in the SVD malfunction (high numeric

error)

Experience: do not put passpoints into one line (avoid any linearities)

%see imc.m (imc.html) for details of function.
clear imo;
% load input collineated image
im1 = im2double(rgb2gray(imread('img8.jpg')));
figure(5); clf; imshow(im1); axis on; hold on;
plot(ptB2(1,:),ptB2(2,:),'+y','MarkerSize',10,'LineWidth',1);
A = amat(ptB2,ptA2);
[imo T1] = imcollinf(proinv(A),im1,2);
[imx T1] = imcollinf(A,im1,2);
ptA=ptB2+2; % padding also
eval;
% collineated image:
figure(6); clf; imshow(imo); axis on; hold on;
plot(ptB(1,:),ptB(2,:),'+r','MarkerSize',10,'LineWidth',1);
1: min= -5.524568e+005 max= 1.254189e+006 
2: min= -8.389903e+006 max= 9.926592e+005 
size 644,8041: min= -3.452330e+007 max= 1.025511e+008 
2: min= -1.720050e+007 max= 5.522868e+006 
size 644,804

load reference image

figure(7); clf;
imref = im2double(rgb2gray(imread('img1.jpg')));
imshow(imref); axis on; hold on;
plot(ptA3(1,:),ptA3(2,:),'+g','MarkerSize',10,'LineWidth',2);

more passpoints >4 spread over whole image is good practice

%imc3();
%see imc.m (imc.html) for details of function.
clear imo;
% load input collineated image
im1 = im2double(rgb2gray(imread('img8.jpg')));
figure(8); clf; imshow(im1); axis on; hold on;
plot(ptB3(1,:),ptB3(2,:),'+y','MarkerSize',10,'LineWidth',1);
A = amat(ptB3,ptA3);
[imo T1] = imcollinf(proinv(A),im1,2);
[imx T1] = imcollinf(A,im1,2);
ptA=ptB3+2; % padding also
eval;
% collineated image:
figure(9); clf; imshow(imo); axis on; hold on;
plot(ptB(1,:),ptB(2,:),'+r','MarkerSize',10,'LineWidth',1);
1: min= 1.837683e+002 max= 8.851274e+002 
2: min= -4.701853e+001 max= 6.715024e+002 
size 644,8041: min= -8.025870e+003 max= 1.177024e+003 
2: min= -8.808061e+002 max= 7.012612e+002 
size 644,804