Udacity CarND P1 - Lane line detection

Finding Lane Lines on the Road

This is my result of the first project in the Udacity’s Self-Driving Car Nano-degree program.

Lane Line detection

Overview

The goal of the project is to build a pipeline to detect lanes on the road in a given video stream.

Reflection / Steps

The resulting pipeline consists of 6 steps as described below.

step1: convert to gray scale

We first convert our image into gray scale to make rest of the processing easier as we dont have to deal with all colors on the image. we’re only interested in the white & yello images. cv2.cvtColor function is used for this.

Original Grayed
original grayed

step2: blur the image

The next step is to smoothen the image by bluring it using Gaussian blur (cv2.GaussianBlur)

Grayed Blured
grayed blured

step3: detect edges

From the blured image, we apply Canny’s edge detection to extract the edges in the image using cv2.Canny function

Blured Edges
blured edges

step4: mask the region of interest

The lane lines of our interest appear only in a specific region of the image. we mask rest of the image and keep only this area of interest.

Edges Masked
edges masked

step5: detect lines

In the interested region of the image, we apply Hough line transformation to detected lines using cv2.HoughLinesP function.

Masked Hough Lines
masked hough lines

step6: identify lane lines

From the detected hough lines, we extract only those lines that match with the angle/slope of lane lines and ignore the rest of the detected lines.

Hough Lines Lane Lines
hough lines lane lines

Since there would be several partial lines detected from the above step, we extrapolate them to define the left & right lane lines. I use linear regression to extrapolate the lines.

Lane Lines Extrapolated Lane Lines
lane lines extrapolated lines

Once we have the extrapolate lane lines, we then merge this on the original image.

Extrapolated Lane Lines Result
extrapolated lines result

Results

Shortcomings

The following are some of the shortcoming of this basic pipeline

Possible improvements

some of the possible improvement that immediately stike to my mind

Conclusion

As seen above, the implemented pipeline is pretty basic and fails with most of the real life scenarios. Going forward in the course, I’ll learn better ways to improve this pipeline.

You can find this basic pipeline implementation at my github repo here