function [a,b]=vel(data);
% approximate lines to image point indicated by the value val. 
% The lines must be row oriented. the row gap may be of size w.
% datam: 	index image
% a,b : 	array with line parameters : row= a* column + b
%
[r,c]= size(data);
N=0; sx=0; sy=0; sxx=0; sxy=0; sum=0;
	for i1=1:r
		val=data(i1);
		sx=sx + i1;
		sxx=sxx + i1*i1;
		sxy=sxy + i1*val;
		sy=sy + val;
		N=N+1;
	end;
		noem=N*sxx-sx*sx;
		if ~(noem==0)
			a=(N*sxy-sx*sy)/noem;
			b=(sxx*sy-sx*sxy)/noem;
		else
			a(pos)=0;
			b(pos)=sy/N;
		end;
end;



