This is a snippet of a Flutter iOS Method Channel for Pose Detection using MLKit.
RPReplay_Final1687757878.mov
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.
- Real-time pose detection
- Extract 33 skeletal landmark points
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.
This project is licensed under the MIT License.