%COMP 256 Assignment 2
%Adrian Ilie

function showlines(pointfile,imfile1,imfile2,f)
%displays the epipolar lines

im1=imread(imfile1);
im2=imread(imfile2);

%load point data
[p1,p2,num]=loadpointdata(pointfile);

minc=[1 1];
maxc=size(im1(:,:,1));

[e2,e1]=epipoles(f);

i1=figure;
imshow(im1);
iptsetpref('ImshowBorder', 'tight');
hold on;
for i=1:num
  point=p1(:,i);
  line=cross(e1,point);
  drawline(line,minc,maxc);
  plot(point(1),point(2),'r+');
end

i2=figure;
imshow(im2);
iptsetpref('ImshowBorder', 'tight');
hold on;
for i=1:num
  point=p2(:,i);
  line=cross(e2,point);
  drawline(line,minc,maxc);
  plot(point(1),point(2),'r+');
end
