| class info |
| com.huawei.hms.mlsdk.imgseg.MLImageSegmentation |
Represents the category of each pixel after image segmentation by an image segmentation analyzer (MLImageSegmentationAnalyzer). The object attributes include: 1. Label of each pixel after image segmentation. 2. Human body image with a transparent background. 3. Gray-scale image with a white human body and black background |
| Type | Name | Desc |
| Bitmap | foreground | Human body image with a transparent background. |
| Bitmap | grayscale | Gray-scale image with a white human body and black background. |
| byte | masks | Size of the semantic segmentation result of pixel detection in the current image category. The segmentation effect can be viewed only after secondary processing. The size is calculated by multiplying the image length by image width. |
| Bitmap | original | Original image for segmentation. |
| Constructor name |
| MLImageSegmentation(byte[] masks, android.graphics.Bitmap foreground, Bitmap grayscale)Constructor. |
| MLImageSegmentation(byte[] masks, android.graphics.Bitmap foreground, android.graphics.Bitmap grayscale, android.graphics.Bitmap original)Constructor. |
| Return type | Method name |
| android.graphics.Bitmap | getForeground() |
| android.graphics.Bitmap | getGrayscale() |
| byte[] | getMasks() |
| android.graphics.Bitmap | getOriginal() |
| Constant |
| public Bitmap foreground |
| Human body image with a transparent background. |
| Constant |
| public Bitmap grayscale |
| Gray-scale image with a white human body and black background. |
| Constant |
| public Bitmap original |
| Original image for segmentation. |
| Method |
| public MLImageSegmentation(byte[] masks, android.graphics.Bitmap foreground, Bitmap grayscale) |
| Constructor. |
Parameters
| Parameter name | Parameter desc |
| masks | One-dimensional array, which stores the category label of each pixel of an image. |
| foreground | Human body image with a transparent background. |
| grayscale | Gray-scale image with a white human body and black background. |
| grayscale | Gray-scale image with a white human body and black background. |
| Method |
| public MLImageSegmentation(byte[] masks, android.graphics.Bitmap foreground, android.graphics.Bitmap grayscale, android.graphics.Bitmap original) |
| Constructor. |
Parameters
| Parameter name | Parameter desc |
| masks | One-dimensional array, which stores the category label of each pixel of an image. |
| foreground | Human body image with a transparent background. |
| grayscale | Gray-scale image with a white human body and black background. |
| original | Original image for segmentation. |
Return
| Type | desc |
| android.graphics.Bitmap | Returns the human body image with a transparent background.Detection success: Returns bitmap with the same size of the original image.Detection failure: Returns null. |
| Method |
| public android.graphics.Bitmap getGrayscale() |
| Obtains the gray-scale image with a white human body and black background. The segmentation effect can be directly viewed. |
Return
| Type | desc |
| android.graphics.Bitmap | Returns the gray-scale image with a white human body and black background.Detection success: Returns bitmap with the same size of the original image.Detection failure: Returns null. |
| Method |
| public byte[] getMasks() |
| Image segmentation result. The segmentation effect can be viewed only after secondary processing. |
Return
| Type | desc |
| byte[] | Category label of each pixel after current image segmentation (for details, please refer to the definition of MLImageSegmentationClassification).Detection success: Returns a one-dimensional byte array with the length of the original image multiplied by its width.Detection failure: Returns null. |
| Method |
| public android.graphics.Bitmap getOriginal() |
| Returns the original image for segmentation. |
Return
| Type | desc |
| android.graphics.Bitmap | Original image for segmentation. |