This project is inspired by the Teknofest 2025 Efficiency Challenge competition and implements one of the core ADAS (Advanced Driver Assistance Systems) functions: lane keeping. The system is designed to enable autonomous driving by processing live video from a camera mounted on a vehicle, detecting lane lines in real time, and providing steering guidance. Using OpenCV and other Python libraries, the project demonstrates how a vehicle can follow lanes autonomously, making it suitable for research, competitions, and educational purposes related to self-driving technologies.
- Lane Detection: Detects lane lines using advanced image processing techniques.
- Curve Prediction: Measures curve radius and predicts steering direction (left, right, or straight).
- Perspective Adjustment: Adjustable perspective points for different video inputs.
- Live Camera Support: Supports video input from a webcam.
- Resolution Compatibility: All processing is optimized for 1280x720 resolution.
- Visual Indicators: Marks perspective points and detected lanes on the video.
- Error Handling: Handles empty lane detection gracefully without crashing.
Ensure the following software and libraries are installed:
- Python 3.6 or higher
- OpenCV 4 or higher
- Numpy 1.20 or higher
- Matplotlib 3.3 or higher
- Clone the repository:
git clone https://github.com/your-repo/lane-detection.git
- Install the required Python libraries:
pip install opencv-python numpy matplotlib
- Video Input: The system reads video input from a file or webcam.
- Image Processing: Applies HLS filtering, grayscale conversion, thresholding, and edge detection.
- Perspective Warp: Adjusts the perspective to a bird's-eye view for better lane detection.
- Lane Detection: Uses sliding window and histogram techniques to detect lane lines.
- Curve Measurement: Calculates the radius of curvature and predicts the curve direction.
- Lane Visualization: Draws detected lanes and perspective points on the video.
- Error Handling: Displays the raw frame if lane detection fails.
readVideo(): Reads video input from a file or webcam.processImage(): Processes the image to isolate lane lines.perspectiveWarp(): Warps the perspective for better lane detection.plotHistogram(): Plots the histogram of white pixels.slide_window_search(): Detects lane lines using sliding window technique.measure_lane_curvature(): Measures the curve radius and direction.draw_lane_lines(): Visualizes detected lanes on the video.addText(): Adds curvature and deviation information to the video.
- Place your video file (
V1.mp4) in the project directory. - Run the script:
python Lane_Detection.py
- Press
Enterto stop the video playback.
- Perspective Points: Modify the
srcarray in theperspectiveWarp()function to adjust perspective points. - Lane Colors: Change the
lower_colourandupper_colourarrays inprocessImage()to detect different lane colors.
- Empty Lane Detection: If no lanes are detected, the system will display the raw frame with a warning message.
- Resolution Handling: The code automatically resizes any input to 1280x720 for optimal processing.
- Developed by Bilal Sinav
- Inspired by advanced driver assistance systems (ADAS) functions as followed in the Teknofest 2025 Efficiency Challenge competition for autonomous vehicles.
- Also inspired by Can Ozcivelek's lane detection project.
For questions or feedback, please contact Bilal Sinav.