- P1.ipynb: the code for finding lanes.
- test_videos_output: generated videos with annotated lanes.
There are 6 steps.
- Convert the images to grayscale and apply Gaussian Blur with kerner size 5.
- Detect edges via Canny with low threshold 40 and high threshold 150.
- Only keep edges within the region of interest.
- Find lines using Hough transform from canny edges.
- Remove invalid lines using slope (More details explained below).
- Average the position of each of the lines and extrapolate to the top and bottom of the lane.
In order to draw a single line on the left and right lanes, I modified the draw_lines() function by adding the following stuff
- Only keep lines whose absolute slopes are bigger than 0.3 and lower then 0.3
- If the line is left lane and its slope is positive, remove this line.
- If the line is right lane and its slope is negative, remote this line.
- For all valid lines, calcuate the averaged slope and y intercept.
- Calculate the bottom and top points giving averaged slope and y intercept.