目录

visionBase (Core Vision Kit Base Class)

As a basic visual capability library, visionBase encapsulates basic resource objects, common objects in visual capability scenarios, data structures, and common methods. It helps reduce the coding workload and simplifies the use of functional APIs. You can consider it as a toolbox containing the most common tools. With this base class, you can implement your functions more efficiently while complying with necessary standards. In addition, visionBase provides the infrastructure required by Core Vision Kit AI capabilities, such as data structures, API models, and lifecycle management.

Module Import

import { visionBase } from '@kit.CoreVisionKit';

SceneMode

Enumeration of image elements.

System capability: SystemCapability.AI.Vision.VisionBase

Start version: 5.0.0(12)

Name

Value

Description

FOREGROUND

1

Foreground entity (default value).

BACKGROUND

2

Background entity.

ImageData

Visual information object to be recognized.

System capability: SystemCapability.AI.Vision.VisionBase

Start version: 5.0.0(12)

Name

Type

Read-Only

Optional

Description

pixelMap

image.PixelMap

No

No

Image to be recognized.

InputData

Array consisting of multiple pieces of image data.

System capability: SystemCapability.AI.Vision.VisionBase

Start version: 5.0.0(12)

Type

Description

ImageData | ImageData[]

Array of images to be recognized. You can input one or more images. Currently, only faceComparator (face verification) in Core Vision Kit supports the input of two images.

BoundingBox

Bounding box for AI visual capabilities.

System capability: SystemCapability.AI.Vision.VisionBase

Start version: 5.0.0(12)

Name

Type

Read-Only

Optional

Description

left

number

No

No

X coordinate of the upper left corner of a bounding box.

top

number

No

No

Y coordinate of the upper left corner of a bounding box.

height

number

No

No

Height of a bounding box, in pixels.

width

number

No

No

Width of a bounding box, in pixels.

Point

Point on a two-dimensional plane.

System capability: SystemCapability.AI.Vision.VisionBase

Start version: 5.0.0(12)

Name

Type

Read-Only

Optional

Description

x

number

No

No

X coordinate of a point.

y

number

No

No

Y coordinate of a point.

Orientation

Point on a three-dimensional plane.

System capability: SystemCapability.AI.Vision.VisionBase

Start version: 5.0.0(12)

Name

Type

Read-Only

Optional

Description

yaw

number

No

No

Yaw angle of rotating an object around the vertical axis (Y axis), which determines the direction of the object on the horizontal plane.

pitch

number

No

No

Pitch angle of rotating an object around the horizontal axis (X axis), which determines the direction of the object on the vertical plane.

roll

number

No

No

Roll angle of rotating an object around the Z axis, which determines the direction of the object on the plane perpendicular to the X and Y planes.

Request

Base class of input parameters.

System capability: SystemCapability.AI.Vision.VisionBase

Start version: 5.0.0(12)

Name

Type

Read-Only

Optional

Description

inputData

InputData

No

No

Image (array) to be recognized. It can be an object or an object array.

scene

SceneMode

No

Yes

Requested scenario mode.

No matter what the passed value is, the APIs are not affected.

requestId

string

No

Yes

Unique request ID. You can use it to trace and manage your requests. If no ID is passed, the default request ID will be used.

No matter what the passed value is, the APIs are not affected.

Response

Response base class, which is used as the returned result of a capability request.

System capability: SystemCapability.AI.Vision.VisionBase

Start version: 5.0.0(12)

Name

Type

Read-Only

Optional

Description

requestId

string

No

Yes

Unique request ID. You can use it to trace and manage your requests.

Analyzer.destroy

destroy(): Promise<void>

Releases engine resources of multiple visual capabilities.

System capability: SystemCapability.AI.Vision.VisionBase

Start version: 5.0.0(12)

Returns:

Type

Description

Promise<void>

Promise object. This API does not return any value.