-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
34 lines (28 loc) · 998 Bytes
/
main.py
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
"""Main entry point for the vehicle speed detection system"""
import sys
import os
import logging
from video_processor import VideoProcessor
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def main():
try:
# Get video source
if len(sys.argv) > 1:
video_source = sys.argv[1]
if not os.path.exists(video_source):
logger.error(f"Video file not found: {video_source}")
return
else:
video_source = 0 # Default to webcam
print("Vehicle Speed Detection System")
print("------------------------------")
print(f"Source: {'Webcam' if video_source == 0 else video_source}")
print("Press 'q' to quit")
processor = VideoProcessor(video_source)
processor.process_video()
except Exception as e:
logger.error(f"Application error: {str(e)}")
sys.exit(1)
if __name__ == "__main__":
main()