#Finding Lane Lines on the Road
The goal of this project is to create a pipeline that finds lane lines on the road for self-driving cars. It uses Python 3.5 and Opencv for building the pipeline.
Following python packages are used:
- OpenCV
- Matplotlib
- Numpy
- Math
- Imageio
- Moviepy
- Install CarND Term1 Starter Kit Docker container
- Launch the Docker container docker run -it -p 8888:8888 -v {$pwd}:/notebooks udacity/carnd-term1-starter-kit
- Open jupyter notebook from the url provided on the console
The pipeline consists of seven steps.
First, I applied a color filter to only select the white and yellow pixels from the images (corresponding to the colors for the lane lines). This helped in removing spurious lines from the image and simplified the processing downstream.
Next, I converted the image to grayscale. Then smoothed using Gaussian blur with a kernel of size 7 and sigma of 2. Canny edge detection was applied to the smoothed image resulting in removing most of the noise from the image as seen below:
Next, region of interest was selected to only process subset of the image corresponding to road ahead. Hough transformation was used for line detection on the selected subset, with a threshold of 50 and max_line_gap of 100 to connect smaller spread out dashed line segments. Further, the lines were drawn by extrapolating the points across multiple frames in the video stream. Lines with slope outside threshold were discarded. The detected lines were divided into left and right buckets and then a average slope and intercept was computed across 5 video frames for drawing actual lines.
The pipeline was tested with the white and yellow lines and the challenge video. (See outputs in test_videos_output folder)
This pipeline works for simple lane detection for lanes that are straight, or have slight curves, and generally well marked highway roads . It also expects the recording camera to be placed in center of the car dashboard.
Following shortcomings exist and can be explored in a future project:
- Works for lane that have both left and right lane lines
- Highway entry / exits with lane merging and city roads are not handled
- Lanes with large gaps in line or poor line markings are not detected
- Sensitive to camera install position on the car, the region of interest is fixed and not calculated dynamically
The pipeline can be made more robust by extending for:
- Dynamic selection of the region of interest for the road selection. A window search algorithm can be used for proper identification and location of the road and elminate false positives
- Perform perspective transformation of the image for better lane detection and eliminate extra lanes detected in case of lane merging or other markings drawn on the road