目录

class info
com.huawei.hms.mlsdk.common.MLCompositeAnalyzer
Represents a composite analyzer, which extends MLAnalyzer and can integrate with multiple types of analyzers to detect different types of objects at the same time. For example, it can simultaneously recognize faces and texts in an image.

Sample Code

  1. // Create an instance of MLCompositeAnalyzer
  2. MLCompositeAnalyzer analyzer = new MLCompositeAnalyzer.Creator()
  3. .add(faceAnalyzer)
  4. .add(objectAnalyzer)
  5. .create();
  6. // Create an instance of LensEnginebased on the instance of MLCompositeAnalyzer
  7. LensEngine mLensEngine = new LensEngine.Creator(getAppContext(), analyzer)
  8. .setLensType(LensEngine.BACK_LENS)
  9. .applyDisplayDimension(640, 480)
  10. .applyFps(30.0f)
  11. .enableAutomaticFocus(true)
  12. .create();

Public Method Summary

Return typeMethod name
android.util.SparseArray<Object>analyseFrame(MLFrame frame)
voiddestroy()
booleanisAvailable()
voidobtainPicture(MLFrame frame)

Public Methods

Method
public android.util.SparseArray<Object> analyseFrame(MLFrame frame)
Uses a composite analyzer to detect information in an image and returns the detection result list, which may include face and object information.

Parameters

Parameter nameParameter desc
frameImage whose information is to be detected.


Return

Typedesc
android.util.SparseArray<Object>Detection results
Method
public void destroy()
Releases resources occupied by a composite analyzer.
Method
public boolean isAvailable()
Checks whether an analyzer is available, that is, whether all required resources are loaded.

Return

Typedesc
booleantrue: analyzer available
false: analyzer unavailable
Method
public void obtainPicture(MLFrame frame)
Receives MLFrame instance and uses it as the input of a composite analyzer.

Parameters

Parameter nameParameter desc
frameMLFrame instance