DEV Community

Dipankar Das
Dipankar Das

Posted on

I turned my gesture calculator hobby project into a pip package — so you can detect and use hand gestures in your project in just 3 lines of Python code

Built a gesture-controlled calculator a while back using MediaPipe. Extracted the detection logic into a standalone library so anyone can add gesture recognition to their project without touching CV code.

from mp_gesture_lib import GestureDetector
detector = GestureDetector()          # bundled model, zero config
result = detector.detect(frame)       # pass any BGR webcam frame
print(result.gesture, result.confidence)
Enter fullscreen mode Exit fullscreen mode

What it detects out of the box:

  • Finger count 1–10 (geometry-based, no ML)
  • Math ops: plus, minus, multiply, divide, equal, clear (ML model, bundled)
  • Two-hand rules for plus/multiply (landmark geometry)
  • Returns "unknown" cleanly when nothing matches

Custom model support — drop your own .task file, it's checked first. Bundled model is fallback. Any label passes through raw, no hard-coded mapping.

pip install mp-gesture-lib

📖 Docs: debabratasaha-dev.github.io/mp-gesture-lib-package

🐙 GitHub: github.com/debabratasaha-dev/mp-gesture-lib-package

Feedback welcome — especially on the gesture pipeline priority logic. If you find it useful, I’d really appreciate a ⭐️ on GitHub!

Top comments (0)