A collection of real-time computer vision scripts built while learning OpenCV and MediaPipe. Webcam-based, runs locally, no cloud APIs.
Uses MediaPipe Face Mesh (468 landmarks) to measure facial proportions in real time and compare them against the Golden Ratio (φ = 1.618). Computes eye distance, nose-mouth distance, and mouth-chin distance, then outputs a harmony score of 5, 7, or 9.
python face_harmony.pyPress
ESCto exit
Dependencies: opencv-python, mediapipe
Detects faces using a Haar Cascade classifier, then runs each detected face through DeepFace to get the dominant emotion (happy, sad, angry, surprise, fear, disgust, neutral). Draws a labelled bounding box on each face.
python face_mood.pyPress
qto exit
Dependencies: opencv-python, deepface
Uses MediaPipe Hands to track hand landmarks and measure the real-world distance (in cm) between your thumb tip and index finger tip. Requires a one-time calibration step — hold a known 10 cm object between your fingers and press c.
python finger_distance.pyPress
cto calibrate ·ESCto exit
Dependencies: opencv-python, mediapipe
Loads YOLOv5s via torch.hub and runs it on your webcam feed. Draws bounding boxes and class labels on every detected object in real time. Uses the small YOLOv5s model for speed — swap to yolov5m or yolov5l if you have the GPU for it.
python object_detection.pyPress
qto exit
First run downloads YOLOv5 weights automatically (~14 MB)
Dependencies: opencv-python, torch, torchvision
Select any object in the webcam frame using a drag-and-drop ROI selector, and the CSRT tracker will follow it. Shows "Tracking" in green when locked on, "Lost" in red when it loses the object.
python tracking.pyDraw a box around the object to track · Press
qto exit
Dependencies: opencv-python
# Clone the repo
git clone https://github.com/Smokey8979/Open-cv.git
cd Open-cv
# Install dependencies
pip install -r requirements.txtPython 3.9+ recommended. All scripts use your default webcam (cv2.VideoCapture(0)).
opencv-python>=4.8.0
mediapipe>=0.10.0
deepface>=0.0.79
torch>=2.0.0
torchvision>=0.15.0
deepfacepulls in TensorFlow — takes a while to install. If you only need the other scripts, skip it.
opencv · mediapipe · yolov5 · deepface · computer-vision · face-detection · emotion-detection · object-detection · object-tracking · hand-tracking · python · real-time
MIT — do whatever you want with it.