Face & Palm measurement reference code
The HRUM Face & Palm measurement API does not accept photos. Use the code below on the user's device to extract face and hand coordinates, and send a request that contains only the coordinates. The photo never leaves the device. See the docs for request and response details.
Files
capture.js— for the browser. Extracts coordinates with MediaPipe Tasks Vision 1.0.1 and builds the request body (buildFaceRequest,buildPalmRequest).send.mjs— for the server (Node 18 or later). Sends the request body to the API. Keep the API key on the server only.curl.sh— an example that sends it with curl.
Values that must match
| Face | Palm | |
|---|---|---|
modelName | face_landmarker | hand_landmarker |
modelVersion | float16/[email protected] | float16/[email protected] |
normalization | face-norm-1 | palm-norm-1 |
| Number of coordinates | 478 | 21 |
If any of these differ, the request is returned with 400. Don't use latest in the model URL; use the version-pinned URL from the reference code as is.
Try it yourself
Pick a photo to build a request body. This page does not send anything.
License and privacy
- MediaPipe is under the Apache License 2.0. When you include it in a product, distribute the license notice with it. MediaPipe may send usage statistics, so reflect this in your privacy policy.
- The HRUM server uses the coordinates it receives only in memory while handling the request, and does not keep them in logs, databases or error messages. As the partner, please get your end users' consent yourself.