script5

clear
close all
load filelist
load script2
load script5
n=6;
filename = char(files(n));
rgb = imread(filename);
imshow(rgb);

hold on
plot(pt6(:,1),pt6(:,2),'yx');
hold off

%pt6 = ginput(1)
Warning: Image is too big to fit on screen; displaying at 50% 
n=7;
filename = char(files(n));
rgb2 = imread(filename);
imshow(rgb2);

%pt7 = ginput(1)
hold on
plot(pt7(:,1),pt7(:,2),'yx');
hold off
n=8;
filename = char(files(n));
rgb3 = imread(filename);
imshow(rgb3);

%pt8 = ginput(1)
%save script5 pt6 pt7 pt8

hold on
plot(pt8(:,1),pt8(:,2),'yx');
hold off
g1 = rgb2gray(im2double(rgb));
g2 = rgb2gray(im2double(rgb2));
g3 = rgb2gray(im2double(rgb3));

d1 = g2 - g1;
imshow((d1+1)/2);
d2 = g3 - g2;
imshow((d2+1)/2);
d3 = g3 - g1;
imshow((d3+1)/2);
montage(files([6 8]));
[xpts ypts] = tformfwd(tf2,[pt6(1,1); pt7(1,1)],[pt6(1,2); pt7(1,2)]);
xp = xpts/scale;
yp = ypts/scale;

dx = diff(xp)
dy = diff(yp)


% four tiles @ 9 inches/tile = 3 ft.

tile_size = -dy*12/4;
fprintf('tile size %g inches\n',tile_size);
dx =

   -0.0596


dy =

   -2.9096

tile size 8.72888 inches