How abhijeet1592006/distance_calculator works
Project Type and Purpose
• This is a real-time computer vision tool (open-source script) that captures video from a camera, detects yellow objects, labels them, computes inter‐object distances (in cm), and renders annotated frames to the user.
File Structure Analysis
• Top-level files:
• distance_calculator.py (main pipeline script)
• README.md (project description & instructions)
• .gitattributes (Git config)
• There are no distinct “frontend” or “backend” directories—this is a single-process, single-module application that directly ties video I/O, CV processing, and display.
Key Architectural Components
a. Video Capture
• cv2.VideoCapture: fetches raw frames from a camera device.
• Convert BGR → HSV
c. Contour Detection & Filtering
• Find contours on masked image.
• Discard small contours (area threshold > 500 px).
d. Object Labelling
• Compute bounding rect & center for each valid contour.
• Assign sequential labels (A, B, C…).
e. Distance Computation
• Compute pixel-distance between consecutive object centers (Euclidean).
• Multiply by distance_threshold (0.06912) → real-world cm.
f. Rendering / Display
-