A 4-wheeled autonomous robot powered by Raspberry Pi that uses classical computer vision techniques for lane detection and navigation. This project demonstrates how fundamental image processing algorithms can achieve reliable lane detection without deep learning.
- Real-time lane detection using classical computer vision
- Autonomous navigation with dynamic steering control
- Bird's-eye view transformation for precise lane analysis
- Adaptive histogram-based lane position detection
- Interactive calibration interface with trackbars
- Comprehensive visualization options for debugging
- Raspberry Pi (3B+ or 4 recommended)
- Pi Camera module
- 4-wheel robot chassis
- L298N motor driver or equivalent
- Battery power supply
- Jumper wires and breadboard
- OpenCV (cv2)
- NumPy
- RPi.GPIO
-
Clone this repository:
git clone https://github.com/roboticistjoseph/lane_detection_robot.git cd lane_detection_robot
-
Install required packages:
pip install opencv-python numpy RPi.GPIO
-
Connect hardware according to pin definitions in MotorModule.py
-
Run calibration to set up the perspective transformation:
python LaneDetection.py
Use the trackbars to adjust the transformation points until lane detection is optimal
-
Start autonomous navigation:
python MainRobot.py
The system uses a multi-stage pipeline to process camera images and control the robot:
- Image Pre-processing: Converts to HSV color space and applies thresholding to isolate lane markings
- Perspective Transformation: Applies bird's-eye view transformation for accurate lane analysis
- Histogram Analysis: Uses dual-region histogram analysis to detect lane position
- Lane Curvature Calculation: Computes the required steering angle based on lane position
- Motor Control: Translates steering commands into differential wheel speeds
MainRobot.py
- Main execution file that integrates vision and motor controlLaneDetection.py
- Implements the lane detection pipelineUtilities.py
- Helper functions for image processing and visualizationMotorModule.py
- Motor control interface for the robot
The project implements lane detection using classical computer vision techniques:
- HSV color thresholding to isolate lane markings
- Perspective transformation for bird's-eye view
- Histogram analysis for lane position detection
- Temporal filtering for stable steering control
- Adaptive sensitivity for improved turning performance
This project is licensed under the MIT License - see the LICENSE file for details.
This project demonstrates the effectiveness of classical computer vision techniques in autonomous navigation applications, proving that even without deep learning algorithms, effective autonomous systems can be developed using well-implemented fundamental approaches.