Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Latest commit

 

History

History
52 lines (35 loc) · 1.46 KB

README.md

File metadata and controls

52 lines (35 loc) · 1.46 KB

MLKitPoseDetection

This is a snippet of a Flutter iOS Method Channel for Pose Detection using MLKit.

RPReplay_Final1687757878.mov

Introduction

The snippet in this repository allows Flutter apps to leverage the capabilities of Google's ML Kit's Pose Detection API. The package supports pose detection in "real-time". Note that there is notable latency using this implementation strategy, hence the "real time" in quotes.

Features

  • Real-time pose detection
  • Extract 33 skeletal landmark points

Installation

To use this package, add MLKitPoseDetection as a dependency in your podfile.

Assemble these files in your codebase as you see fit, then in a Stateful widget, include this snippet:

...
late List<Offset> results = [];

@override
void initState() {
  super.initState();

  try {
    widget.cameraController!.startVideoRecording(onAvailable: (image) async {
      final data = await widget.inferenceService.getPoseDetection(image);
      if (mounted && data is List<Offset> && data.isNotEmpty) {
        setState(
          () => results = data,
        );
      }
    });
  } catch (e) {
    log("An error occured in the Inference Preview $e");
  }
}
...

Finally, use the widget.cameraController in a CameraPreview widget.

License

This project is licensed under the MIT License.