platform_interface library

Where the browser plugin plugs Google's JavaScript runtime into the vision task classes: the backend interfaces and factories, and the decoder its results go through. The Android plugin installs only the GPU name reader.

Applications should import mediapipe_vision.dart instead.

Classes

InteractiveSegmenterBackend
One stateful Interactive Segmenter session on an official platform SDK: an image, then complete stroke histories, in submission order.
VisionResultData
A result as an adapter delivers it.
VisionTaskBackend<R>
A serialized, asynchronous adapter to one task of Google's browser runtime, on a worker.
VisionTaskOverlayBackend
A backend that can draw its results into a browser canvas on its worker.

Constants

packedLandmarkStride → const int
Doubles per packed point.

Properties

faceDetectorBackendFactory ↔ VisionBackendFactory<FaceDetectorResult, FaceDetectorOptions>?
Installed by a platform plugin before the first FaceDetector is created.
getter/setter pair
faceLandmarkerBackendFactory ↔ VisionBackendFactory<FaceLandmarkerResult, FaceLandmarkerOptions>?
Installed by a platform plugin before the first FaceLandmarker is created.
getter/setter pair
gestureRecognizerBackendFactory ↔ VisionBackendFactory<GestureRecognizerResult, GestureRecognizerOptions>?
Installed by a platform plugin before the first GestureRecognizer is created.
getter/setter pair
handLandmarkerBackendFactory ↔ VisionBackendFactory<HandLandmarkerResult, HandLandmarkerOptions>?
Installed by a platform plugin before the first HandLandmarker is created.
getter/setter pair
holisticLandmarkerBackendFactory ↔ VisionBackendFactory<HolisticLandmarkerResult, HolisticLandmarkerOptions>?
Installed by a platform plugin before the first HolisticLandmarker is created.
getter/setter pair
imageClassifierBackendFactory ↔ VisionBackendFactory<ImageClassifierResult, ImageClassifierOptions>?
Installed by a platform plugin before the first ImageClassifier is created.
getter/setter pair
imageEmbedderBackendFactory ↔ VisionBackendFactory<ImageEmbedderResult, ImageEmbedderOptions>?
Installed by a platform plugin before the first ImageEmbedder is created.
getter/setter pair
imageSegmenterBackendFactory ↔ VisionBackendFactory<ImageSegmenterResult, ImageSegmenterOptions>?
Installed by a platform plugin before the first ImageSegmenter is created.
getter/setter pair
interactiveSegmenterBackendFactory ↔ Future<InteractiveSegmenterBackend> Function(InteractiveSegmenterOptions)?
Installed by a platform plugin before the first InteractiveSegmenter is created.
getter/setter pair
objectDetectorBackendFactory ↔ VisionBackendFactory<ObjectDetectorResult, ObjectDetectorOptions>?
Installed by a platform plugin before the first ObjectDetector is created.
getter/setter pair
overlayBackends → Expando<VisionTaskOverlayBackend>
The overlay backend behind a task, when its platform has one. Task classes register theirs when they are created; BrowserOverlay looks it up.
final
poseLandmarkerBackendFactory ↔ VisionBackendFactory<PoseLandmarkerResult, PoseLandmarkerOptions>?
Installed by a platform plugin before the first PoseLandmarker is created.
getter/setter pair
taskPlatformGpuReader ↔ Future<String?> Function()?
Names this device's GPU for TaskPlatform.gpu. An adapter package that can read it sets this when it registers, before the platform is first read; it is called once, with the rest of the platform.
getter/setter pair

Functions

attachMaskBuffers(Map<String, dynamic> result, List<ByteBuffer> buffers) → void
Replaces each mask the browser worker named as [width, height, bytes per value, index] in result with [width, height, values] read from buffers: float32 confidences or uint8 categories.
confidenceMaskFromList(List mask) → ConfidenceMask
Packs one [width, height, Float32List] mask list as a confidence mask.
decodeFaceDetectorResult(VisionResultData data) → FaceDetectorResult
Decodes a Face Detector result. Google's boxes are float pixels; the Dart boxes are whole pixels, truncated as the C API does.
decodeFaceLandmarkerResult(VisionResultData data) → FaceLandmarkerResult
Decodes a Face Landmarker result.
decodeGestureRecognizerResult(VisionResultData data) → GestureRecognizerResult
Decodes a Gesture Recognizer result.
decodeHandLandmarkerResult(VisionResultData data) → HandLandmarkerResult
Decodes a Hand Landmarker result.
decodeHolisticLandmarkerResult(VisionResultData data) → HolisticLandmarkerResult
Decodes a Holistic Landmarker result. Google's browser API lists each part per subject; Holistic reports at most one.
decodeImageClassifierResult(VisionResultData data) → ImageClassifierResult
Decodes an Image Classifier result.
decodeImageEmbedderResult(VisionResultData data) → ImageEmbedderResult
Decodes an Image Embedder result: one vector per model head.
decodeImageSegmenterResult(VisionResultData data) → ImageSegmenterResult
Decodes an Image Segmenter result.
decodeObjectDetectorResult(VisionResultData data) → ObjectDetectorResult
Decodes an Object Detector result, boxes as for faces.
decodePoseLandmarkerResult(VisionResultData data) → PoseLandmarkerResult
Decodes a Pose Landmarker result.
unpackLandmarks<T>(List<double> packed, List<int> counts, LandmarkBuilder<T> point) → List<List<T>>
Splits packed into one landmark list per subject.

Typedefs

LandmarkBuilder<T> = T Function({String? name, double? presence, double? visibility, required double x, required double y, required double z})
A landmark constructor: NormalizedLandmark.new or Landmark.new.
VisionBackendFactory<R, O> = Future<VisionTaskBackend<R>> Function(O options)
Creates a task's backend from its options. Installed by a platform plugin before the first task is created; null where the package runs Google's native runtime itself.