We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

Documents from this version have been archived, and will not continue to be maintained. Please use the latest version.

HMS Core ReferencesML Kitmlsdk.objectsMLObject

MLObject

class info
com.huawei.hms.mlsdk.objects.MLObject
Represents the objects detected by the object analyzer (MLObjectAnalyzer). The object attributes include:
1. Object type (options: furniture, goods, food, places, plants, faces, and others)
2. Object bounding box, indicating the object position in an image
3. Object ID, which is expressed as an integer. In video stream mode, each detected object has an ID. In image mode, the ID is null.
4. Detection result confidence. The value range is 0.0–1.0. A larger value indicates higher confidence. If an object is classified as others (TYPE_OTHER), this attribute is null.

Constant Summary

TypeNameDesc
intTYPE_OTHERObject type 0: others
intTYPE_GOODSObject type 1: goods
intTYPE_FOODObject type 2: food
intTYPE_FURNITUREObject type 3: furniture
intTYPE_PLANTObject type 4: plants
intTYPE_PLACEObject type 5: places
intTYPE_FACEObject type 6: faces

Public Method Summary

Constants

Constant
public static final int TYPE_OTHER
Object type 0: others
Constant value: 0
Constant
public static final int TYPE_GOODS
Object type 1: goods
Constant value: 1
Constant
public static final int TYPE_FOOD
Object type 2: food
Constant value: 2
Constant
public static final int TYPE_FURNITURE
Object type 3: furniture
Constant value: 3
Constant
public static final int TYPE_PLANT
Object type 4: plants
Constant value: 4
Constant
public static final int TYPE_PLACE
Object type 5: places
Constant value: 5
Constant
public static final int TYPE_FACE
Object type 6: faces
Constant value: 6

Public Methods

Method
public android.graphics.Rect getBorder()
Obtains the axis-aligned bounding rectangle of an object.

Return

Typedesc
android.graphics.RectReturns the axis-aligned bounding rectangle of an object.
Method
public Integer getTracingIdentity()
Obtains the object ID.

Return

Typedesc
IntegerReturns the object ID, expressed as an integer. In MLObjectSetting.TYPE_PICTURE mode, this parameter is null.
Method
public int getTypeIdentity()
Obtains the object classification result.

Return

Typedesc
intReturns the object classification result:0: TYPE_OTHER, indicating others
1: TYPE_GOODS, indicating goods
2: TYPE_FOOD, indicating food
3: TYPE_FURNITURE, indicating furniture
4: TYPE_PLACE, indicating places
5: TYPE_PLANT, indicating plants
6: TYPE_FACE, indicating faces
Method
public Float getTypePossibility()
Obtains the object detection confidence.

Return

Typedesc
FloatReturns the object detection confidence. The value range is 0.0–1.0. A larger value indicates higher confidence.
If an object is classified as others, this attribute is null.
Method
public void setBorder(android.graphics.Rect border)
Sets the axis-aligned bounding rectangle of an object.

Parameters

Parameter nameParameter desc
borderVariable of the Rect type.
Method
public void setTracingIdentity(Integer tracingIdentity)
Sets the object tracking ID. In video stream mode, each detected object has an ID. In image mode, the ID is null.

Parameters

Parameter nameParameter desc
tracingIdentityInteger variable. The value range is 0–2147483648.
Method
public void setTypeIdentity(int type)
Sets the object type.

Parameters

Parameter nameParameter desc
typeOptions: 0: TYPE_OTHER, indicating others
1: TYPE_GOODS, indicating goods
2: TYPE_FOOD, indicating food
3: TYPE_FURNITURE, indicating furniture
4: TYPE_PLACE, indicating places
5: TYPE_PLANT, indicating plants
6: TYPE_FACE, indicating faces
Method
public void setTypePossibility(Float possibility)
Sets the confidence of the detection result.

Parameters

Parameter nameParameter desc
possibilityFloating point variable. The value range is 0.0–1.0. A larger value indicates higher confidence.
This page may contain third-party content. For details, click here.