function A = lane(inp,blksize,skip,type)
% this function finds the separation between lanes, based upon max-min 
% filtering.
% parameters:
%
% inp :     input image
%
% blksize : The size of the blocks in which the image is divided and the lanes
%           (boundaries) are found. It defines the minimum lengths of the lane 
%           (boundaries).
%
% skip:     This determines how closely the ends of two lane
%               (boundaries) must be to be considered matching.
% type = 1  lane boundaries are found.
% type = not 1 : middle of lanes are found

perc=0.75; % autocorrelation percentage for filterwidth
fact1=0.02;
fact2=0.0;
filtsize=(corper(inp',perc)-1)/2

R = kproc3(inp,blksize,filtsize,fact1,fact2,type);

[nr,nc] = size(R);

for i = 1:nc;
    if (R(1,i) == 1)
	A = [A,R(:,i)];
    else
	s = find_match(R(:,i),A,blksize,skip);
	if (s == -1)
	    A = new_lane(R(:,i),A,blksize);
	else
	    A = expank(R(:,i),A,s,blksize);
	end
    end
end
toc
[rg,cg]=size(inp);
res=lane2im(A,rg,cg);
comboc(inp,res);
axis normal;
text(0,-50,['row: ',num2str(blksize),' column: ',num2str(filtsize),' fact1: ',num2str(fact1),' fact2: ',num2str(fact2),' skip: ',num2str(skip)]);
%colormap(cool);
toc




