├── floyd_requirements.txt ├── examples └── grayscale.jpg ├── laneLines_thirdPass.jpg ├── line-segments-example.jpg ├── test_images ├── solidWhiteCurve.jpg ├── solidWhiteRight.jpg ├── solidYellowLeft.jpg ├── solidYellowCurve.jpg ├── solidYellowCurve2.jpg └── whiteCarLaneSwitch.jpg ├── writeup_template.md ├── README.md └── P1.ipynb /floyd_requirements.txt: -------------------------------------------------------------------------------- 1 | moviepy 2 | -------------------------------------------------------------------------------- /examples/grayscale.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floydhub/CarND-LaneLines-P1/master/examples/grayscale.jpg -------------------------------------------------------------------------------- /laneLines_thirdPass.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floydhub/CarND-LaneLines-P1/master/laneLines_thirdPass.jpg -------------------------------------------------------------------------------- /line-segments-example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floydhub/CarND-LaneLines-P1/master/line-segments-example.jpg -------------------------------------------------------------------------------- /test_images/solidWhiteCurve.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floydhub/CarND-LaneLines-P1/master/test_images/solidWhiteCurve.jpg -------------------------------------------------------------------------------- /test_images/solidWhiteRight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floydhub/CarND-LaneLines-P1/master/test_images/solidWhiteRight.jpg -------------------------------------------------------------------------------- /test_images/solidYellowLeft.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floydhub/CarND-LaneLines-P1/master/test_images/solidYellowLeft.jpg -------------------------------------------------------------------------------- /test_images/solidYellowCurve.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floydhub/CarND-LaneLines-P1/master/test_images/solidYellowCurve.jpg -------------------------------------------------------------------------------- /test_images/solidYellowCurve2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floydhub/CarND-LaneLines-P1/master/test_images/solidYellowCurve2.jpg -------------------------------------------------------------------------------- /test_images/whiteCarLaneSwitch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floydhub/CarND-LaneLines-P1/master/test_images/whiteCarLaneSwitch.jpg -------------------------------------------------------------------------------- /writeup_template.md: -------------------------------------------------------------------------------- 1 | #**Finding Lane Lines on the Road** 2 | 3 | ##Writeup Template 4 | 5 | ###You can use this file as a template for your writeup if you want to submit it as a markdown file. But feel free to use some other method and submit a pdf if you prefer. 6 | 7 | --- 8 | 9 | **Finding Lane Lines on the Road** 10 | 11 | The goals / steps of this project are the following: 12 | * Make a pipeline that finds lane lines on the road 13 | * Reflect on your work in a written report 14 | 15 | 16 | [//]: # (Image References) 17 | 18 | [image1]: ./examples/grayscale.jpg "Grayscale" 19 | 20 | --- 21 | 22 | ### Reflection 23 | 24 | ###1. Describe your pipeline. As part of the description, explain how you modified the draw_lines() function. 25 | 26 | My pipeline consisted of 5 steps. First, I converted the images to grayscale, then I .... 27 | 28 | In order to draw a single line on the left and right lanes, I modified the draw_lines() function by ... 29 | 30 | If you'd like to include images to show how the pipeline works, here is how to include an image: 31 | 32 | ![alt text][image1] 33 | 34 | 35 | ###2. Identify potential shortcomings with your current pipeline 36 | 37 | 38 | One potential shortcoming would be what would happen when ... 39 | 40 | Another shortcoming could be ... 41 | 42 | 43 | ###3. Suggest possible improvements to your pipeline 44 | 45 | A possible improvement would be to ... 46 | 47 | Another potential improvement could be to ... -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #**Finding Lane Lines on the Road** 2 | [![Udacity - Self-Driving Car NanoDegree](https://s3.amazonaws.com/udacity-sdc/github/shield-carnd.svg)](http://www.udacity.com/drive) 3 | 4 | Combined Image 5 | 6 | Overview 7 | --- 8 | 9 | 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. 10 | 11 | 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. 12 | 13 | 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](https://github.com/udacity/CarND-LaneLines-P1/blob/master/P1.ipynb) and the [writeup](https://github.com/udacity/CarND-LaneLines-P1/blob/master/writeup_template.md).The code file is called P1.ipynb and the writeup template is writeup_template.md 14 | 15 | To meet specifications in the project, take a look at the requirements in the [project rubric](https://review.udacity.com/#!/rubrics/322/view) 16 | 17 | 18 | Creating a Great Writeup 19 | --- 20 | For this project, a great writeup should provide a detailed response to the "Reflection" section of the [project rubric](https://review.udacity.com/#!/rubrics/322/view). There are three parts to the reflection: 21 | 1. Describe the pipeline 22 | 2. Identify any shortcomings 23 | 3. Suggest possible improvements 24 | 25 | We encourage using images in your writeup to demonstrate how your pipeline works. 26 | 27 | All that said, please be concise! We're not looking for you to write a book here: just a brief description. 28 | 29 | You're not required to use markdown for your writeup. If you use another method please just submit a pdf of your writeup. Here is a link to a [writeup template file](https://github.com/udacity/CarND-LaneLines-P1/blob/master/writeup_template.md). 30 | 31 | 32 | The Project 33 | --- 34 | 35 | ## If you have already installed the [CarND Term1 Starter Kit](https://github.com/udacity/CarND-Term1-Starter-Kit/blob/master/README.md) you should be good to go! If not, you can install the starter kit or follow the install instructions below to get started on this project. ## 36 | 37 | **Step 1:** Getting setup with Python 38 | 39 | To do this project, you will need Python 3 along with the numpy, matplotlib, and OpenCV libraries, as well as Jupyter Notebook installed. 40 | 41 | We recommend downloading and installing the Anaconda Python 3 distribution from Continuum Analytics because it comes prepackaged with many of the Python dependencies you will need for this and future projects, makes it easy to install OpenCV, and includes Jupyter Notebook. Beyond that, it is one of the most common Python distributions used in data analytics and machine learning, so a great choice if you're getting started in the field. 42 | 43 | Choose the appropriate Python 3 Anaconda install package for your operating system here. Download and install the package. 44 | 45 | If you already have Anaconda for Python 2 installed, you can create a separate environment for Python 3 and all the appropriate dependencies with the following command: 46 | 47 | `> conda create --name=yourNewEnvironment python=3 anaconda` 48 | 49 | `> source activate yourNewEnvironment` 50 | 51 | **Step 2:** Installing OpenCV 52 | 53 | Once you have Anaconda installed, first double check you are in your Python 3 environment: 54 | 55 | `>python` 56 | `Python 3.5.2 |Anaconda 4.1.1 (x86_64)| (default, Jul 2 2016, 17:52:12)` 57 | `[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin` 58 | `Type "help", "copyright", "credits" or "license" for more information.` 59 | `>>>` 60 | (Ctrl-d to exit Python) 61 | 62 | run the following commands at the terminal prompt to get OpenCV: 63 | 64 | `> pip install pillow` 65 | `> conda install -c menpo opencv3=3.1.0` 66 | 67 | then to test if OpenCV is installed correctly: 68 | 69 | `> python` 70 | `>>> import cv2` 71 | `>>>` (i.e. did not get an ImportError) 72 | 73 | (Ctrl-d to exit Python) 74 | 75 | **Step 3:** Installing moviepy 76 | 77 | We recommend the "moviepy" package for processing video in this project (though you're welcome to use other packages if you prefer). 78 | 79 | To install moviepy run: 80 | 81 | `>pip install moviepy` 82 | 83 | and check that the install worked: 84 | 85 | `>python` 86 | `>>>import moviepy` 87 | `>>>` (i.e. did not get an ImportError) 88 | 89 | (Ctrl-d to exit Python) 90 | 91 | **Step 4:** Opening the code in a Jupyter Notebook 92 | 93 | You will complete this project in a Jupyter notebook. If you are unfamiliar with Jupyter Notebooks, check out Cyrille Rossant's Basics of Jupyter Notebook and Python to get started. 94 | 95 | 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, run the following command at the terminal prompt (be sure you're in your Python 3 environment!): 96 | 97 | `> jupyter notebook` 98 | 99 | 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. 100 | 101 | **Step 5:** Complete the project and submit both the Ipython notebook and the project writeup 102 | 103 | -------------------------------------------------------------------------------- /P1.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Self-Driving Car Engineer Nanodegree\n", 8 | "\n", 9 | "\n", 10 | "## Project: **Finding Lane Lines on the Road** \n", 11 | "***\n", 12 | "In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really just a series of images). Check out the video clip \"raw-lines-example.mp4\" (also contained in this repository) to see what the output should look like after using the helper functions below. \n", 13 | "\n", 14 | "Once you have a result that looks roughly like \"raw-lines-example.mp4\", you'll need to get creative and try to average and/or extrapolate the line segments you've detected to map out the full extent of the lane lines. You can see an example of the result you're going for in the video \"P1_example.mp4\". Ultimately, you would like to draw just one line for the left side of the lane, and one for the right.\n", 15 | "\n", 16 | "In addition to implementing code, there is a brief writeup to complete. The writeup should be completed in a separate file, which can be either a markdown file or a pdf document. There is a [write up template](https://github.com/udacity/CarND-LaneLines-P1/blob/master/writeup_template.md) that can be used to guide the writing process. Completing both the code in the Ipython notebook and the writeup template will cover all of the [rubric points](https://review.udacity.com/#!/rubrics/322/view) for this project.\n", 17 | "\n", 18 | "---\n", 19 | "Let's have a look at our first image called 'test_images/solidWhiteRight.jpg'. Run the 2 cells below (hit Shift-Enter or the \"play\" button above) to display the image.\n", 20 | "\n", 21 | "**Note: If, at any point, you encounter frozen display windows or other confounding issues, you can always start again with a clean slate by going to the \"Kernel\" menu above and selecting \"Restart & Clear Output\".**\n", 22 | "\n", 23 | "---" 24 | ] 25 | }, 26 | { 27 | "cell_type": "markdown", 28 | "metadata": {}, 29 | "source": [ 30 | "**The tools you have are color selection, region of interest selection, grayscaling, Gaussian smoothing, Canny Edge Detection and Hough Tranform line detection. You are also free to explore and try other techniques that were not presented in the lesson. Your goal is piece together a pipeline to detect the line segments in the image, then average/extrapolate them and draw them onto the image for display (as below). Once you have a working pipeline, try it out on the video stream below.**\n", 31 | "\n", 32 | "---\n", 33 | "\n", 34 | "
\n", 35 | " \"Combined\n", 36 | "
\n", 37 | "

\n", 38 | "

Your output should look something like this (above) after detecting line segments using the helper functions below

\n", 39 | "
\n", 40 | "
\n", 41 | "

\n", 42 | "
\n", 43 | " \"Combined\n", 44 | "
\n", 45 | "

\n", 46 | "

Your goal is to connect/average/extrapolate line segments to get output like this

\n", 47 | "
\n", 48 | "
" 49 | ] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "metadata": {}, 54 | "source": [ 55 | "**Run the cell below to import some packages. If you get an `import error` for a package you've already installed, try changing your kernel (select the Kernel menu above --> Change Kernel). Still have problems? Try relaunching Jupyter Notebook from the terminal prompt. Also, see [this forum post](https://carnd-forums.udacity.com/cq/viewquestion.action?spaceKey=CAR&id=29496372&questionTitle=finding-lanes---import-cv2-fails-even-though-python-in-the-terminal-window-has-no-problem-with-import-cv2) for more troubleshooting tips.** " 56 | ] 57 | }, 58 | { 59 | "cell_type": "markdown", 60 | "metadata": {}, 61 | "source": [ 62 | "## Import Packages" 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": null, 68 | "metadata": { 69 | "collapsed": false 70 | }, 71 | "outputs": [], 72 | "source": [ 73 | "#importing some useful packages\n", 74 | "import matplotlib.pyplot as plt\n", 75 | "import matplotlib.image as mpimg\n", 76 | "import numpy as np\n", 77 | "import cv2\n", 78 | "%matplotlib inline" 79 | ] 80 | }, 81 | { 82 | "cell_type": "markdown", 83 | "metadata": {}, 84 | "source": [ 85 | "## Read in an Image" 86 | ] 87 | }, 88 | { 89 | "cell_type": "code", 90 | "execution_count": null, 91 | "metadata": { 92 | "collapsed": false 93 | }, 94 | "outputs": [], 95 | "source": [ 96 | "#reading in an image\n", 97 | "image = mpimg.imread('test_images/solidWhiteRight.jpg')\n", 98 | "\n", 99 | "#printing out some stats and plotting\n", 100 | "print('This image is:', type(image), 'with dimensions:', image.shape)\n", 101 | "plt.imshow(image) # if you wanted to show a single color channel image called 'gray', for example, call as plt.imshow(gray, cmap='gray')" 102 | ] 103 | }, 104 | { 105 | "cell_type": "markdown", 106 | "metadata": {}, 107 | "source": [ 108 | "## Ideas for Lane Detection Pipeline" 109 | ] 110 | }, 111 | { 112 | "cell_type": "markdown", 113 | "metadata": {}, 114 | "source": [ 115 | "**Some OpenCV functions (beyond those introduced in the lesson) that might be useful for this project are:**\n", 116 | "\n", 117 | "`cv2.inRange()` for color selection \n", 118 | "`cv2.fillPoly()` for regions selection \n", 119 | "`cv2.line()` to draw lines on an image given endpoints \n", 120 | "`cv2.addWeighted()` to coadd / overlay two images\n", 121 | "`cv2.cvtColor()` to grayscale or change color\n", 122 | "`cv2.imwrite()` to output images to file \n", 123 | "`cv2.bitwise_and()` to apply a mask to an image\n", 124 | "\n", 125 | "**Check out the OpenCV documentation to learn about these and discover even more awesome functionality!**" 126 | ] 127 | }, 128 | { 129 | "cell_type": "markdown", 130 | "metadata": {}, 131 | "source": [ 132 | "## Helper Functions" 133 | ] 134 | }, 135 | { 136 | "cell_type": "markdown", 137 | "metadata": {}, 138 | "source": [ 139 | "Below are some helper functions to help get you started. They should look familiar from the lesson!" 140 | ] 141 | }, 142 | { 143 | "cell_type": "code", 144 | "execution_count": null, 145 | "metadata": { 146 | "collapsed": true 147 | }, 148 | "outputs": [], 149 | "source": [ 150 | "import math\n", 151 | "\n", 152 | "def grayscale(img):\n", 153 | " \"\"\"Applies the Grayscale transform\n", 154 | " This will return an image with only one color channel\n", 155 | " but NOTE: to see the returned image as grayscale\n", 156 | " (assuming your grayscaled image is called 'gray')\n", 157 | " you should call plt.imshow(gray, cmap='gray')\"\"\"\n", 158 | " return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)\n", 159 | " # Or use BGR2GRAY if you read an image with cv2.imread()\n", 160 | " # return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n", 161 | " \n", 162 | "def canny(img, low_threshold, high_threshold):\n", 163 | " \"\"\"Applies the Canny transform\"\"\"\n", 164 | " return cv2.Canny(img, low_threshold, high_threshold)\n", 165 | "\n", 166 | "def gaussian_blur(img, kernel_size):\n", 167 | " \"\"\"Applies a Gaussian Noise kernel\"\"\"\n", 168 | " return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0)\n", 169 | "\n", 170 | "def region_of_interest(img, vertices):\n", 171 | " \"\"\"\n", 172 | " Applies an image mask.\n", 173 | " \n", 174 | " Only keeps the region of the image defined by the polygon\n", 175 | " formed from `vertices`. The rest of the image is set to black.\n", 176 | " \"\"\"\n", 177 | " #defining a blank mask to start with\n", 178 | " mask = np.zeros_like(img) \n", 179 | " \n", 180 | " #defining a 3 channel or 1 channel color to fill the mask with depending on the input image\n", 181 | " if len(img.shape) > 2:\n", 182 | " channel_count = img.shape[2] # i.e. 3 or 4 depending on your image\n", 183 | " ignore_mask_color = (255,) * channel_count\n", 184 | " else:\n", 185 | " ignore_mask_color = 255\n", 186 | " \n", 187 | " #filling pixels inside the polygon defined by \"vertices\" with the fill color \n", 188 | " cv2.fillPoly(mask, vertices, ignore_mask_color)\n", 189 | " \n", 190 | " #returning the image only where mask pixels are nonzero\n", 191 | " masked_image = cv2.bitwise_and(img, mask)\n", 192 | " return masked_image\n", 193 | "\n", 194 | "\n", 195 | "def draw_lines(img, lines, color=[255, 0, 0], thickness=2):\n", 196 | " \"\"\"\n", 197 | " NOTE: this is the function you might want to use as a starting point once you want to \n", 198 | " average/extrapolate the line segments you detect to map out the full\n", 199 | " extent of the lane (going from the result shown in raw-lines-example.mp4\n", 200 | " to that shown in P1_example.mp4). \n", 201 | " \n", 202 | " Think about things like separating line segments by their \n", 203 | " slope ((y2-y1)/(x2-x1)) to decide which segments are part of the left\n", 204 | " line vs. the right line. Then, you can average the position of each of \n", 205 | " the lines and extrapolate to the top and bottom of the lane.\n", 206 | " \n", 207 | " This function draws `lines` with `color` and `thickness`. \n", 208 | " Lines are drawn on the image inplace (mutates the image).\n", 209 | " If you want to make the lines semi-transparent, think about combining\n", 210 | " this function with the weighted_img() function below\n", 211 | " \"\"\"\n", 212 | " for line in lines:\n", 213 | " for x1,y1,x2,y2 in line:\n", 214 | " cv2.line(img, (x1, y1), (x2, y2), color, thickness)\n", 215 | "\n", 216 | "def hough_lines(img, rho, theta, threshold, min_line_len, max_line_gap):\n", 217 | " \"\"\"\n", 218 | " `img` should be the output of a Canny transform.\n", 219 | " \n", 220 | " Returns an image with hough lines drawn.\n", 221 | " \"\"\"\n", 222 | " lines = cv2.HoughLinesP(img, rho, theta, threshold, np.array([]), minLineLength=min_line_len, maxLineGap=max_line_gap)\n", 223 | " line_img = np.zeros((img.shape[0], img.shape[1], 3), dtype=np.uint8)\n", 224 | " draw_lines(line_img, lines)\n", 225 | " return line_img\n", 226 | "\n", 227 | "# Python 3 has support for cool math symbols.\n", 228 | "\n", 229 | "def weighted_img(img, initial_img, α=0.8, β=1., λ=0.):\n", 230 | " \"\"\"\n", 231 | " `img` is the output of the hough_lines(), An image with lines drawn on it.\n", 232 | " Should be a blank image (all black) with lines drawn on it.\n", 233 | " \n", 234 | " `initial_img` should be the image before any processing.\n", 235 | " \n", 236 | " The result image is computed as follows:\n", 237 | " \n", 238 | " initial_img * α + img * β + λ\n", 239 | " NOTE: initial_img and img must be the same shape!\n", 240 | " \"\"\"\n", 241 | " return cv2.addWeighted(initial_img, α, img, β, λ)" 242 | ] 243 | }, 244 | { 245 | "cell_type": "markdown", 246 | "metadata": {}, 247 | "source": [ 248 | "## Test Images\n", 249 | "\n", 250 | "Build your pipeline to work on the images in the directory \"test_images\" \n", 251 | "**You should make sure your pipeline works well on these images before you try the videos.**" 252 | ] 253 | }, 254 | { 255 | "cell_type": "code", 256 | "execution_count": null, 257 | "metadata": { 258 | "collapsed": false 259 | }, 260 | "outputs": [], 261 | "source": [ 262 | "import os\n", 263 | "os.listdir(\"test_images/\")" 264 | ] 265 | }, 266 | { 267 | "cell_type": "markdown", 268 | "metadata": {}, 269 | "source": [ 270 | "## Build a Lane Finding Pipeline\n", 271 | "\n" 272 | ] 273 | }, 274 | { 275 | "cell_type": "markdown", 276 | "metadata": {}, 277 | "source": [ 278 | "Build the pipeline and run your solution on all test_images. Make copies into the test_images directory, and you can use the images in your writeup report.\n", 279 | "\n", 280 | "Try tuning the various parameters, especially the low and high Canny thresholds as well as the Hough lines parameters." 281 | ] 282 | }, 283 | { 284 | "cell_type": "code", 285 | "execution_count": null, 286 | "metadata": { 287 | "collapsed": true 288 | }, 289 | "outputs": [], 290 | "source": [ 291 | "# TODO: Build your pipeline that will draw lane lines on the test_images\n", 292 | "# then save them to the test_images directory." 293 | ] 294 | }, 295 | { 296 | "cell_type": "markdown", 297 | "metadata": {}, 298 | "source": [ 299 | "## Test on Videos\n", 300 | "\n", 301 | "You know what's cooler than drawing lanes over images? Drawing lanes over video!\n", 302 | "\n", 303 | "We can test our solution on two provided videos:\n", 304 | "\n", 305 | "`solidWhiteRight.mp4`\n", 306 | "\n", 307 | "`solidYellowLeft.mp4`\n", 308 | "\n", 309 | "**Note: if you get an `import error` when you run the next cell, try changing your kernel (select the Kernel menu above --> Change Kernel). Still have problems? Try relaunching Jupyter Notebook from the terminal prompt. Also, check out [this forum post](https://carnd-forums.udacity.com/questions/22677062/answers/22677109) for more troubleshooting tips.**\n", 310 | "\n", 311 | "**If you get an error that looks like this:**\n", 312 | "```\n", 313 | "NeedDownloadError: Need ffmpeg exe. \n", 314 | "You can download it by calling: \n", 315 | "imageio.plugins.ffmpeg.download()\n", 316 | "```\n", 317 | "**Follow the instructions in the error message and check out [this forum post](https://carnd-forums.udacity.com/display/CAR/questions/26218840/import-videofileclip-error) for more troubleshooting tips across operating systems.**" 318 | ] 319 | }, 320 | { 321 | "cell_type": "code", 322 | "execution_count": null, 323 | "metadata": { 324 | "collapsed": true 325 | }, 326 | "outputs": [], 327 | "source": [ 328 | "# Import everything needed to edit/save/watch video clips\n", 329 | "from moviepy.editor import VideoFileClip\n", 330 | "from IPython.display import HTML" 331 | ] 332 | }, 333 | { 334 | "cell_type": "code", 335 | "execution_count": null, 336 | "metadata": { 337 | "collapsed": true 338 | }, 339 | "outputs": [], 340 | "source": [ 341 | "def process_image(image):\n", 342 | " # NOTE: The output you return should be a color image (3 channel) for processing video below\n", 343 | " # TODO: put your pipeline here,\n", 344 | " # you should return the final output (image where lines are drawn on lanes)\n", 345 | "\n", 346 | " return result" 347 | ] 348 | }, 349 | { 350 | "cell_type": "markdown", 351 | "metadata": {}, 352 | "source": [ 353 | "Let's try the one with the solid white lane on the right first ..." 354 | ] 355 | }, 356 | { 357 | "cell_type": "code", 358 | "execution_count": null, 359 | "metadata": { 360 | "collapsed": false 361 | }, 362 | "outputs": [], 363 | "source": [ 364 | "white_output = 'white.mp4'\n", 365 | "clip1 = VideoFileClip(\"solidWhiteRight.mp4\")\n", 366 | "white_clip = clip1.fl_image(process_image) #NOTE: this function expects color images!!\n", 367 | "%time white_clip.write_videofile(white_output, audio=False)" 368 | ] 369 | }, 370 | { 371 | "cell_type": "markdown", 372 | "metadata": {}, 373 | "source": [ 374 | "Play the video inline, or if you prefer find the video in your filesystem (should be in the same directory) and play it in your video player of choice." 375 | ] 376 | }, 377 | { 378 | "cell_type": "code", 379 | "execution_count": null, 380 | "metadata": { 381 | "collapsed": false 382 | }, 383 | "outputs": [], 384 | "source": [ 385 | "HTML(\"\"\"\n", 386 | "\n", 389 | "\"\"\".format(white_output))" 390 | ] 391 | }, 392 | { 393 | "cell_type": "markdown", 394 | "metadata": {}, 395 | "source": [ 396 | "## Improve the draw_lines() function\n", 397 | "\n", 398 | "**At this point, if you were successful with making the pipeline and tuning parameters, you probably have the Hough line segments drawn onto the road, but what about identifying the full extent of the lane and marking it clearly as in the example video (P1_example.mp4)? Think about defining a line to run the full length of the visible lane based on the line segments you identified with the Hough Transform. As mentioned previously, try to average and/or extrapolate the line segments you've detected to map out the full extent of the lane lines. You can see an example of the result you're going for in the video \"P1_example.mp4\".**\n", 399 | "\n", 400 | "**Go back and modify your draw_lines function accordingly and try re-running your pipeline. The new output should draw a single, solid line over the left lane line and a single, solid line over the right lane line. The lines should start from the bottom of the image and extend out to the top of the region of interest.**" 401 | ] 402 | }, 403 | { 404 | "cell_type": "markdown", 405 | "metadata": {}, 406 | "source": [ 407 | "Now for the one with the solid yellow lane on the left. This one's more tricky!" 408 | ] 409 | }, 410 | { 411 | "cell_type": "code", 412 | "execution_count": null, 413 | "metadata": { 414 | "collapsed": false 415 | }, 416 | "outputs": [], 417 | "source": [ 418 | "yellow_output = 'yellow.mp4'\n", 419 | "clip2 = VideoFileClip('solidYellowLeft.mp4')\n", 420 | "yellow_clip = clip2.fl_image(process_image)\n", 421 | "%time yellow_clip.write_videofile(yellow_output, audio=False)" 422 | ] 423 | }, 424 | { 425 | "cell_type": "code", 426 | "execution_count": null, 427 | "metadata": { 428 | "collapsed": false 429 | }, 430 | "outputs": [], 431 | "source": [ 432 | "HTML(\"\"\"\n", 433 | "\n", 436 | "\"\"\".format(yellow_output))" 437 | ] 438 | }, 439 | { 440 | "cell_type": "markdown", 441 | "metadata": {}, 442 | "source": [ 443 | "## Writeup and Submission\n", 444 | "\n", 445 | "If you're satisfied with your video outputs, it's time to make the report writeup in a pdf or markdown file. Once you have this Ipython notebook ready along with the writeup, it's time to submit for review! Here is a [link](https://github.com/udacity/CarND-LaneLines-P1/blob/master/writeup_template.md) to the writeup template file.\n" 446 | ] 447 | }, 448 | { 449 | "cell_type": "markdown", 450 | "metadata": { 451 | "collapsed": true 452 | }, 453 | "source": [ 454 | "## Optional Challenge\n", 455 | "\n", 456 | "Try your lane finding pipeline on the video below. Does it still work? Can you figure out a way to make it more robust? If you're up for the challenge, modify your pipeline so it works with this video and submit it along with the rest of your project!" 457 | ] 458 | }, 459 | { 460 | "cell_type": "code", 461 | "execution_count": null, 462 | "metadata": { 463 | "collapsed": true 464 | }, 465 | "outputs": [], 466 | "source": [ 467 | "challenge_output = 'extra.mp4'\n", 468 | "clip2 = VideoFileClip('challenge.mp4')\n", 469 | "challenge_clip = clip2.fl_image(process_image)\n", 470 | "%time challenge_clip.write_videofile(challenge_output, audio=False)" 471 | ] 472 | }, 473 | { 474 | "cell_type": "code", 475 | "execution_count": null, 476 | "metadata": { 477 | "collapsed": true 478 | }, 479 | "outputs": [], 480 | "source": [ 481 | "HTML(\"\"\"\n", 482 | "\n", 485 | "\"\"\".format(challenge_output))" 486 | ] 487 | } 488 | ], 489 | "metadata": { 490 | "anaconda-cloud": {}, 491 | "kernelspec": { 492 | "display_name": "Python 3", 493 | "language": "python", 494 | "name": "python3" 495 | }, 496 | "language_info": { 497 | "codemirror_mode": { 498 | "name": "ipython", 499 | "version": 3 500 | }, 501 | "file_extension": ".py", 502 | "mimetype": "text/x-python", 503 | "name": "python", 504 | "nbconvert_exporter": "python", 505 | "pygments_lexer": "ipython3", 506 | "version": "3.5.2" 507 | } 508 | }, 509 | "nbformat": 4, 510 | "nbformat_minor": 0 511 | } 512 | --------------------------------------------------------------------------------