%% Create Lane Boundary Model And Insert Into Image
% Load a bird's eye view image of a road with lane markers. Create a lane boundary model from pre-determined parameters. Use findParabolicLaneBoundaries to get lane boundary models. Finally, overlay the identified lanes on the images.
% Load a pre-configured bird's-eye-view object.

bevc = load('birdsEyeConfig');

%
% Load a image captured using the sensor defined in the bird's-eye-view configuration object above.

I = imread('road.png');
imshow(I)

%
% Create bird's-eye-view image from the image and pre-configured sensor object.

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

%
% Create parabolic lane boundary model from pre-determined parabolic parameters. These parameters are the coefficients for a parabola that fits lane boundary markers. Consider findParabolicLaneBoundaries to find lane boundary models.

P = [-0.0003,0.0169,1.8226];
boundary = parabolicLaneBoundary(P);

%
% Overlay the parabola from the boundary model into the bird eye view image. Evaluate points from 3 to 30m in front of the camera sensor.

xPoints = 3:30;
figure;
imshow(insertLaneBoundary(birdsEyeImage,boundary,bevc.birdsEyeConfig,xPoints))

%
% Copyright 2012 The MathWorks, Inc.