VisionImage class final

An input image. Pixel buffers are copied; the caller never owns native memory and may reuse its buffer at once.

Annotations

Constructors

VisionImage.deferred(FutureOr<VisionImage> produce())
A live stream frame whose pixels produce makes only if the task runs the frame, when it starts the frame: a frame the task drops for a newer one is never converted. produce returns the frame built with another constructor, synchronously or not; an error it throws fails the frame, and with it the task, as a failure inside Google's runtime does. Hold on to whatever produce reads, such as a camera image, until then.
VisionImage.fromBrowserFrame(Object frame, {required int width, required int height})
Wraps a browser ImageBitmap or video frame of width by height pixels. The task takes ownership and releases the frame after inference, or when a live stream drops it, so the caller must not reuse it.
VisionImage.fromFile(String path)
Decodes a file with Google's image loader, EXIF orientation included. path is a file on native platforms and a URL, resolved against the page, in browsers.
VisionImage.fromPixels({required Uint8List pixels, required int width, required int height, required VisionPixelFormat format, int? bytesPerRow})
Copies RGB, RGBA or BGRA bytes, optionally with camera row padding.

Properties

browserFrame → Object?
The browser frame, or null for other inputs.
final
bytesPerRow → int?
Bytes between the starts of adjacent pixel rows, padding included; null for other inputs.
final
format → VisionPixelFormat?
Channel order of pixels; null for other inputs.
final
hashCode → int
The hash code for this object.
no setterinherited
height → int?
Pixel height, which the runtime reads for file input.
final
path → String?
The file (native) or URL (browser), or null for other inputs.
final
pixels → Uint8List?
Owned, read-only pixels, or null for other inputs.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
width → int?
Pixel width, which the runtime reads for file input.
final

Methods

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