% designate correspondence manually
close all;

%n = 958, 966, 970
n = 958;
fnL = sprintf('%.4d_L.JPG',n);
fnR = sprintf('%.4d_R.JPG',n);

IL = imread(fnL);
IR = imread(fnR);

IL = IL(801:2000, 601:2000);
IR = IR(801:2000, 601:2200);

fn = sprintf('DSCN%.4d.JPG',n);
info = imfinfo(fn);

[h w ~] = size(IL);

IComposite = [IL IR];

figure;
imshow(IComposite);

ps = ginput(2);

pL = [ps(1,2) ps(1,1)];
pR = [ps(2,2) ps(2,1)-w];

depth = twoPointsDepth(info, pL, pR);
depth = depth/1000;
Itext = insertText(IL, ps(1,:), depth, 'FontSize', 24);
figure
imshow(Itext);



