{
  "id": 22541442,
  "title": "Measuring 478 face landmarks locally with WASM and roll correction",
  "url": "https://urgent.news/2026/11/29/measuring-478-face-landmarks-locally-with-wasm-and-roll-correction",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-29T08:44:57.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/brummond_cucufate_655d0d9/measuring-478-face-landmarks-locally-with-wasm-and-roll-correction-c0n"
  },
  "original_language": null,
  "account": "Measuring facial landmarks accurately requires a reference frame separate from the camera's perspective. When an image is rotated or resized, the detected face landmarks must be converted into measurements that remain consistent. The MediaPipe Face Landmarker web API can be used to run inference on a user's device, keeping the photo out of the request. The detector's output should be converted into predictable measurements that behave correctly when the image is rotated or resized.\n\nTo test the conversion, the detector can be left off and the crop and its dimensions kept together for a single still image. One face's landmark array should be read using image mode. The detector should be set to flag group photos by default, expecting at least two faces.\n\nThe landmark array contains 478 estimated points per face, including iris points. The indices should be kept and treated as a normal outcome for zero faces. When expecting one portrait, the detector limit should be set to at least two. The original orientation should be decoded once, and if the long edge is capped at 1,024 pixels, the resized bitmap should be sent along with its width and height.\n\nThe inference bitmap remains 768 by 1,024 even when drawn at a different size by CSS. Letterboxing offset and preview reflection should be applied in the renderer only when drawing the overlay. Any blocking call should be moved off the main thread. The image-mode detection call is synchronous, but wrapping it in an async function still keeps the call on the invoking thread. The vision task should be initialized in a dedicated worker, reused across scans, and transfer an ImageBitmap when supported.\n\nThe landmark array and dimensions can be returned through a message, allowing the main thread to keep a progress indicator alive during the expensive part. The runtime and model should be loaded on demand, with the CPU path tested using the same fixture and image as the GPU path. If two requests overlap, use a request ID and drop results from earlier selections. Each bitmap should be closed when its owner has finished with it.",
  "summary": "A face overlay can look perfectly attached to a photo and still give the wrong eye angle. Draw a line through the corners of one eye, rotate the same image by ten degrees, and the line rotates with it. If a report changes simply because someone held the phone at an angle, the reported number belongs to the camera frame. The geometry needs its own reference frame. A browser implementation has two…",
  "summary_source": "publisher",
  "key_points": [
    "MediaPipe Face Landmarker runs inference on user's device",
    "Landmark array contains 478 points per face",
    "Vision task initialized in dedicated worker"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}