AVND_Project_02_Lanes_Lines_Advanced

View the Project on GitHub

Advanced Lane Detection

Goals

In summary, the goals of this project are as follows:

Results

Camera Calibration

The code for this step is contained in goularttools.py, function get_calibration(calibrationFiles, nx=9, ny=6). It is essentially based on my answer to the quiz we did to perform the task and uses functionality from OpenCV (findChessboardCorners) to find corners in calibration images, and populate a list of image points. They correspond to object points in real life that were also saved.

alt text

Pipeline (single images)

The pipeline starts by simply using the functionality developed during Udacity quizzes to apply the distortion correction to one of the test images like this one: alt text

I used the combination of color and gradient thresholds developed during quizzes to generate a binary image. The code is in udacitytools.py, apply_color_gradient_threshold(). Here’s an example of my output for this step:

alt text

The code for my perspective transform includes a function called warpToBirdsEyeView() which I wrote based on my experience from the first project, isolating the factors and parameters that are important for the projection and making it easy to fine tune the behavior to the input images. I verified that my perspective transform was working as expected by drawing the src and dst points onto a test image and its warped counterpart to verify that the lines appear parallel in the warped image.

alt text

The function fit_polynomial(binary_warped) from my module udacitytools.py encompasses the functionality to find the bins where most of the pixels are populated in the base of the image, do a sliding window search, a second degree polynomial fit, and refine the resulting fit.

alt text alt text

I have created a class that encapsulates all the functionality created for finding lanes. I took great care to store are data members all the hyper-parameters that are important during fine-tuning. The pipeline stores stores those parameters along with intermediary results so those don’t have to get passed around from one stand-alone function to another. The final script can be run independently given the environment in python is setup according to what Udacity specified.

alt text alt text

I created two python modules to contain the heavy-lifting functionality. One with the partial results I accumulated during Udacity lessons as I performed all quizzes. The other module contains some of my own utility functions. Combined, those two modules contain the main toolkit to complete the project. In essence the main function makes use of the AdvancedLaneDetection class I created to encapsulate all important parameters, algorithms and results.

There is a limitation that is obvious with sharp turns. The warping takes the further end of the turn out of the warped region and the polynomial fit suffers, particularly on left turns. If I were to work further on this I would try to tackle that by further parameters tuning and a more smooth process to track the change in the fit results.