RunAnywhere.segmentation.segment returns a per-pixel class mask.
The input must be
ImageInput.rawRgb(data, width, height). Packed RGB8 is the only layout the
segmentation ABI accepts, so ImageInput.file and ImageInput.bytes throw here. Decode the image
yourself first — see Preparing raw RGB.SDKException when the SDK is not initialized or no segmentation model is loaded.
segment does not auto-load: load the model yourself with RunAnywhere.models.load(id).
SegmentationResult
ClassInfo carries classId (the value used in the mask), label, pixelCount, and fraction, the
share of the image the class covers.
Read a single pixel’s class with classMask[y * width + x].
SegmentationOptions
includeDiagnosticImage defaults to false. When true you also get a deterministic class-colour RGBA
image, which is useful for debugging but costs extra bytes across the bridge.
Counting a class
Preparing raw RGB
Any decoder works as long as you end up with three bytes per pixel and no padding.Models
Segmentation models register underMODEL_CATEGORY_SEMANTIC_SEGMENTATION.
await Onnx.register() first.
See also
Vision language
Describing images in words
Models
Registration and loading