Class SegmentationMask

java.lang.Object
com.codename1.ai.vision.SegmentationMask

public final class SegmentationMask extends Object
Dense per-pixel foreground confidence mask. The confidence array is row-major with exactly width * height values in the range 0..1. It is defensively copied on construction and access.
  • Constructor Details

    • SegmentationMask

      public SegmentationMask(int width, int height, float[] confidence)
      Creates a row-major confidence mask without backend metadata.
      Parameters:
      width - mask width in pixels
      height - mask height in pixels
      confidence - one foreground probability per pixel, defensively copied
      Throws:
      IllegalArgumentException - if either dimension is negative, the pixel count exceeds the maximum Java array length, or confidence does not contain exactly one value per pixel
    • SegmentationMask

      public SegmentationMask(int width, int height, float[] confidence, VisionMetadata metadata)
      Creates a row-major confidence mask with backend diagnostics.
      Parameters:
      width - mask width in pixels
      height - mask height in pixels
      confidence - one foreground probability per pixel, defensively copied
      metadata - backend details, or null
      Throws:
      IllegalArgumentException - if either dimension is negative, the pixel count exceeds the maximum Java array length, or confidence does not contain exactly one value per pixel
  • Method Details

    • getWidth

      public int getWidth()
      Returns:
      mask width, which may differ from source image width
    • getHeight

      public int getHeight()
      Returns:
      mask height, which may differ from source image height
    • getConfidence

      public float[] getConfidence()
      Returns:
      defensive copy of row-major foreground confidences
    • getMetadata

      public VisionMetadata getMetadata()
      Returns:
      backend metadata, or null when manually constructed