目录

class info
com.huawei.hms.mlsdk.face.MLFaceAnalyzerSetting.Factory
Creates an instance of the face analysis configurator (MLFaceAnalyzerSetting).

Public Method Summary

Return typeMethod name
MLFaceAnalyzerSetting.FactoryallowTracing()
MLFaceAnalyzerSettingcreate()
MLFaceAnalyzerSetting.FactorysetFeatureType(int featureType)
MLFaceAnalyzerSetting.FactorysetKeyPointType(int keyPointType)
MLFaceAnalyzerSetting.FactorysetMaxSizeFaceOnly(boolean isMaxSizeFaceOnly)
MLFaceAnalyzerSetting.FactorysetMinFaceProportion(float minFaceProportion)
MLFaceAnalyzerSetting.FactorysetPerformanceType(int performanceType)
MLFaceAnalyzerSetting.FactorysetShapeType(int shapeType)
MLFaceAnalyzerSetting.FactorysetTracingAllowed(boolean isTracingAllowed)

Public Methods

Method
public MLFaceAnalyzerSetting.Factory allowTracing()
Enables face tracking.

Return

Typedesc
MLFaceAnalyzerSetting.FactoryReturns the instance of MLFaceAnalyzerSetting.Factory.
Method
public MLFaceAnalyzerSetting create()
Creates an instance of the face analysis configurator (MLFaceAnalyzerSetting).

Return

Typedesc
MLFaceAnalyzerSettingReturns the instance of MLFaceAnalyzerSetting.


Sample Code

  1. MLFaceAnalyzerSetting setting = new MLFaceAnalyzerSetting.Factory()
  2.   .setFeatureType(MLFaceAnalyzerSetting.TYPE_FEATURES)
  3.   .setShapeType(MLFaceAnalyzerSetting.TYPE_SHAPES)
  4.   .setKeyPointType(MLFaceAnalyzerSetting.TYPE_KEYPOINTS)
  5.   .setTracingAllowed(true)
  6.   .create();
  7. MLFaceAnalyzer analyzer = MLAnalyzerFactory.getInstance().getFaceAnalyzer(setting);
Method
public MLFaceAnalyzerSetting.Factory setFeatureType(int featureType)
Sets the detection mode of facial features and expressions of the analyzer.

Parameters

Parameter nameParameter desc
featureType

Detection mode of facial features and expressions of the analyzer.

TYPE_FEATURES: The value is 1, indicating that facial features and expressions are detected.

TYPE_UNSUPPORT_FEATURES: The value is 2, indicating that facial features and expressions are not detected.


Return

Typedesc
MLFaceAnalyzerSetting.FactoryReturns the instance of MLFaceAnalyzerSetting.Factory.
Method
public MLFaceAnalyzerSetting.Factory setKeyPointType(int keyPointType)
Sets the facial key-point detection mode of the analyzer.

Parameters

Parameter nameParameter desc
keyPointTypeFacial key-point detection mode of the analyzer.
TYPE_KEYPOINTS: The value is 0, indicating that facial key-points are detected.
TYPE_UNSUPPORT_KEYPOINTS: The value is 2, indicating that facial key-points are not detected.


Return

Typedesc
MLFaceAnalyzerSetting.FactoryReturns the instance of MLFaceAnalyzerSetting.Factory.
Method
public MLFaceAnalyzerSetting.Factory setMaxSizeFaceOnly(boolean isMaxSizeFaceOnly)
Sets whether to detect only the largest face in an image.

Parameters

Parameter nameParameter desc
isMaxSizeFaceOnly

Indicates whether to detect only the largest face.

true: detect only the largest face

false: detect all faces


Return

Typedesc
MLFaceAnalyzerSetting.FactoryReturns the instance of MLFaceAnalyzerSetting.Factory.
Method
public MLFaceAnalyzerSetting.Factory setMinFaceProportion(float minFaceProportion)
Sets the smallest proportion (range: 0.0-1.0) of a face in an image. The proportion is equal to the head width divided by the image width. Only faces whose proportions are greater than or equal to this threshold are returned.

Parameters

Parameter nameParameter desc
minFaceProportionSets the smallest proportion of a face in an image.


Return

Typedesc
MLFaceAnalyzerSetting.FactoryReturns the instance of MLFaceAnalyzerSetting.Factory.
Method
public MLFaceAnalyzerSetting.Factory setPerformanceType(int performanceType)
Sets the preference mode of the analyzer.

Parameters

Parameter nameParameter desc
performanceTypePreference mode of the analyzer.
TYPE_PRECISION: The value is 1, indicating the precision preference mode. This mode will detect more faces and be more precise in detecting key points and shapes, but will run slower.
TYPE_SPEED: The value is 2, representing a preference for speed. This will detect fewer faces and be less precise in detecting key points and shapes, but will run faster.


Return

Typedesc
MLFaceAnalyzerSetting.FactoryReturns the instance of MLFaceAnalyzerSetting.Factory.
Method
public MLFaceAnalyzerSetting.Factory setShapeType(int shapeType)
Sets the facial shape detection mode of the analyzer.

Parameters

Parameter nameParameter desc
shapeTypeFacial shape detection mode of the analyzer.
TYPE_SHAPES: The value is 2, indicating that facial shapes are detected.
TYPE_UNSUPPORT_SHAPES: The value is 3, indicating that facial shapes are not detected.


Return

Typedesc
MLFaceAnalyzerSetting.FactoryReturns the instance of MLFaceAnalyzerSetting.Factory.
Method
public MLFaceAnalyzerSetting.Factory setTracingAllowed(boolean isTracingAllowed)
Sets whether to enable face tracking.

Parameters

Parameter nameParameter desc
isTracingAllowedIndicates whether to enable face tracking.
true: enable face tracing
false: disable face tracing


Return

Typedesc
MLFaceAnalyzerSetting.FactoryReturns the instance of MLFaceAnalyzerSetting.Factory.