function [Width_Lane] = widthfind(I) SlopeThreshold=0.002; AmpThreshold=0; smoothwidth=2; peakgroup=1; smoothtype=5; y=psd(sum(I,1),size(I,2)); %y=y.^2; y=imresize(y,[500,1]); %y=y(:,1); P=peakfind(1:size(y,1),y,SlopeThreshold,AmpThreshold,smoothwidth,peakgroup,smoothtype); B=P(:,2)>500; P(B,:)=[]; [PS IX]=max(P(:,3)); Width_Lane=size(I,2)/P(IX,2)*2;