HandLandmarker class final
Google's Hand Landmarker: 21 landmarks per hand, in image and world space, with handedness.
One class on every platform. Google's native runtime serves it on a worker isolate on Android, iOS, macOS, Linux and Windows; its browser runtime serves it through the registered web plugin.
final task = await HandLandmarker.create(
HandLandmarkerOptions(model: VisionModels.handLandmarker),
);
final result = await task.detect(VisionImage.fromFile('photo.jpg'));
await task.dispose();
Calls run one at a time, in call order. A Future cannot cancel native
work; dispose() waits for work already accepted and is idempotent.
- Implemented types
Properties
- delegate → Delegate
-
The processor the task runs on, fixed at creation.
final
- droppedFrames → int
-
Frames detectAsync accepted but never ran; always 0 in the other modes.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
results
→ Stream<
HandLandmarkerResult> -
The result of each frame detectAsync runs, in timestamp order. Listen
before the first frame. One subscription: pausing buffers results and
cancelling discards later ones. A failure arrives as a TaskException,
ends the stream and fails every later call.
dispose()delivers the frame in flight and the waiting one, then closes the stream. Live stream mode only.no setter - runningMode → RunningMode
-
The mode the task was created in.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
detect(
VisionImage image, {int rotationDegrees = 0}) → Future< HandLandmarkerResult> -
Locates hand landmarks in a still image.
rotationDegreesis clockwise and a multiple of 90. -
detectAsync(
VisionImage image, {required int timestampMilliseconds, int rotationDegrees = 0}) → void - Locates hand landmarks in a camera frame in RunningMode.liveStream and returns at once; the result arrives on results. As in Google's runtime, one frame runs at a time and the newest one waits: a frame submitted while another waits replaces it, and droppedFrames counts the replaced ones. Timestamps are nonnegative milliseconds that strictly increase in call order, and a dropped frame's timestamp stays reserved. A failed check throws here.
-
detectForVideo(
VisionImage image, {required int timestampMilliseconds, int rotationDegrees = 0}) → Future< HandLandmarkerResult> - Locates hand landmarks in a video frame. Requires RunningMode.video; timestamps are nonnegative milliseconds that strictly increase in call order.
-
dispose(
) → Future< void> -
Finishes accepted work and releases Google's task. Repeated calls return
the same completion; any other call afterwards throws StateError.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
create(
HandLandmarkerOptions options) → Future< HandLandmarker> - Resolves the model and opens Google's task off the calling isolate.