
function [lkdx,lkdy] = plotlk(I1,I2,xl,yt,xr,yb,wsizes)

   function img = downsampleImage(Image,N) 
       % downsamples Image by 2 in each direction
       img = downsample(downsample(Image,N)',N)';
   end;

   hold off;
   figure(1);
   imshow(I1);
   figure(2);
   imshow(I2);
   figure(3);
   imshow(I1([yt:yb],[xl:xr]));
   figure(4);
   imshow(I2([yt:yb],[xl:xr]));
   
   figure(5);
   for wsize_i=1:length(wsizes),
     [lkdx lkdy] = lucaskanade(I1,I2,xl,yt,xr,yb,wsizes(wsize_i));
     lkdx = downsampleImage(lkdx,5);
     lkdy = downsampleImage(lkdy,5);
     subplot(2, length(wsizes)/2,mod(wsize_i-1,2)+2*floor((wsize_i-1)/2)+1);
     quiver(lkdx,lkdy);
     title(sprintf('wsize %d',wsizes(wsize_i)));

   end;
   
end