{"id":36974762,"url":"https://github.com/cornpip/mediapipe_face_mesh","last_synced_at":"2026-05-19T08:13:46.626Z","repository":{"id":330850331,"uuid":"1116231418","full_name":"cornpip/mediapipe_face_mesh","owner":"cornpip","description":"Flutter FFI bridge for MediaPipe Face Mesh (468-point face landmark detection).","archived":false,"fork":false,"pushed_at":"2026-01-12T02:11:46.000Z","size":62391,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-12T07:10:39.979Z","etag":null,"topics":["flutter","mediapipe-facemesh","pub-dev"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/mediapipe_face_mesh","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cornpip.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-14T13:14:52.000Z","updated_at":"2026-01-12T02:14:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cornpip/mediapipe_face_mesh","commit_stats":null,"previous_names":["cornpip/mediapipe_face_mesh"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cornpip/mediapipe_face_mesh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cornpip%2Fmediapipe_face_mesh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cornpip%2Fmediapipe_face_mesh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cornpip%2Fmediapipe_face_mesh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cornpip%2Fmediapipe_face_mesh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cornpip","download_url":"https://codeload.github.com/cornpip/mediapipe_face_mesh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cornpip%2Fmediapipe_face_mesh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28400397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutter","mediapipe-facemesh","pub-dev"],"created_at":"2026-01-13T22:02:06.212Z","updated_at":"2026-05-19T08:13:46.618Z","avatar_url":"https://github.com/cornpip.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mediapipe_face_mesh\n\nBundled files:\n- TensorFlow Lite C runtime binaries for Android (`arm64-v8a`, `x86_64`) and iOS\n- [MediaPipe TFLite model](https://github.com/google-ai-edge/mediapipe/blob/master/docs/solutions/models.md)\n  - face mesh\n  - iris\n  - short-range face detection\n  - full-range dense and sparse face detection\n\n\u003cimg src=\"./readme_img/2.png\" alt=\"app_image_2\" width=\"300\"/\u003e \u003cimg src=\"./readme_img/3.gif\" alt=\"app_image_2\" width=\"300\"/\u003e\n\n## Supported Platforms\n\n- Android(arm64-v8a, x86_64)\n- iOS\n- Dart SDK: `\u003e=3.8.1 \u003c4.0.0`\n\n## Install\n\n```bash\nflutter pub add mediapipe_face_mesh\n```\n\n## Usage\n\n### Create Face Detector Processor\n\n```dart\nimport 'package:mediapipe_face_mesh/mediapipe_face_mesh.dart';\n\nfinal faceDetectorProcessor = await FaceDetectorProcessor.create(\n  model: FaceDetectionModel.fullRange,\n  delegate: FaceMeshDelegate.xnnpack,\n  maxResults: 1,\n  roiScaleY: 1.7,\n  roiShiftY: -0.2,\n);\n```\n`FaceDetectionModel` selects the bundled detector model:\n`shortRange` is the default short-range BlazeFace model, `fullRange` is the\ndense full-range model, and `fullRangeSparse` is the sparse full-range model.\n\nROI options adjust the detector-produced `expandedFaceRect`, which is passed to\nface mesh while keeping the original frame unchanged.\n\n### Create Face Mesh Processor\n\n```dart\nimport 'package:mediapipe_face_mesh/mediapipe_face_mesh.dart';\n\nfinal faceMeshProcessor = await FaceMeshProcessor.create(\n  delegate: FaceMeshDelegate.xnnpack,\n  enableSmoothing: true,\n  enableRoiTracking: true,\n  enableIris: true, // default is false; true returns 478 landmarks with 10 iris points\n);\n```\n\nWhen `enableIris` is enabled, Face Mesh runs an additional iris landmark pass\nafter the base 468-point face mesh result. The final result keeps the existing\nFace Mesh index layout, updates the eye-region landmarks with more precise eye\ncontour coordinates, and appends 10 iris landmarks at indices `468..477`.\n\nDelegate options:\n- `FaceMeshDelegate.cpu` (default)\n- `FaceMeshDelegate.xnnpack`\n- `FaceMeshDelegate.gpuV2`\n\nIf the requested delegate is unavailable or fails to initialize, the native\nruntime falls back to CPU inference.\n\n### Input Formats\n\nThe package supports two image input types:\n\n- `FaceMeshNv21Image`\n  Use this for Android camera frames in NV21 layout.\n- `FaceMeshImage`\n  Use this for RGBA or BGRA buffers. This is used for iOS camera frames.\n\n### Stream Inference\n\nUse stream inference when processing continuous camera frames. Stream processors\ntake a Stream of frames and return a Stream of results.\n\n```dart\nfinal pipeline = FaceMeshInferencePipeline(\n  detector: faceDetectorProcessor,\n  mesh: faceMeshProcessor,\n);\nfinal inferenceStreamProcessor = FaceMeshInferenceStreamProcessor(pipeline);\nfinal frameController = StreamController\u003cFaceMeshNv21Image\u003e();\nbool _isBusy = false;\n\ninferenceStreamProcessor\n    .processNv21(\n      frameController.stream,\n      runMeshResolver: (_) =\u003e _isMeshActive,\n      rotationDegrees: rotationDegrees,\n    )\n    .listen(_handleInferenceResult, onError: onError);\n\nvoid _handleInferenceResult(FaceMeshInferenceResult result) {\n  _isBusy = false;\n  onDetections(result.detectionResult);\n  onMeshResult(result.meshResult);\n}\n\nvoid onCameraFrame(FaceMeshNv21Image frame) {\n  if (_isBusy) return;\n  _isBusy = true;\n  frameController.add(frame);\n}\n```\n\nUse `runMesh: false` when an entire stream should run detector-only. Use\n`runMeshResolver` when mesh execution should be decided per frame, such as a UI\ntoggle that can change while the stream is active.\n\nFor BGRA / RGBA input, use `process(...)` instead of `processNv21(...)`.\n\n### Single Inference\n\nUse single-frame inference in one call without a stream processor.\n\n```dart\nfinal pipeline = FaceMeshInferencePipeline(\n  detector: faceDetectorProcessor,\n  mesh: faceMeshProcessor,\n);\n\nfinal result = pipeline.processNv21(\n  nv21Image,\n  rotationDegrees: rotationDegrees,\n);\n\nfinal meshResult = result.meshResult;\nif (meshResult != null) {\n  onResult(meshResult);\n}\n```\n\nFor detector-only, set `runMesh: false`.\n\n```dart\nfinal result = pipeline.processNv21(\n  nv21Image,\n  runMesh: false,\n  rotationDegrees: rotationDegrees,\n);\n```\n\n### Close Resource\n\nExplicitly calling close() when the processors are no longer needed is recommended.\n\n```dart\nfaceDetectorProcessor.close();\nfaceMeshProcessor.close();\n```\n\n### Notes\n\nThe examples in this README use the v1.6.0+ unified inference API.\n\n`FaceMeshInferenceStreamProcessor` emits one combined result after detector and\nmesh inference complete, so detection boxes and mesh landmarks are updated\ntogether.\n\nIf you need detector boxes to update independently from slower mesh inference,\nuse `FaceDetectorStreamProcessor` and `FaceMeshStreamProcessor` separately; see\nthe [v1.5.0](https://github.com/cornpip/mediapipe_face_mesh/tree/v1.5.0) README and example app\nfor a two-stage stream pattern.\n\nThese separated stream processors are still available in v1.6.0 and later.\n\n## Example app\n\nThe example app in `example/` provides two flows:\n\nA. MediaPipe Face Detector + MediaPipe Face Mesh  \nB. ML Kit Face Detector + MediaPipe Face Mesh\n\n`B` depends on the `google_mlkit_face_detection` package for face detection.\n\n## Primary API\n\n- `FaceMeshInferencePipeline`\n  Runs face detection and face mesh inference in one call for single-frame use.\n- `FaceMeshInferenceStreamProcessor`\n  Wraps `FaceMeshInferencePipeline` in an `async*` generator — accepts a\n  `Stream` of frames and yields a `Stream` of high-level inference results.\n- `FaceMeshInferenceResult`\n  Contains detector output, selected detection, selected box/ROI, ROI\n  availability, and mesh output.\n- `FaceDetectorProcessor`\n  Runs the bundled MediaPipe short-range, full-range dense, or full-range sparse\n  face detector and returns face boxes, scores, and rotation-aware ROI values\n  such as `expandedFaceRect`.\n- `FaceMeshProcessor`\n  Runs face mesh inference and returns normalized 3D landmarks, mesh triangles,\n  the detected face rect, score, and input image size.\n- `FaceMeshNv21Image`\n  Input wrapper for Android NV21 camera frames.\n- `FaceMeshImage`\n  Input wrapper for RGBA or BGRA pixel buffers.\n- `NormalizedRect`\n  Rotation-aware normalized ROI used to restrict face mesh inference.\n- `FaceMeshBox`\n  Pixel-space bounding box that can be converted into an ROI internally.\n- `FaceMeshResult`\n  Result object containing `landmarks`, `triangles`, `rect`, `score`,\n  `imageWidth`, and `imageHeight`. Face mesh returns 468 landmarks by default,\n  or 478 landmarks when `enableIris` is enabled. Pixel-space helpers such as\n  `landmarkAsOffset(...)` and `landmarksAsOffsets(...)` support rotation and\n  horizontal mirror mapping for preview overlays.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcornpip%2Fmediapipe_face_mesh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcornpip%2Fmediapipe_face_mesh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcornpip%2Fmediapipe_face_mesh/lists"}