gesture-recognition Β· vision Β· MediaPipe Β· ~8 MB
MediaPipe's GestureRecognizer finds a hand and classifies it into one of eight built-in
gestures β π Thumb_Up, π Thumb_Down, βοΈ Victory, β Closed_Fist, β Open_Palm,
βοΈ Pointing_Up, π€ ILoveYou, or None β with a confidence score, and hands you the 21
hand landmarks too. It's a real downloadable .task model that runs on-device via
WebAssembly (with a GPU delegate when available). Drop a photo or turn on your webcam.
| Model | MediaPipe GestureRecognizer (Google) |
|---|---|
| Runtime | MediaPipe Tasks Vision (@mediapipe/tasks-vision) β .task bundle |
| Output | Top gesture + score per hand, 8 classes, plus 21 hand landmarks & handedness |
| Hands | 1 by default (configurable via numHands) |
| Delegate | GPU when a WebGPU/WebGL adapter exists, otherwise CPU (XNNPACK) |
| Download | ~8 MB .task file, cached by the browser after first load |
| License | Apache-2.0 (Google MediaPipe) |
| Web APIs | WebAssembly, Canvas, getUserMedia β all Baseline widely available |
Pick a sample hand, drop your own photo, or use your webcam. The recognised gesture and its score show up big; the 21 landmarks are drawn on the canvas.
The model returns a ranked list of gesture scores for each hand, plus which hand it is (handedness) and how confident that call is. Below is the full ranking for the first detected hand β every class the model scored, highest first, exactly as returned.
| # | gesture | score |
|---|
A named gesture is a ready-made button. GestureRecognizer turns "what is the hand doing?" into a single local call β no training data, no depth camera, no cloud. Eight canonical gestures cover a surprising amount of UI: yes/no, next/back, select, stop.
Name the gesture in a sample photo and read the full class ranking β feel what the model returns.
A gesture remote: map π β β βοΈ to real UI actions and watch the app respond, live.
Rock-paper-scissors against the computer β throw a gesture and it plays back.
Gesture + Face: a reaction cam that names your gesture while it tracks your expression.
MediaPipe Tasks loads a .task bundle and gives you a recognizer you call per image or per video frame:
import { FilesetResolver, GestureRecognizer } from "@mediapipe/tasks-vision";
const vision = await FilesetResolver.forVisionTasks(".../wasm");
const rec = await GestureRecognizer.createFromOptions(vision, {
baseOptions: {
modelAssetPath: ".../gesture_recognizer.task", // ~8 MB
delegate: "GPU", // or "CPU"
},
numHands: 1,
runningMode: "IMAGE", // or "VIDEO"
});
const result = rec.recognize(imageElement);
// result.gestures β [ [ { categoryName:"Thumb_Up", score } , β¦ ] , β¦ ] (ranked per hand)
// result.landmarks β [ [ {x,y,z} Γ 21 ], β¦ ] (normalized 0β1)
// result.handedness β [ [ { categoryName:"Right", score } ], β¦ ]
This page loads the model through the showcase's shared auto-init loader and draws the landmarks on a canvas; for the webcam it switches the task to VIDEO mode and calls recognizeForVideo each frame.