How devthayron/parking-vision works
Purpose and principal workflow
Parking Vision classifies configured parking spaces as free or occupied in each frame of a video, then overlays the classifications and available-space count and saves a result video. The workflow is initiated when an operator runs python main.py; a separate operator-run calibration workflow defines the parking regions.
Components
Video processing
• Operator — Path: null (external actor). Runs the command-line application, can quit with Q, and may run the separate calibration command.
• CLI runner — Path: main.py. Loads the saved space definitions and orchestrates video capture, per-frame detection, overlays, display, and output writing.
• Input video — Path: media/video.mp4. Repository-provided video used as the documented default processing input.
• Occupancy detector — Path: detector.py. Converts frames to a filtered binary image, counts detected pixels within each configured bounding box, and classifies and annotates each space using the threshold.
• Result video — Path: null (generated output). The runner writes annotated frames to the configured output video; the README documents media/video_result.mp4.
Space calibration and state
• Region calibration tool — Path: setup_spaces.py. Lets an operator select parking-space rectangles from an image, assigns IDs, and saves the resulting definitions.
• Space definitions — Path: spaces.pkl. Pickled IDs and bounding boxes are the persistent input shared by calibration and video processing.
Relationships
• Operator -> CLI runner: starts the main workflow by running python main.py.
• CLI runner -> Space definitions: reads the serialized parking-space definitions before processing; reports an error and exits if the file is missing or invalid.
• CLI runner -> Input video: opens the configured video and reads frames until the video ends or the operator quits.
• CLI runner -> Occupancy detector: calls detection for each frame with the loaded space definitions.
• Occupancy detector -> CLI runner: returns the available-space count and processed image; it also annotates the input frame with per-space labels and status rectangles.
• CLI runner -> Result video: writes each annotated frame and displays it during processing.
• Operator -> Region calibration tool: starts the separate region-definition workflow by running python setup_spaces.py.
• Region calibration tool -> Space definitions: writes selected IDs and bounding boxes when at least one space is selected.
Coverage limits
The sampled source establishes the video-processing and calibration flows. The configured parking-image path is not present in the supplied tree, and the README’s alternative-video workflow is not traced beyond configuration; details of those inputs are therefore not established here.
Main entry points: main.py CLI Runner · detector.py Occupancy Detector · setup_spaces.py Region Calibration · spaces.pkl Space Definitions
Components 7
Video Processing
- CLI Runner
main.py - Input Video
media/video.mp4 - Occupancy Detector
detector.py - Result Video
Calibration and State
- Region Calibration
setup_spaces.py - Space Definitions
spaces.pkl
Other components
- Operator
Connections 8
- Operator → CLI Runner: runs
- CLI Runner → Space Definitions: reads
- CLI Runner → Input Video: opens and reads
- CLI Runner → Occupancy Detector: detects each frame
- Occupancy Detector → CLI Runner: returns results
- CLI Runner → Result Video: writes frames
- Operator → Region Calibration: runs
- Region Calibration → Space Definitions: writes