Project Goals
- Develop a computer vision pipeline that finds lane lines on the road
- Reflect on the pipeline in a written report
The vision pipeline would filter and annotate the image as follows:
Initial Image | Pipeline Result |
---|---|
![]() |
![]() |
Note: We will be using a snapshot image form the challenge image to visualize the pipeline process
The vision processing pipeline consists of three main sections:
- Color based filtering
- Hough lines filtering
- Line filtering
Color based filtering consists of two parts. First the image is masked to a region of interest which filters the image to nearly only the lane lines. The image is then converted to the HSV and filtered by color. This colorspace change is performed so that colors can be more easily selected. Surprisingly with a filtering based on value only, the lane lines could be isolated.
Region Filtering | Color Filtering |
---|---|
![]() |
![]() |
Next, the color filtered image enters the Hough lines filtering portion. Here the image is first converted to grayscale. Next, a gaussian blur is applied and then canny edge detection is performed on the image. Finally, the Hough lines algorithm is applied to the canny edges result and the initial lines annotation is shown in red.
Grayscale Conversion | Blur Filter | Simple Hough Lines |
---|---|---|
![]() |
![]() |
![]() |
Now that we have a few candidate lines segments on each side of lane, we can take the average of these lines in order to present a final annotated road. This pipeline is mostly included in the helper function section. First the lines are separated by slope into left and right lines. Next, the lines are averaged and the bottom point is used to generate the equations that are to represent the average line. Next, this average line is transformed into points to be drawn on the image using the intersection of the middle of the image and the base of the image as reference lines. Lastly, if both a left and right lane are detected the lines are shaved to their intersection.
These filtered lines are then blended into the initial image to annoate the lane line position.
Complex Hough Lines | Pipeline Result |
---|---|
![]() |
![]() |
Although, the pipeline covers a lot of edge cases there is still some potential areas of improvement:
- The pipeline does not always detect a left and right lane
- The pipeline could be further tuned to match these edge cases using the cv2 morphological filters to better capture the lane markings
- The pipeline jitters quite a bit
- In order to smoothen this jitter the pipeline could cache previous detections and only update the annotation if the lane changes past a set point
- The pipeline needs to be tuned to road conditions
- Jumping from the white and yellow lanes to the challenge image required additional tuning of the pipeline which in the end made the pipeline more robust but a color invariant solution could avoid this issue altogether