Advanced Lane Finding Project
The goals / steps of this project are the following:
- Compute the camera calibration matrix and distortion coefficients given a set of chessboard images.
- Apply a distortion correction to raw images.
- Use color transforms, gradients, etc., to create a thresholded binary image.
- Apply a perspective transform to rectify binary image ("birds-eye view").
- Detect lane pixels and fit to find the lane boundary.
- Determine the curvature of the lane and vehicle position with respect to center.
- Warp the detected lane boundaries back onto the original image.
- Output visual display of the lane boundaries and numerical estimation of lane curvature and vehicle position.
The camera matrix was generated from a set of chessboard images taken with the camera that was used to record the drive. This way the camera matrix could be used to undistort each frame and ensure that the curvature readings were accurate. The calculations for the camera matrix and the undistort function can be found in the src/calibrate.py function. The class is initialized becore the video is begun so that the inital calibration is done prior to any line finding calculations.
After the image was undistorted the image was warped into a birds eye view. This was done by taking points from the rough locations of where the lane was likely to be and then finding a mapping in which those coordinates formed a rectangle. Once this mapping was found it was applied to all pixels in the image to create a birds eye view of the lane.
To extract the lane lines the birds eye view was transformed into a binary image. This was done purely based on color channels from the LAB and LUV color spaces of the image. These provided the best extraction of the lane colors.
A polynomal function was then fit on the coordinates of the 'on' pixels in the image. This was done by collecting pixels that were in the correct spot. To do this we defined a rectangular box for each of lane in ten spots in the birds eye views vertical direction. pixels not in the boxes were discarded and a polynomial for each line was fit to remaining points. This functions were used to determine the lane, and later on the curvature and position of the car
This new image was then warped back into the same coordinate system as the undistorted image and the two images were merged together.
The curvature and position of the car were then calculated and added to the image
- curvature was calculated based on the polynomial of each lane line and then the two curvaturs were averaged.
- position was calculated based on the diffence between the lane center and the image center and then converted to world space.
A video was created by running each frame from a video through the pipeline.
Here's a link to my video result
The there are three main issues that will instantly wreck the accuracy of this project.
- Hills: driving on a non flat road will mean the warping to a birds eye view will not maintain the correct curvature of the road.
- Lighting conditions: under difficult lighting or bad weather conditions the lines may be harder to extract. If a big enough portion of the lane is not accurately recorded the numeric results will not be accurate.
- Camera position: The assumption that the camera is in the middle of the car and the cannot be violated or the position details will not be accurate.







