Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Quick start script to test the lane detection system | |
| Creates a test video, processes it, and verifies the output | |
| """ | |
| import os | |
| import sys | |
| import tempfile | |
| def main(): | |
| print("=" * 60) | |
| print("OpenCV Lane Detection Demo - Quick Start") | |
| print("=" * 60) | |
| print() | |
| # Check imports | |
| print("1. Checking dependencies...") | |
| try: | |
| import cv2 | |
| print(f" β OpenCV {cv2.__version__}") | |
| except ImportError: | |
| print(" β OpenCV not found. Run: pip install opencv-python") | |
| sys.exit(1) | |
| try: | |
| import numpy as np | |
| print(f" β NumPy {np.__version__}") | |
| except ImportError: | |
| print(" β NumPy not found. Run: pip install numpy") | |
| sys.exit(1) | |
| print() | |
| # Create test video | |
| print("2. Creating test video...") | |
| from create_test_video import create_test_video | |
| temp_dir = tempfile.gettempdir() | |
| input_video = os.path.join(temp_dir, "quickstart_input.mp4") | |
| output_video = os.path.join(temp_dir, "quickstart_output.mp4") | |
| create_test_video(input_video, duration_sec=2, fps=15) | |
| print() | |
| # Process video | |
| print("3. Processing video with lane detection...") | |
| from lane_detection import process_video | |
| success = process_video(input_video, output_video) | |
| if not success: | |
| print(" β Processing failed!") | |
| sys.exit(1) | |
| print(f" β Processing complete!") | |
| print() | |
| # Verify output | |
| print("4. Verifying output...") | |
| if os.path.exists(output_video): | |
| size = os.path.getsize(output_video) | |
| print(f" β Output file created: {output_video}") | |
| print(f" β File size: {size:,} bytes") | |
| else: | |
| print(" β Output file not found!") | |
| sys.exit(1) | |
| print() | |
| print("=" * 60) | |
| print("β SUCCESS! Lane detection system is working correctly.") | |
| print("=" * 60) | |
| print() | |
| print("Next steps:") | |
| print(" β’ Run Gradio UI: python app.py") | |
| print(" β’ Use CLI tool: python cli.py <input> <output>") | |
| print(" β’ Run tests: python test_lane_detection.py") | |
| print() | |
| if __name__ == "__main__": | |
| try: | |
| main() | |
| except Exception as e: | |
| print(f"\nβ Error: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| sys.exit(1) | |