Finding Lane Lines on the Road
The libraries used in this project are the following:
open cv,
numpy,
matplotlib,
moviepy
The pipelining of this project are the following:
Selecting the region of interest (colour selection)
Canny edge - detection
hough transform
Reflection
- Discription about my pipeline.
Assuming that the camera has a fixed mount on the car so the angle and shape of the road lines remain same untill and unless the lines itself starts to change shape / orientation
My pipeline consisted of 5 steps.- Convert the images to grayscale and then perforn canny edge detection on it.
as the image is greyscale the there will be a drop in the color gradient on the boundry/edges of road lines (white/yellow) which would be easily detectable and hence markable - On this image we now perform region selection (or masking).
The entire region outside the defined polygon (here: trapezium) will be masked witha monotonic color. - On his masked edge detected image we perform hough transformation
After after the edge detection all pixels in our region of interest and above color threshold are lines in hough space. The interection point of these lines
will be a road line in normal cartesian space. - Extrapolation of lines
From the above algo we get lines, multiple short lines, To get a single long line we take the average of all lines we get and find the average slope and average y intersection. Now we have both m and c for an eqn of a sl -> y = m*x + c. - Imposing of images
After we got the lines we draw them by modifying a null matrix of same dimensions as of origonial image and then instead of concatinating the images we perform weighted addition, first to get a single matrix for both the lines and then the lines with origonal image with bias 0.
- Convert the images to grayscale and then perforn canny edge detection on it.
For videos we just apply all these steps to all the frames.
-
Potential shortcomings with the current pipeline
- Can not form curved lines for eg. at a turn the algorithm could go hay wire and form an arc at best.
- Needs some space between it and the vehicle in front to detect the lines
- If a white or any bright colored object comes in the region of interest it could be inferred as road lane line and can cause havoc.
-
Suggest possible improvements to your pipeline Something like object detection and radius of curvature to form a curved line would improve the algorithm a lot.
To see the examples of how did the result turn out, please see the photos and videos (in the folders named accordingly)