| 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. |
| Type | Name | Desc |
| int | TYPE_OTHER | Object type 0: others |
| int | TYPE_GOODS | Object type 1: goods |
| int | TYPE_FOOD | Object type 2: food |
| int | TYPE_FURNITURE | Object type 3: furniture |
| int | TYPE_PLANT | Object type 4: plants |
| int | TYPE_PLACE | Object type 5: places |
| int | TYPE_FACE | Object type 6: faces |
| Return type | Method name |
| android.graphics.Rect | getBorder() |
| Integer | getTracingIdentity() |
| int | getTypeIdentity() |
| Float | getTypePossibility() |
| void | setBorder(android.graphics.Rect border) |
| void | setTracingIdentity(Integer tracingIdentity) |
| void | setTypeIdentity(int type) |
| void | setTypePossibility(Float possibility) |
| 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 |
| Method |
| public android.graphics.Rect getBorder() |
| Obtains the axis-aligned bounding rectangle of an object. |
Return
| Type | desc |
| android.graphics.Rect | Returns the axis-aligned bounding rectangle of an object. |
| Method |
| public Integer getTracingIdentity() |
| Obtains the object ID. |
Return
| Type | desc |
| Integer | Returns 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
| Type | desc |
| int | Returns 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
| Type | desc |
| Float | Returns 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 name | Parameter desc |
| border | Variable 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 name | Parameter desc |
| tracingIdentity | Integer variable. The value range is 0–2147483648. |
| Method |
| public void setTypeIdentity(int type) |
| Sets the object type. |
Parameters
| Parameter name | Parameter desc |
| type | Options: 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 name | Parameter desc |
| possibility | Floating point variable. The value range is 0.0–1.0. A larger value indicates higher confidence. |