Skip to content

GauthamPrabhuM/LaneDetection

Repository files navigation

Autonomous Lane Detection System

A rule-based computer vision pipeline for detecting lane boundaries using edge detection, region filtering, and polynomial regression, with LiDAR support for poor lighting conditions.

Features

  • Edge Detection: Canny edge detection with Gaussian blur preprocessing
  • Region of Interest: Dynamic ROI filtering for lane-relevant areas
  • Hough Transform: Line detection using probabilistic Hough transform
  • Polynomial Fitting: 2nd-degree polynomial regression for smooth lane curves
  • LiDAR Integration: Point cloud processing to supplement visual data
  • Real-time Processing: Video and webcam support

Tech Stack

  • Python
  • OpenCV
  • NumPy
  • Point Cloud Library (PCL) concepts

Autonomous Lane Detection System

A simple, rule-based lane detection pipeline written in Python using OpenCV and NumPy. The project demonstrates a classic computer vision approach: preprocessing, edge detection, region masking, line extraction with Hough transform, and polynomial fitting to draw smooth lane overlays on video frames.

Contents

  • lane_detection.py — Main lane detection pipeline (video/webcam)
  • lidar_functions.py — LiDAR-related helpers (if present)
  • requirements.txt — Python dependencies

Quickstart

  1. (Optional) Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the detector from a webcam:
python lane_detection.py

Or run on a video file:

python lane_detection.py path/to/video.mp4

Press q to quit the preview window.

Requirements

  • Python 3.8+
  • opencv-python
  • numpy

See requirements.txt for exact packages.

How it works (short)

  1. Convert frames to grayscale and blur to reduce noise.
  2. Run Canny edge detection and mask the image to a trapezoidal ROI.
  3. Detect line segments with the probabilistic Hough transform.
  4. Separate left/right candidate lines by slope and position.
  5. Fit a 2nd-degree polynomial to each lane side for a smooth curve.
  6. Draw lane lines and a filled lane region overlay on the original frame.

Parameters you can tune

  • Canny thresholds (currently 50, 150)
  • Gaussian blur kernel size
  • Hough transform params: rho, theta, threshold, minLineLength, maxLineGap
  • Slope filtering threshold (used when separating left/right lines)

AI Assistance

This README and non-functional cleanups were produced with assistance from the AI tool GitHub Copilot. The core project code and algorithm design remain the repository owner's work. AI was used to help improve documentation and add a dependency file.

Next steps / Suggestions

  • Add unit tests and small sample videos under tests/.
  • Add a CLI flag to save output video or images.
  • Add more robust temporal smoothing for fitted lane curves.

If you'd like, I can help prepare a branch and push these changes to the remote repository (you'll need to run the git commands locally or provide remote access).

About

Lane detection algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors