%stereo : compute stereo correlation
% l and r are image data, of equal size.
% N is the size of blocks to use in the convolution
% skip is the 1/resolution in horizontal and vertical direction.

function [out,conf]=stereo(l,r,N,skip)

[sizey,sizex]=size(l);

out=zeros(size(l));
conf=zeros(size(l));

rshifted=filter2(shifter(.5,4),r);

   for y=1:skip:(sizey-N-1)
       y
       for x=1:skip:(sizex-N-1)
        [out(y,x),conf(y,x)]=dopoint(l,r,rshifted,x,y,N);  
 
    end
    
    
   subplot(2,2,1);
   imagesc(l);
   subplot(2,2,2);
   imagesc(r);
   subplot(2,2,3);
   imagesc(out);
   subplot(2,2,4);
   imagesc(conf.^0.08);
    
end
