Devatva24/Lane-Detection
Real-time lane detection system using OpenCV and Python for autonomous vehicle applications
๐ฃ๏ธ Lane Detection System
Real-time Lane Detection using Computer Vision
Features โข Demo โข Installation โข Usage โข How It Works โข Contributing
๐ Overview
A robust lane detection system that identifies and tracks road lane markings in real-time using computer vision techniques. This project processes video streams from dashcam footage and overlays detected lane boundaries, providing a visual guide for autonomous vehicle systems or driver assistance applications.
โจ Features
- ๐ฅ Real-time Processing - Processes video streams with minimal latency
- ๐ฏ Accurate Detection - Uses advanced edge detection and Hough transforms
- ๐ผ๏ธ Region of Interest (ROI) - Focuses on relevant road areas for improved performance
- ๐ Lane Overlay - Visual representation of detected lanes on original footage
- โก Efficient Algorithm - Optimized for performance on standard hardware
- ๐ง Configurable Parameters - Easy tuning for different road conditions
๐ฌ Demo
The system processes dashcam footage and outputs video with detected lane markings highlighted in real-time.
Input: Road view from vehicle camera (road_car_view.mp4)
Output: Processed video with lane overlay (out.gif)
๐ Installation
Prerequisites
- Python 3.7 or higher
- pip package manager
Setup
-
Clone the repository
git clone https://github.com/Devatva24/Lane-Detection.git cd Lane-Detection -
Install required dependencies
pip install opencv-python numpy matplotlib
๐ป Usage
Running the Lane Detection
python lane_detection_codespace.pyThe script will:
- Load the input video file (
road_car_view.mp4) - Process each frame to detect lane markings
- Save the output with detected lanes
Customization
You can modify parameters in the script to adjust:
- Canny edge detection thresholds
- Hough transform parameters
- Region of interest coordinates
- Line drawing style and color
๐ฌ How It Works
The lane detection pipeline consists of several key steps:
1. Preprocessing
- Convert frames to grayscale
- Apply Gaussian blur to reduce noise
2. Edge Detection
- Use Canny edge detection to identify lane boundaries
- Highlight areas with significant intensity changes
3. Region of Interest
- Define a polygonal mask to focus on the road area
- Filter out irrelevant portions of the image
4. Line Detection
- Apply Hough transform to detect straight lines
- Identify lane markings from detected edges
5. Lane Extrapolation
- Average and extrapolate detected line segments
- Create smooth, continuous lane boundaries
6. Overlay & Output
- Draw detected lanes on the original frame
- Combine with input video for final output
๐ Project Structure
Lane-Detection/
โโโ lane_detection_codespace.py # Main detection script
โโโ road_car_view.mp4 # Sample input video
โโโ out.gif # Output demonstration
โโโ README.md # Project documentation
โโโ .gitignore # Git ignore rules
โโโ .gitattributes # Git attributes
๐ ๏ธ Technologies Used
- Python - Core programming language
- OpenCV - Computer vision library for image processing
- NumPy - Numerical computing for array operations
- Matplotlib - Visualization and debugging (optional)
๐ Future Enhancements
- Curved lane detection using polynomial fitting
- Multi-lane detection support
- Night-time and adverse weather conditions
- Real-time webcam input support
- Integration with deep learning models (YOLO, U-Net)
- Lane departure warning system
- Performance optimization using GPU acceleration
๐ค Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Author
Devatva24
- GitHub: @Devatva24
๐ Acknowledgments
- Inspired by autonomous vehicle research and ADAS systems
- Built using open-source computer vision libraries
- Special thanks to the OpenCV community
โญ If you find this project useful, please consider giving it a star!
Made with โค๏ธ and Python
