
function res=proces1(inp,blksize,filtsize,fact1,fact2,sinf)
% this function finds the separation between bands, based upon maximum 
% filtering.
% parameters:
% inp : input image
% res : result image inwhich the separation pixels are 1
% blksize : the bloksize in which the image is divided up and in which
% 	separation rows are found
% filtsize : filtersize of the smoothing (2* filtsize+1)
% fact : local maximum/minimum definition.
%
tic;
[rg,cg]=size(inp);
res(rg,cg)=0;
ib=1;
is=blksize;
while ib<rg	
ie=min(ib+is-1,rg)
g=inp(ib:ie,:)';	% tranpose matrix
toc
h=maxmat(g,filtsize);	% maximaum filter over the columns
toc
p=h-g;		% difference image between maxfiltered and original
%imshow(p);
toc
his=hough(p,ib,sinf);
toc
totmx=max(his);
s=maxpos(his',fact1);	% find wich rows are local maxima
toc
for io=ib:ie;
	pos=sinf*io;
	for jo=1:cg;
		if (pos>=1) & (pos<+cg) & (s(jo) == 1) & (his(jo) > fact2*totmx)
		res(io,pos)=1;
		end;
		pos=pos+1;
	end;
end; % write results back in res
toc
ib=ib+is;		% next part
end;
toc
combo(inp,res);
axis normal;
text(0,-50,['row smooth=',num2str(blksize),' column smooth=',num2str(filtsize),' local factor=',num2str(fact1)]);
colormap(cool);
toc
end;

