{"id":22062995,"url":"https://github.com/supertetelman/sdc-lanelines","last_synced_at":"2026-04-16T10:35:15.036Z","repository":{"id":68718080,"uuid":"82991196","full_name":"supertetelman/sdc-lanelines","owner":"supertetelman","description":"Python project that utilizes OpenCV image processing to identify and highlight road lanes. Takes images or videos as input. This was the first project for the Udacity Self Driving Car Nanodegree.","archived":false,"fork":false,"pushed_at":"2017-04-04T18:31:15.000Z","size":75226,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-13T18:02:37.097Z","etag":null,"topics":["course","image-processing","opencv","python","self-driving-car","udacity"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/supertetelman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-24T02:08:06.000Z","updated_at":"2017-02-28T18:49:33.000Z","dependencies_parsed_at":"2023-03-08T23:31:07.691Z","dependency_job_id":null,"html_url":"https://github.com/supertetelman/sdc-lanelines","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/supertetelman/sdc-lanelines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supertetelman%2Fsdc-lanelines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supertetelman%2Fsdc-lanelines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supertetelman%2Fsdc-lanelines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supertetelman%2Fsdc-lanelines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supertetelman","download_url":"https://codeload.github.com/supertetelman/sdc-lanelines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supertetelman%2Fsdc-lanelines/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31882613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["course","image-processing","opencv","python","self-driving-car","udacity"],"created_at":"2024-11-30T18:28:27.823Z","updated_at":"2026-04-16T10:35:15.017Z","avatar_url":"https://github.com/supertetelman.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Finding Lane Lines on the Road**\n\n**Adam Tetelman**\n\n### Project Introduction\n\nThe goal of this project was to create an image processing pipeline that is capable of taking images and/or video footage from a frontward facing car dash cam and accurately identify the lane lines.\n\nThe image processing pipeline used must be able to identify lane edges within the images. The pipeline must also be able to calculate a most likely location for the right and left lane line and overlay a solid line over the image indicating the lanes.\n\nAfter completion of the coding portion a follow-up project summary will be written describing the technology used, the problem solving approach, the pipeline chosen, and reflections upon those design choices.\n\n### Image Processing For Identifying Lane Lines\n\n#### Tools Summary\n\nThe tools used in the pipeline included the following:\n- Contrast Increase: Cause brigher colors to appear brighter and darker colors to appear darker for more accurate analysis.\n- Grayscale Converstion: Convert three layer RGB image to single layer grayscale image for noise reduction and easier/faster processing.\n- Gaussian Blur: Uses a Gaussian Kernel to blur the image for noise reduction.\n- Color Selection: Given a low and high color threshold will return an image containing only colors in the threshold.\n- Polygon Region Selection: Given a set of vertices returns an image containing only values within the polygon. Used for analysing only areas of interest.\n- Canny Edge Detection: OpenCV implementation of the Canny edge detection algorithm.\n- Hough Transform (Line Detection): OpenCV implementation of the Hough Transform to identify likely lines in an image\n\n#### Pipeline Summary\n\nThe Pipeline I implemented had 7 main steps. This was broken into two main parts, the edge detection segment and the lane detection segment.\n\n###### Edge Detection\n1. Convert to grayscale\n2. Apply Gaussian blur\n3. Color selection \n4. Canny edge detection\n5. Region of interest selection\n\n###### Lane Detection\n6. Draw lanes\n7. Overlay lanes onto original image\n    \nIn addition to those main steps I also played around with a few alternative image processing techniques and analysis steps. These were not included in the final pipeline but are detailed in the project notebook.\n\n#### Edge Detection Pipeline\n\nThe edge detection segment is made up primarily of calls the external libraries. In this part of the pipeline we do two things. We first simplify the image and reduce noise (grayscale, blur, color selection). We then detect edges and output all detected lines (canny edge detection, region of interest).\n\nThis is the step with the most parameters to tune. As can be seen in the code example below, each step in the pipeline has several variables that can be used to modify the end result of the pipeline.\n\n    # Gaussian blur kernel\n    blur_kernel_size = 3\n\n    # Canny Edge detection\n    canny_ratio = 3\n    canny_low_threshold = 70\n    canny_high_threshold = canny_low_threshold * canny_ratio\n\n    # Color selection\n    color_low = 200\n    color_high = 255\n\n    # Region selection\n    poly_y = image.shape[0]\n    poly_x = image.shape[1]\n    polygon_vertices = ...\n\nThe output of this step will look something like this:\n![step6]\n\nIt is worth noting that the order of some of these steps can be changed. This could results in no changes, a more efficient pipeline, or slightly different end results.\n\n#### Lane Detection\nThis segment of the pipeline uses the Hough transform along with much of my own algorithms.\n\nThe previous steps of the pipeline results in an image that contains many points. I then take that image and feed it through the OpenCV HoughLinesP function. The output of this is a Numpy array of lines in [(x1,y2), (x2,y2)] format.\n\nGiven a list of lines, the next step is to determine which lines belong to the left and right lanes. I am able to accurately achieve this by calculating the slope of each lane.  \n\nAfter creating a list of left_lane_lines and right_lane_lines I am able to calculate the slope of each lane line and the center of each lane line.\n\nThe last step in drawing the lines is to use some math to calculate the (x,y) pairs. I manually define the y values to be the bottom of the image and a third from the top of the image. I am then able to use my calculated slope and calculated center to determine the other x values. The equestion used is Y1-Y2) = m(X1-X2). \n\nThe output of this step will look something like this (before being overlayed onto the original image):\n![step7]\n\nThe final step is simply to overlay this image with the original.\n\nThe tuning parameters were for the Hough transform and some slope validation:\n   \n    # Define an invalid slope range \n    invalid_slope_low_max = .05\n    invalid_slope_low_min = -.05\n    invalid_slope_high_max = 100 \n    \n    # Hough Line detection\n    hough_rho = 2\n    hough_theta = np.pi/180 \n    hough_threshold = 60\n    hough_min_line_len = 10\n    hough_max_line_gap = 100\n\nThere are several different ways this step could have been achieved and in the project notebook I have gone into a bit more depth on some of these options (linear regression).\n\n\n\u003cvideo width=\"960\" height=\"540\" controls type='video/mp4'\u003e\n  \u003csource src=\"results/yellow.mp4\"\u003e\n\u003c/video\u003e\n\n\n### Reflection\n\nThe pipeline I was able to put together runs very well. It is simply enough to explain in a few paragraphs, yet effective enough to highlight the lanes in the videos and images tested. I am happy with the tuning I was able to accomplish as well as the expandability of the pipeline itself.\n\nThat being said I would not want to ride in a car operating off of this algorithm. In many real world scenarios it would likely fail. Firstly, processing a 10 second video took 30 seconds. If this algorithm cannot effectively run in real time it is not useful, some optimizations and/or better hardware would be needed. Secondly, a car is often in situations with crowded roads, poor weather, and hard to identify lanes; given a realistic situation in traffic I do not think this algorithm as it stands would be effective.\n\nIt would however do very well for a bulk of the driving I do, that being long hauls on minimaly populated highways, in good weather, on a sunny day. Given this sort of scenario I see no reason to think that the pipeline would do any worse than it did in the test videos.\n\n#### Potential Shortcomings\n\nOther potential shortcomings and bad scenarios:\n- Dealing with accidents\n- Dealing with inclement weather\n- Dealing with construction\n- Dealing with doubly painted or missing lines\n- Dealing with dirt roads\n- Dealing with merges\n- Dealing with very sharp turns\n- Dealing with non-standard lane colors\n- Dealing with non-standard camera footage\n- Dealing with heavy traffic\n- Running in real time\n\n#### Possible Improvements\n\nThere are numerous ways this could be improved. Here is a short list:\n- Increase contrast for dealing with low light or high brightness scenarios\n- Segment lanes using linear regression\n- Segment lanes using a series of vectors rather than a single line\n- Write code in something faster than python\n\n### Results\n\n#### Final Videos\n\nSee results on Github.\n\n\n#### Processing Steps\n\n![step0]\n![step1]\n![step2]\n![step3]\n![step4]\n![step5]\n![step6]\n![step7]\n![step8]\n\n#### Raw Edge Detection Videos\n\nSee results on Github.\n\n#### Test Images\n\n![image1]\n![image2]\n![image3]\n![image4]\n![image5]\n\n[step0]: ./results/process-step-0.jpg \"Pipeline 0\"\n[step1]: ./results/process-step-1.jpg \"Pipeline 1\"\n[step2]: ./results/process-step-2.jpg \"Pipeline 2\"\n[step3]: ./results/process-step-3.jpg \"Pipeline 3\"\n[step4]: ./results/process-step-4.jpg \"Pipeline 4\"\n[step5]: ./results/process-step-5.jpg \"Pipeline 5\"\n[step6]: ./results/process-step-6.jpg \"Pipeline 6\"\n[step7]: ./results/process-step-7.jpg \"Pipeline 7\"\n[step8]: ./results/process-step-8.jpg \"Pipeline 8\"\n\n[image1]: ./results/solidWhiteCurve.jpg \"Test Image 1\"\n[image2]: ./results/solidWhiteRight.jpg \"Test Image 2\"\n[image3]: ./results/solidYellowCurve.jpg \"Test Image 3\"\n[image4]: ./results/solidYellowCurve2.jpg \"Test Image 4\"\n[image5]: ./results/solidYellowLeft.jpg \"Test Image 5\"\n[image6]: ./results/whiteCarLaneSwitch.jpg \"Test Image 6\"","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupertetelman%2Fsdc-lanelines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupertetelman%2Fsdc-lanelines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupertetelman%2Fsdc-lanelines/lists"}