When we drive, we use our eyes to decide where to go. The lines on the road that show us where the lanes are act as our constant reference for where to steer the vehicle. Naturally, one of the first things we would like to do in developing a self-driving car is to automatically detect lane lines using an algorithm.
In this project you will detect lane lines in images using Python and OpenCV. OpenCV means "Open-Source Computer Vision", which is a package that has many useful tools for analyzing images.
To complete the project, two files will be submitted: a file containing project code and a file containing a brief write up explaining your solution. We have included template files to be used both for the code and the writeup.The code file is called P1.ipynb and the writeup template is writeup_template.md
To meet specifications in the project, take a look at the requirements in the project rubric
The goals / steps of this project are the following:
- Make a pipeline that finds lane lines on the road
- Reflect on your work in a written report
My pipeline consisted of next steps:
- Load image
- Define region_of_interest image
- Convert source image to grayscale
- Apply gaussian blur to a grayscale image
- Apply canny edge detection to gaussian blur image
- Mask canny edge detection and region_of_interest image
- Use hough_lines to find all the lines and draw a single left and right lanes
- Weighted lane_detection and source images
- Get the midpoint of all lines detected
- Determines whether the midpoint is loaded on the right or left side of the image and classifies it
- Use a simple linear regression to get m and b parameters the midpoint of left and right lines detected
- Define the x1, y1 and x2, y2 points to draw the left and right line to cover the region of interest x = (y - b) / m
- Draw the left and right lane lines
One potential shortcoming would be what would happen when are shades in the road or too much light
A possible improvement would be to detect lane lines by color in order to have some redundancy
If you have already installed the CarND Term1 Starter Kit you should be good to go! If not, you should install the starter kit to get started on this project.
Step 1: Set up the CarND Term1 Starter Kit if you haven't already.
Step 2: Open the code in a Jupyter Notebook
You will complete the project code in a Jupyter notebook. If you are unfamiliar with Jupyter Notebooks, check out Udacity's free course on Anaconda and Jupyter Notebooks to get started.
Jupyter is an Ipython notebook where you can run blocks of code and see results interactively. All the code for this project is contained in a Jupyter notebook. To start Jupyter in your browser, use terminal to navigate to your project directory and then run the following command at the terminal prompt (be sure you've activated your Python 3 carnd-term1 environment as described in the CarND Term1 Starter Kit installation instructions!):
> jupyter notebook
A browser window will appear showing the contents of the current directory. Click on the file called "P1.ipynb". Another browser window will appear displaying the notebook. Follow the instructions in the notebook to complete the project.
Step 3: Complete the project and submit both the Ipython notebook and the project writeup