%############################################ %###### Preprocessing of the lane image ##### %############################################ % I=imread('Image.jpg'); % Read image from database % I=rgb2gray(I); % Convert a color image to gray image I=imresize(I,[100,500]); % Changing the image size to 100*500 pixels %>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> L_vpp=sum(I,1); L_vpp=500*(L_vpp-min(L_vpp))/(max(L_vpp)-min(L_vpp)); P=5; % P Equal to half of Averaged Range - width of Lane is 40 pixels L_vpp1=L_vpp; % S_vpp is signal that removed noise for i=P+1:size(L_vpp,2)-P L_vpp(i)=sum(L_vpp1(i-P:i+P))/9; end % plot(L_vpp1,'r','LineWidth',2) % hold on % plot(L_vpp,'b','LineWidth',2) %>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PLans={}; SlopeThreshold=0.000001; AmpThreshold=0; smoothwidth=2; peakgroup=5; smoothtype=5; P=peakfind([1:size(L_vpp,2)],L_vpp,SlopeThreshold,AmpThreshold,smoothwidth,peakgroup,smoothtype); % subplot(2,1,1) % imshow(I); % subplot(2,1,2) % plot([1:size(L_vpp,2)],L_vpp);hold on;plot(P(:,2),P(:,3),'*g')