%% Detect Lanes in Road Image
% Load a bird's-eye-view configuration object.

load birdsEyeConfig

%
% Load the image captured from the sensor that is defined in the bird's-eye-view configuration object.

I = imread('road.png');
figure
imshow(I)
title('Original Image')

%
% Create a bird's-eye-view image.

birdsEyeImage = transformImage(birdsEyeConfig,I);
imshow(birdsEyeImage)

%
% Convert bird's-eye-view image to grayscale.

birdsEyeImage = rgb2gray(birdsEyeImage);

%
% Set the approximate lane marker width to 25 cm, which is in world units.

approxMarkerWidth = 0.25;

%
% Detect lane features.

birdsEyeBW = segmentLaneMarkerRidge(birdsEyeImage,birdsEyeConfig,approxMarkerWidth);
imshow(birdsEyeBW)

%
% Copyright 2012 The MathWorks, Inc.