Class SegmentationMask
java.lang.Object
com.codename1.ai.vision.SegmentationMask
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 Summary
ConstructorsConstructorDescriptionSegmentationMask(int width, int height, float[] confidence) Creates a row-major confidence mask without backend metadata.SegmentationMask(int width, int height, float[] confidence, VisionMetadata metadata) Creates a row-major confidence mask with backend diagnostics. -
Method Summary
-
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 pixelsheight- mask height in pixelsconfidence- one foreground probability per pixel, defensively copied- Throws:
IllegalArgumentException- if either dimension is negative, the pixel count exceeds the maximum Java array length, orconfidencedoes not contain exactly one value per pixel
-
SegmentationMask
Creates a row-major confidence mask with backend diagnostics.- Parameters:
width- mask width in pixelsheight- mask height in pixelsconfidence- one foreground probability per pixel, defensively copiedmetadata- backend details, ornull- Throws:
IllegalArgumentException- if either dimension is negative, the pixel count exceeds the maximum Java array length, orconfidencedoes 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
- Returns:
- backend metadata, or
nullwhen manually constructed
-