Lane-Detection
My pipeline consists of 6 steps.
- Convert the images to grayscale
- Smooth the images and get rid of the noise using Gaussian filter
- Detect the edges in the images using Canny Edge Detector
- Crop the region of interest, which is a trapezoidal mask in the bottom center
- Extract the lines out of the images using Hough Transform
- Extrapolate the small line segments and draw a complete line for each lane
The following pictures show the process of step 1,3,and 6
In order to extrapolate the lines, I did the following work:
- Rule out the lines that are vertical or nearly horizontal, as they are not candidates of real lane lines.
- Group the lines segments by their slopes and positions. If a line is in the left half plane and its slope is negative, then I consider it as a valid lane line and add up the slope and x,y position. The same rule applies for the right lane.
- After grouping, I calculate the average slope and x,y position, and then draw a line from the bottom to the center of the image.
The following pictures show the result of step 1. Due to the shade and the different colors at different road, there will be some spurious detection. If they are not ruled out, the result is totally off.
Potential shortcomings with my pipeline
- Sometimes the dectector doesn't pick up the yellow lane line because its color is too close to the road
- Sometimes there is no line drawn because too much line segments are filtered out. This could be improve by fine tuning the parameters