Spaces:
Sleeping
Sleeping
File size: 2,349 Bytes
06417df f4c30f7 06417df f4c30f7 06417df f4c30f7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
#!/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)
|