Inspiration

Geometry and spatial measurement are often taught through static diagrams on paper or screens, which can make it difficult for students to visualize shapes and estimate real-world distances intuitively. I wanted to build an interactive, touchless computer vision tool that transforms a standard webcam into a visual geometry canvas—allowing learners to form 2D shapes using natural hand gestures and explore real-time spatial measurements without needing specialized hardware.

What it does

Hand Pose Geometry Tracker is a real-time computer vision application built with Python, OpenCV, and MediaPipe that tracks up to two hands (21 landmarks per hand) through a standard webcam. Key features include:

  • 1-Hand & 2-Hand Geometry Recognition: Detects specific finger and hand poses to render 2D geometric shapes directly on screen:
    • Circle: 1-hand "OK" gesture or 2-hand dome gesture
    • Triangle: 1-hand three-finger / acute-angle pose or 2-hand fingertip-joined pose
    • Square: 2-hand L-frame gesture
    • Heart (Love): 2-hand curved index-and-thumb gesture
  • Real-Time Spatial Distance Estimation: Calculates the distance between the thumb tip and index fingertip in both pixels and centimeters, as well as the estimated distance from the hand to the camera after a quick 50 cm calibration (k key).
  • Interactive Visualization Modes: Lets users cycle through 4 display modes (b key: full overlay, skeleton lines only, neon mode, and geometry-only) and toggle landmark node numbers (n key) to inspect how the underlying coordinate points work.

How I built it

  • Computer Vision & AI Inference: Integrated MediaPipe Hand Landmarker (hand_landmarker.task) to extract 21 3D hand coordinates per hand in real time, paired with OpenCV (cv2) for webcam capture, geometric vector math, shape rendering, and HUD overlays.
  • Pose Classification & Geometry Logic: Wrote custom geometric heuristics using Euclidean distances and relative landmark positions to distinguish between one-hand and two-hand gestures cleanly without false triggers.
  • Calibration System: Implemented a focal-length-based distance estimation formula calibrated against a 50 cm reference distance (k key) so pixel measurements dynamically convert into centimeter estimates.

Challenges I ran into

  • Overlapping Landmarks & Angle Sensitivity: When fingers overlap or tilt away from the camera, landmark coordinates can shift and cause false shape detections. I tuned distance thresholds and prioritized two-hand pose checks before single-hand checks to improve stability.
  • Scale & Depth Variation: Because apparent hand size changes depending on how far the user sits from the webcam, fixed pixel thresholds failed at different distances. Adding a quick reference calibration step solved this and enabled live centimeter estimation.

Accomplishments that I proud of

  • Achieving smooth, low-latency multi-hand tracking and shape rendering on standard CPU hardware without requiring a dedicated GPU.
  • Designing an intuitive, keyboard-driven interface (b, n, k, q) with clear visual feedback and bilingual documentation (Indonesian & English) so any student or developer can set it up in minutes.

What I learned

Building this project strengthened my understanding of real-time computer vision pipelines, vector geometry in 2D coordinate spaces, pinhole camera distance estimation, and designing responsive visual feedback for gesture-based interfaces.

What's next for Hand Pose Geometry Tracker

  • Adding support for 3D wireframe shapes (cubes, pyramids, and spheres) that rotate dynamically with hand orientation.
  • Expanding the educational HUD to display live interior angles, perimeter, and area calculations for each detected geometric shape.
  • Porting the experience to the web using MediaPipe Tasks for Web and HTML5 Canvas so students can run it directly in any browser without installing Python.

Built With

Share this project:

Updates

Submission history