CameraFrame class

A camera frame packaged for off-thread colour conversion and inference.

Produced by prepareCameraFrame; consumed by detector packages' detectFromCameraFrame(...) methods, which marshal bytes across isolate boundaries via TransferableTypedData and perform the final cvtColor / rotate inside their existing detection isolate (off the UI thread).

The bytes buffer is either a tightly-packed YUV420 buffer produced by packYuv420, or the raw 4-channel plane of a desktop BGRA/RGBA frame.

  • width, height: the output pixel dimensions before any rotation. For YUV this matches the luma plane; for BGRA/RGBA this is the logical image size (which may be smaller than the buffer's stride width).
  • strideCols: the Mat column count used when reconstructing a 4-channel Mat from a BGRA/RGBA buffer (rowStride ~/ 4). For YUV frames this equals width since packYuv420 produces a tightly-packed buffer.
  • conversion: which colour conversion to apply.
  • rotation: optional post-conversion rotation, or null for none.

Constructors

CameraFrame({required Uint8List bytes, required int width, required int height, required int strideCols, required CameraFrameConversion conversion, CameraFrameRotation? rotation})
const

Properties

bytes Uint8List
The packed pixel bytes, ready for colour conversion.
final
conversion CameraFrameConversion
Colour conversion to apply.
final
hashCode int
The hash code for this object.
no setterinherited
height int
Output height in pixels (pre-rotation).
final
rotation CameraFrameRotation?
Optional rotation to apply after conversion, or null for none.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strideCols int
Mat column count when reconstructing a Mat from bytes. For BGRA/RGBA this is rowStride ~/ 4 and may exceed width (in which case the consumer should crop to width × height). For YUV this equals width.
final
width int
Output width in pixels (pre-rotation).
final

Methods

decodePlan() CameraFrameDecodePlan
Builds backend-neutral decode instructions for this frame.
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