{"id":17259383,"url":"https://github.com/sshleifer/carnd-lanelines-p5","last_synced_at":"2026-06-12T16:32:25.616Z","repository":{"id":74359199,"uuid":"104664159","full_name":"sshleifer/carnd-lanelines-p5","owner":"sshleifer","description":"Lane Line Finder on a Video Stream using s channel gradients","archived":false,"fork":false,"pushed_at":"2017-10-01T19:27:05.000Z","size":189325,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-24T08:44:01.640Z","etag":null,"topics":["image-processing","self-driving-car"],"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/sshleifer.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,"zenodo":null}},"created_at":"2017-09-24T17:46:56.000Z","updated_at":"2017-09-26T03:10:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"cabed324-debc-4973-adae-e6c6fe33da6d","html_url":"https://github.com/sshleifer/carnd-lanelines-p5","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sshleifer/carnd-lanelines-p5","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshleifer%2Fcarnd-lanelines-p5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshleifer%2Fcarnd-lanelines-p5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshleifer%2Fcarnd-lanelines-p5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshleifer%2Fcarnd-lanelines-p5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshleifer","download_url":"https://codeload.github.com/sshleifer/carnd-lanelines-p5/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshleifer%2Fcarnd-lanelines-p5/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34253930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["image-processing","self-driving-car"],"created_at":"2024-10-15T07:25:42.907Z","updated_at":"2026-06-12T16:32:25.611Z","avatar_url":"https://github.com/sshleifer.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Finding Lane Lines\n\n---\n\n**Advanced Lane Finding Project**\n\nThe goals / steps of this project are the following:\n\n* Compute the camera calibration matrix and distortion coefficients given a set of chessboard images.\n* Apply a distortion correction to raw images.\n* Use color transforms, gradients, etc., to create a thresholded binary image.\n* Apply a perspective transform to rectify binary image (\"birds-eye view\").\n* Detect lane pixels and fit to find the lane boundary.\n* Determine the curvature of the lane and vehicle position with respect to center.\n* Warp the detected lane boundaries back onto the original image.\n* Output visual display of the lane boundaries and numerical estimation of lane curvature and vehicle position.\n\n[//]: # (Image References)\n\n[image1]: ./examples/undistort_output.png \"Undistorted\"\n[image2]: ./examples/undistort_output1.jpg \"Undistorted Road\"\n[image3]: ./examples/binary_combo_example.jpg \"Binary Example\"\n[image4]: ./examples/warped_straight_lines.jpg \"Warp Example\"\n[image5]: ./examples/color_fit_lines.jpg \"Fit Visual\"\n[image6]: ./examples/example_output.jpg \"Output\"\n[video1]: ./project_video.mp4 \"Video\"\n\n## [Rubric](https://review.udacity.com/#!/rubrics/571/view) Points\n\n### Briefly state how you computed the camera matrix and distortion coefficients. Provide an example of a distortion corrected calibration image.\n\nThe code for this step is contained in the first code cell of the IPython notebook located in \"p5.ipynb\" under the first header and follows closely from the lecture. We assume object points are the corners of the chessboard in the real world (so 0,0,0, for example), and then, for each chessboard image, store the imagepoints, the result of `cv2.findChessboardCorners` We then call `calibrateCamera` to learn a mapping from object points to image points, and then `cv2.undistort` to use the mapping to remove the distortion from other images. The result is below:\n![alt text][image1]\n### Pipeline (single images)\n\n#### 1. Provide an example of a distortion-corrected image.\n![alt text][image2]\n#### 2. Describe how (and identify where in your code) you used color transforms, gradients or other methods to create a thresholded binary image.  Provide an example of a binary image result.\n\nlane_lines.sobel_utils.get_threshd_image at line 51, contains the final filter I used, all other filters are in that module. The code borrows heavily from the lecture but deletes some lines by making numpy masks in one step with the `apply_threshold` helper.\n\n\nThe preprocesisng pipeline works as follows:\n  - convert to LHS and extract S channel\n  - use cv2.sobel to filter to pixels where the x or y derivate is between 10 and 160\n    - (implemented but did not use magnitude and direction threshold)\n![alt text][image3]\n#### 3. Describe how (and identify where in your code) you performed a perspective transform and provide an example of a transformed image.\n\nThe code for my perspective transform is run by the `warp` function but leverages `M` and `Minv` created in the notebook\nThe `warper()` function takes as inputs an image (`img`), as well as source (`src`) and destination (`dst`) points.  I chose to hardcode the source and destination points by looking at an image:\n\n| Source        | Destination   |\n|:-------------:|:-------------:|\n| 585, 455      | 200, 0        |\n| 705, 455      | 1080, 0       |\n| 1130, 720     | 1080, 720     |\n| 190, 720      | 1080, 0       |\n\nThe lane lines do, in fact look reasonably straight after warping:\n![alt text][image4]\n#### 4. Describe how (and identify where in your code) you identified lane-line pixels and fit their positions with a polynomial?\n![alt text][image5]\nFirst, we choose the starting columns for a window by looking at the columns of the binary image with the largest sums to the left and right of the middle of the image, and creating of 100 pixels around that peak column. (we assume car currently in lane :))\n\nFor each side,  starting from the first (lowest green) box,\nwe collect the (y,x) pairs that are nonzero and in the box. This is our line. We then start the next box at the average x point in the image.\nWe collect points and build 9 boxes up the image in this way. And then estimate the true position of the lane line by fitting a 2 degree polynomial to all collected points. The resulting polynomial is indicated by the yellow lines.\n\n\n#### 5. Describe how (and identify where in your code) you calculated the radius of curvature of the lane and the position of the vehicle with respect to center.\n\n\nCurvature is estimated as in the lecture notes\n```{py}\ndef get_curvature(a, b, y):\n    numer = (1 + (2*a*y+b)**2)**1.5\n    denom = np.abs(2*a)\n    return numer / denom\n```\n\nWe find the vehicle's position in the lane by assuming it is in the middle of the image, and then seeing where in the image the lane lines are. Implementation is in `lane_lines/fit_poly.py` `get_offset` function.\n\n\n#### 6. Provide an example image of your result plotted back down onto the road such that the lane area is identified clearly.\n\nI copied code to draw lines on the image from the lecture.\n![alt text][image6]\n---\n\n### Pipeline (video)\n\n#### 1. Provide a link to your final video output.  Your pipeline should perform reasonably well on the entire project video (wobbly lines are ok but no catastrophic failures that would cause the car to drive off the road!).\n\nHere's a [link to my video result](./my_project_video.mp4)\n---\n\n### Discussion\n\n#### 1. Briefly discuss any problems / issues you faced in your implementation of this project.  \n\nMy implementation follows fairly directly from the lecture notes, with the only large discrepancies being only using the x and y gradient thresholds and coding the numpy masks more cleanly. The latter deviation caused my largest bug, where warping the binary image was causing my jupyter kernel to crash because the mask was `int64` instead of `uint8`.\n\n#### Where will your pipeline likely fail?  \n\nThe pipeline's current state is that it does not fail catastrophically in the first video, but wobbles around second 43. Implementing outlier rejection and/or smoothing did not initially help, presumably, but inspecting the binary_warped image at this time step (and for most of the challenge video) revealed utter chaos. It is likely to fail when that car is in one of the middle lanes, or the beginning of a lane line is obfuscated (throwing off the second window start).\n\n#### What could you do to make it more robust?\nNext steps that might fix the wobble and improve performance on the challenge video include:\n- restrict histogram peak search (do not look for windows far from center\n- use gradient direction and magnitude filters (already implemented!)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshleifer%2Fcarnd-lanelines-p5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshleifer%2Fcarnd-lanelines-p5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshleifer%2Fcarnd-lanelines-p5/lists"}