pose_detection library
On-device pose detection and landmark estimation using TensorFlow Lite.
This library provides a Flutter plugin for real-time human pose detection using Google's MediaPipe BlazePose models. It detects persons in images and extracts 33 body landmarks (keypoints) for each detected person.
Quick Start:
import 'package:pose_detection/pose_detection.dart';
final detector = PoseDetector();
await detector.initialize();
final poses = await detector.detect(imageBytes);
for (final pose in poses) {
print('Person detected at ${pose.boundingBox}');
if (pose.hasLandmarks) {
final nose = pose.getLandmark(PoseLandmarkType.nose);
print('Nose position: (${nose?.x}, ${nose?.y})');
}
}
await detector.dispose();
Main Classes:
- PoseDetector: Main API for pose detection
- Pose: Detected person with bounding box and optional 33 landmarks
- PoseLandmark: Single body keypoint with 3D coordinates and visibility
- PoseLandmarkType: Enum of 33 body parts (nose, shoulders, knees, etc.)
- BoundingBox: Axis-aligned rectangle for person location
Detection Modes:
- PoseMode.boxes: Fast detection returning only bounding boxes
- PoseMode.boxesAndLandmarks: Full pipeline with 33 landmarks per person
Model Variants:
- PoseLandmarkModel.lite: Fastest, good accuracy
- PoseLandmarkModel.full: Balanced speed/accuracy (default)
- PoseLandmarkModel.heavy: Slowest, best accuracy
Classes
- BoundingBox
- Axis-aligned bounding box in pixel coordinates.
- PerformanceConfig
- Configuration for TensorFlow Lite interpreter performance.
- Point
- 2D integer pixel coordinate.
- Pose
- Detected person with bounding box and optional body landmarks.
- PoseDetectionDart
- Dart plugin registration for pose_detection.
- PoseDetector
- PoseLandmark
- A single body keypoint with 3D coordinates and visibility score.
- PoseLandmarks
- Collection of pose landmarks with confidence score (internal use).
Enums
- PerformanceMode
- Performance modes for TensorFlow Lite delegate selection.
- PoseLandmarkModel
- BlazePose model variant for landmark extraction.
- PoseLandmarkType
- Body part types for the 33 BlazePose landmarks.
- PoseMode
- Detection mode controlling the two-stage pipeline behavior.
Constants
-
poseLandmarkConnections
→ const List<
List< PoseLandmarkType> > - Defines the standard skeleton connections between BlazePose landmarks.