目录

class info
com.huawei.hms.mlsdk.imgseg.MLImageSegmentationSetting.Factory
Creates an instance of the image segmentation configurator to set image segmentation attributes.

Sample Code

  1. MLImageSegmentationSetting settingoptions = new MLImageSegmentationSetting
  2.              .Factory()
  3.              .setExact(true)
  4.              .setAnalyzerType(MLObjectAnalyzerSetting.BODY_SEGIMAGE_SEG)
  5.              .setScene(MLImageSegmentationScene.ALL)
  6.              .create();

Public Method Summary

Return typeMethod name
mlsdk.imgseg.MLImageSegmentationSettingcreate()
mlsdk.imgseg.MLImageSegmentationSetting.FactorysetAnalyzerType(int analyzerType)
mlsdk.imgseg.MLImageSegmentationSetting.FactorysetExact(boolean isExact)
mlsdk.imgseg.MLImageSegmentationSetting.FactorysetScene(int scene)

Public Methods

Method
public mlsdk.imgseg.MLImageSegmentationSetting create()
Creates an instance of the image segmentation configurator.

Return

Typedesc
mlsdk.imgseg.MLImageSegmentationSettingReturns an instance of the image segmentation configurator MLImageSegmentationSetting.
Method
public mlsdk.imgseg.MLImageSegmentationSetting.Factory setAnalyzerType(int analyzerType)
Sets the classification mode. For static image segmentation, MLImageSegmentationSetting.BODY_SEG (only the human body and background) and MLImageSegmentationSetting.IMAGE_SEG (10 categories, including the human body) can be set.For camera stream segmentation, only MLImageSegmentationSetting.BODY_SEG (only the human body and background) can be set.

Parameters

Parameter nameParameter desc
analyzerTypeClassification mode.MLImageSegmentationSetting.BODY_SEG(0): human body segmentationMLImageSegmentationSetting.IMAGE_SEG(1): multiclass image segmentation

Return

Typedesc
mlsdk.imgseg.MLImageSegmentationSetting.FactoryReturns the image segmentation analyzer of a specified classification mode.
Method
public mlsdk.imgseg.MLImageSegmentationSetting.Factory setExact(boolean isExact)
Determines whether to support fine detection.

Parameters

Parameter nameParameter desc
isExactIndicates whether to support fine segmentation.
true: yes
false: no (fast segmentation)

Return

Typedesc
mlsdk.imgseg.MLImageSegmentationSetting.FactoryReturns the image segmentation analyzer of the specified fine detection setting.
Method
public mlsdk.imgseg.MLImageSegmentationSetting.Factory setScene(int scene)
Sets the type of the returned result. This setting takes effect only in MLImageSegmentationSetting.BODY_SEG mode. In MLImageSegmentationSetting.IMAGE_SEG mode, only the pixel-level label information is returned. Options: MLImageSegmentationScene.ALL (return all segmentation results, including the pixel-level label information, human body image with a transparent background, and gray-scale image with a white human body and black background), MLImageSegmentationScene.MASK_ONLY (return only the pixel-level label information), MLImageSegmentationScene.FOREGROUND_ONLY (return only the human body image with a transparent background), and MLImageSegmentationScene.GRAYSCALE_ONLY (return only the gray-scale image with a white human body and black background).

Parameters

Parameter nameParameter desc
sceneType of the returned result.MLImageSegmentationScene.ALL(0): all segmentation results, including the pixel-level label information, human body image with a transparent background, and gray-scale image with a white human body and black backgroundMLImageSegmentationScene.MASK_ONLY(1): pixel-level label informationMLImageSegmentationScene.FOREGROUND_ONLY(2): human body image with a transparent backgroundMLImageSegmentationScene.GRAYSCALE_ONLY(3): gray-scale image with a white human body and black background

Return

Typedesc
mlsdk.imgseg.MLImageSegmentationSetting.FactoryReturns the image segmentation analyzer of a specified scenario.