SegmentationMask class

A segmentation probability mask indicating foreground vs background.

Implementers

Constructors

SegmentationMask({required Float32List data, required int width, required int height, required int originalWidth, required int originalHeight, List<double> padding = const [0.0, 0.0, 0.0, 0.0]})
Creates a segmentation mask with validation.
factory
SegmentationMask.fromMap(Map<String, dynamic> map)
Creates a SegmentationMask from a serialized map.
factory
SegmentationMask.internal({required Float32List internalData, required int width, required int height, required int originalWidth, required int originalHeight, required List<double> padding})
Internal const constructor that accepts already-validated buffers.
const

Properties

data Float32List
Returns a defensive copy of the raw probability data (row-major).
no setter
hashCode int
The hash code for this object.
no setterinherited
height int
Mask height in pixels.
final
internalData Float32List
Raw float32 mask data; access via data (defensive copy) or at.
final
originalHeight int
Original source image height.
final
originalWidth int
Original source image width.
final
padding List<double>
Padding [top, bottom, left, right] applied during letterboxing.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width int
Mask width in pixels.
final

Methods

at(int x, int y) double
Returns probability at (x, y) in mask coordinates. Out-of-bounds → 0.0.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBinary({double threshold = 0.5}) Uint8List
Converts to binary mask (0 or 255) using threshold.
toMap() Map<String, dynamic>
Serialization for isolate transfer.
toRgba({int foreground = 0xFFFFFFFF, int background = 0x00000000, PixelFormat format = PixelFormat.rgba, double threshold = 0.5}) Uint8List
Converts to RGBA image with configurable colors.
toString() String
A string representation of this object.
override
toUint8() Uint8List
Converts to 8-bit grayscale mask (0-255).
upsample({int? targetWidth, int? targetHeight, int maxSize = 2048}) SegmentationMask
Upsamples mask to target dimensions using bilinear interpolation.

Operators

operator ==(Object other) bool
The equality operator.
inherited