This is my first project in Self-Driving Car Nanodegree Program. This project is built based on the guide and code template of Udacity. You can find the original guide here: CarND-LaneLines-P1.
Finding Lane Lines on the Road
The goals / steps of this project are the following:
- Make a pipeline that finds lane lines on the road
- Reflect on your work in a written report
My pipeline consisted of the following steps:
- Convert the images to grayscale using the helper function grayscale()
- Blur the image using Gaussian smoothing
- Apply Canny Edge Detection
- Define vertices
- Apply an image mask by using the helper functionregion_of_interest()
- Run Hough Transform to find lines in image
- Apply weighted_line() to combine initial image with the image after Hough Transform
In order to draw a single line on the left and right lanes, I modified the draw_lines() function by:
- Seperate line segments as left and right lines
- For each line, calculate average slopes and intercepts
- Calculate y_min, y_max
- For left and right lines, calculate x_min and x_max using intercept, slope
- Draw a line using (x_min, y_min) and (x_max, y_max)
One potential shortcoming of this solution is that the lane line could be wrong when running the algorithm on different videos or different roads. This could be due to the initialized values of the parameters like KERNEL_SIZE, LOW_THRESHOLD, HIGH_THRESHOLD, RHO, THETA, MIN_VOTES, MIN_LINE_LEN, MAX_LINE_GAP, BOTTOM_SHIFT, TOP_SHIP are not suitable. This is also one of the challenge for this problem when I have to manually try with different values.
There are several improvements that I could try in future.
- First, I can re-preprocess the original image, not just converting it to grayscale but to different channel and/or increasing its contrast.
- Second, try different algorithms that can fix the issues of identifying the proper values for the mentioned parameters.
- Third, make the image mask selection and the slopes to be dynamic according to the curve of each lane.