目录

ar_engine_core.h

Overview

Declares the APIs for accessing AR Engine, and provides basic AR Engine capabilities, including motion tracking, environment tracking, and hit testing.

Library: libarengine_ndk.z.so

System capability: SystemCapability.AREngine.Core

Start version: 5.0.0(12)

Related module: AR Engine

Summary

[h2]Structs

Name

Description

struct AREngine_ClipPlaneDistance

Distance to the clipping planes.

[h2]Macro Definition

Name

Description

ARENGINE_AABB_POINT_SIZE = 6

Size of the bounding box coordinate array.

ARENGINE_POSE_RAW_SIZE = 7

Size of the pose data array.

ARENGINE_VIEW_MATRIX_SIZE = 16

Size of the transformation matrix array.

ARENGINE_DISTORTION_COUNT = 5

Number of camera distortion parameters.

[h2]Type Definitions

Name

Description

typedef struct AREngine_ARConfig AREngine_ARConfig

Configures AREngine_ARSession capabilities (which capabilities and modes to use).

typedef struct AREngine_ARSession AREngine_ARSession

Manages the system status of AR Engine.

typedef struct AREngine_ARPose AREngine_ARPose

Indicates the pose (translation + rotation), representing an immutable rigid transformation from one coordinate system to another.

typedef struct AREngine_ARCamera AREngine_ARCamera

Indicates the camera information for the current frame.

typedef struct AREngine_ARCameraIntrinsics AREngine_ARCameraIntrinsics

Indicates intrinsic camera parameters, including fx, fy, cx, cy, and camera distortion parameters.

typedef struct AREngine_ARCameraConfig AREngine_ARCameraConfig

Provides camera configuration information, such as the image size to be processed by CPU, or the texture size to be processed by GPU.

typedef struct AREngine_ARFrame AREngine_ARFrame

Indicates a frame of data processed by AR Engine.

typedef struct AREngine_ARPointCloud AREngine_ARPointCloud

Indicates a collection of trackable 3D point clouds.

typedef struct AREngine_ARTrackable AREngine_ARTrackable

Indicates a trackable object, such as a point or plane.

typedef struct AREngine_ARTrackableList AREngine_ARTrackableList

Indicates a list of trackable objects.

typedef struct AREngine_ARPlane AREngine_ARPlane

Indicates a plane object, which describes the detected trackable plane information.

typedef struct AREngine_ARPoint AREngine_ARPoint

Indicates a point object, which describes the detected trackable point data.

typedef struct AREngine_ARTarget AREngine_ARTarget

Indicates an object, which describes a trackable semantic object, such as a semantic plane.

typedef struct AREngine_ARAnchor AREngine_ARAnchor

Indicates an anchor object, which describes the spatial location associated with a trackable object.

typedef struct AREngine_ARAnchorList AREngine_ARAnchorList

Indicates a list of anchor objects.

typedef struct AREngine_ARHitResult AREngine_ARHitResult

Indicates the hit testing result object, which describes the hit testing result of a single trackable object.

typedef struct AREngine_ARHitResultList AREngine_ARHitResultList

Indicates the list of hit testing results.

typedef struct AREngine_ARImage AREngine_ARImage

Indicates the camera video stream frame object.

[h2]Enumerations

Name

Description

AREngine_ARTrackableType {

ARENGINE_TRACKABLE_BASE = 0x41520100, ARENGINE_TRACKABLE_PLANE = 0x41520101, ARENGINE_TRACKABLE_POINT = 0x41520102, ARENGINE_TRACKABLE_TARGET = 0x50000008,

ARENGINE_TRACKABLE_INVALID = 0

}

Type of a trackable object, such as a plane or a point.

AREngine_ARTrackingState { ARENGINE_TRACKING_STATE_TRACKING = 0, ARENGINE_TRACKING_STATE_PAUSED = 1, ARENGINE_TRACKING_STATE_STOPPED = 2 }

Tracking status of the trackable object.

AREngine_ARTrackingStateReason { ARENGINE_TRACKING_STATE_REASON_NONE = 0, ARENGINE_TRACKING_STATE_REASON_EXCESSIVE_MOTION = 1, ARENGINE_TRACKING_STATE_REASON_INSUFFICIENT_FEATURES = 2 }

Possible causes of tracking failures.

AREngine_ARPlaneFindingMode { ARENGINE_PLANE_FINDING_MODE_DISABLED = 0, ARENGINE_PLANE_FINDING_MODE_HORIZONTAL = 1, ARENGINE_PLANE_FINDING_MODE_VERTICAL = 2, ARENGINE_PLANE_FINDING_MODE_HORIZONTAL_AND_VERTICAL = 3 }

Plane finding mode.

AREngine_ARUpdateMode { ARENGINE_UPDATE_MODE_BLOCKING = 0, ARENGINE_UPDATE_MODE_LATEST = 1 }

Data update mode specified by HMS_AREngine_ARSession_Update.

AREngine_ARPowerMode { ARENGINE_POWER_MODE_NORMAL = 0, ARENGINE_POWER_MODE_POWER_SAVING = 1, ARENGINE_POWER_MODE_PERFORMANCE_FIRST= 2,

ARENGINE_POWER_MODE_BOOST= 3, ARENGINE_POWER_MODE_ULTRA_POWER_SAVING = 11 }

Power consumption mode.

AREngine_ARFocusMode { ARENGINE_FOCUS_MODE_FIXED = 0, ARENGINE_FOCUS_MODE_AUTO = 1 }

Focus mode.

AREngine_ARPlaneType { ARENGINE_PLANE_FACING_HORIZONTAL_UPWARD = 0, ARENGINE_PLANE_FACING_HORIZONTAL_DOWNWARD = 1, ARENGINE_PLANE_FACING_VERTICAL = 2, ARENGINE_PLANE_FACING_INVALID = 3 }

Plane type.

AREngine_ARType { ARENGINE_TYPE_WORLD = 0x01 }

AR capability type.

AREngine_ARSemanticMode { ARENGINE_SEMANTIC_MODE_NONE = 0, ARENGINE_SEMANTIC_MODE_PLANE = 1, ARENGINE_SEMANTIC_MODE_TARGET = 2 }

Semantic mode.

AREngine_ARPointOrientationMode { ARENGINE_POINT_ORIENTATION_INITIALIZED_TO_IDENTITY = 0, ARENGINE_POINT_ORIENTATION_ESTIMATED_SURFACE_NORMAL = 1 }

Orientation mode.

AREngine_ARSemanticPlaneLabel {

ARENGINE_PLANE_UNKNOWN = 0, ARENGINE_PLANE_WALL = 1, ARENGINE_PLANE_FLOOR = 2, ARENGINE_PLANE_SEAT = 3,

ARENGINE_PLANE_TABLE = 4, ARENGINE_PLANE_CEILING = 5, ARENGINE_PLANE_DOOR = 6, ARENGINE_PLANE_WINDOW = 7,

ARENGINE_PLANE_BED = 8

}

Semantic type of the current plane.

AREngine_ARTargetShapeLabel { ARENGINE_TARGET_SHAPE_UNKNOWN = 0, ARENGINE_TARGET_SHAPE_CUBE = 1, ARENGINE_TARGET_SHAPE_CIRCLE = 2, ARENGINE_TARGET_SHAPE_RECTANGLE = 3 }

Shape of the recognized object.

AREngine_ARPoseType { ARENGINE_POSE_TYPE_IDENTITY = 0, ARENGINE_POSE_TYPE_ROTATE_90 = 1, ARENGINE_POSE_TYPE_ROTATE_180 = 2, ARENGINE_POSE_TYPE_ROTATE_270 = 3 }

Pose type.

AREngine_ARImageFormat { ARENGINE_IMAGE_UNKNOWN = 0, ARENGINE_IMAGE_YUV_420_888 = 2 }

Image format.

AREngine_ARPreviewMode { ARENGINE_PREVIEW_MODE_ENABLED = 0, ARENGINE_PREVIEW_MODE_DISABLED = 1 }

Preview mode.

AREngine_ARStatus {

ARENGINE_SUCCESS = 0, ARENGINE_ERROR_PERMISSION_NOT_GRANTED = 201, ARENGINE_ERROR_INVALID_ARGUMENT = 401, ARENGINE_ERROR_DEVICE_NOT_SUPPORTED = 801,

ARENGINE_ERROR_FATAL = 1009200001, ARENGINE_ERROR_SESSION_PAUSED = 1009200002, ARENGINE_ERROR_SESSION_NOT_PAUSED = 1009200003, ARENGINE_ERROR_NOT_TRACKING = 1009200004,

ARENGINE_ERROR_TEXTURE_NOT_SET = 1009200005, ARENGINE_ERROR_MISSING_GL_CONTEXT = 1009200006, ARENGINE_ERROR_UNSUPPORTED_CONFIGURATION = 1009200007, ARENGINE_ERROR_RESOURCE_EXHAUSTED = 1009200008,

ARENGINE_ERROR_NOT_AVAILABLE = 1009200009, ARENGINE_ERROR_CAMERA_NOT_AVAILABLE = 1009200010

}

Error code returned by an API.

[h2]Functions

Name

Description

AREngine_ARStatus HMS_AREngine_ARConfig_Create(const AREngine_ARSession *session, AREngine_ARConfig **outConfig)

Creates a configuration object with a proper default configuration.

void HMS_AREngine_ARConfig_Destroy(AREngine_ARConfig *config)

Releases the memory used by a specific configuration object.

AREngine_ARStatus HMS_AREngine_ARConfig_GetPlaneFindingMode(const AREngine_ARSession *session, const AREngine_ARConfig *config, AREngine_ARPlaneFindingMode *planeFindingMode)

Obtains the current plane finding mode.

AREngine_ARStatus HMS_AREngine_ARConfig_SetPlaneFindingMode(const AREngine_ARSession *session, AREngine_ARConfig *config, AREngine_ARPlaneFindingMode planeFindingMode)

Sets the plane finding mode.

AREngine_ARStatus HMS_AREngine_ARConfig_GetUpdateMode(const AREngine_ARSession *session, const AREngine_ARConfig *config, AREngine_ARUpdateMode *updateMode)

Obtains the current preview update mode.

AREngine_ARStatus HMS_AREngine_ARConfig_SetUpdateMode(const AREngine_ARSession *session, AREngine_ARConfig *config, AREngine_ARUpdateMode updateMode)

Sets the preview update mode.

AREngine_ARStatus HMS_AREngine_ARConfig_GetPowerMode(const AREngine_ARSession *session, const AREngine_ARConfig *config, AREngine_ARPowerMode *powerMode)

Obtains the current power consumption mode.

AREngine_ARStatus HMS_AREngine_ARConfig_SetPowerMode(const AREngine_ARSession *session, AREngine_ARConfig *config, AREngine_ARPowerMode powerMode)

Sets the power consumption mode.

AREngine_ARStatus HMS_AREngine_ARConfig_GetFocusMode(const AREngine_ARSession *session, const AREngine_ARConfig *config, AREngine_ARFocusMode *focusMode)

Obtains the current focus mode.

AREngine_ARStatus HMS_AREngine_ARConfig_SetFocusMode(const AREngine_ARSession *session, AREngine_ARConfig *config, AREngine_ARFocusMode focusMode)

Sets the focus mode.

AREngine_ARStatus HMS_AREngine_ARConfig_SetPreviewSize(const AREngine_ARSession *session, AREngine_ARConfig *config, uint32_t width, uint32_t height)

Sets the preview image size.

AREngine_ARStatus HMS_AREngine_ARConfig_GetARType(const AREngine_ARSession *session, const AREngine_ARConfig *config, AREngine_ARType *type)

Obtains the AR capability type in use.

AREngine_ARStatus HMS_AREngine_ARConfig_SetARType(const AREngine_ARSession *session, AREngine_ARConfig *config, AREngine_ARType type)

Sets the AR capability type to use.

AREngine_ARStatus HMS_AREngine_ARConfig_GetSemanticMode(const AREngine_ARSession *session, const AREngine_ARConfig *config, AREngine_ARSemanticMode *mode)

Obtains the current semantic recognition mode. This function is valid after HMS_AREngine_ARConfig_SetSemanticMode has been called.

AREngine_ARStatus HMS_AREngine_ARConfig_SetSemanticMode(const AREngine_ARSession *session, AREngine_ARConfig *config, AREngine_ARSemanticMode mode)

Sets the semantic recognition mode.

AREngine_ARStatus HMS_AREngine_ARConfig_GetMaxMapSize(const AREngine_ARSession *session, const AREngine_ARConfig *config, uint64_t *maxMapSize)

Obtains the maximum memory size for storing map data.

AREngine_ARStatus HMS_AREngine_ARConfig_SetMaxMapSize(const AREngine_ARSession *session, AREngine_ARConfig *config, uint64_t maxMapSize)

Sets the maximum memory size for storing map data.

AREngine_ARStatus HMS_AREngine_ARSession_Create(void *env, void *applicationContext, AREngine_ARSession **outSessionPointer)

Creates an AREngine_ARSession session. This function depends on the camera, acceleration sensor, and gyroscope sensor permissions.

AREngine_ARStatus HMS_AREngine_ARSession_Stop(AREngine_ARSession *session)

Stops AR Engine and the camera preview stream, clears the plane and anchor data, releases the camera, and terminates the session.

void HMS_AREngine_ARSession_Destroy(AREngine_ARSession *session)

Releases the resources used by the AREngine_ARSession session.

AREngine_ARStatus HMS_AREngine_ARSession_Resume(AREngine_ARSession *session)

Starts AREngine_ARSession, or restores AREngine_ARSession after HMS_AREngine_ARSession_Pause is called.

AREngine_ARStatus HMS_AREngine_ARSession_Pause(AREngine_ARSession *session)

Pauses the session, stops the camera preview stream, and releases the camera (otherwise, other apps will not be able to use the camera service), without clearing the plane and anchor data.

AREngine_ARStatus HMS_AREngine_ARSession_Update(AREngine_ARSession *session, AREngine_ARFrame *outFrame)

Updates the computation result of AR Engine.

AREngine_ARStatus HMS_AREngine_ARSession_Configure(AREngine_ARSession *session, const AREngine_ARConfig *config)

Configures an AREngine_ARSession session.

AREngine_ARStatus HMS_AREngine_ARSession_AcquireNewAnchor(AREngine_ARSession *session, const AREngine_ARPose *pose, AREngine_ARAnchor **outAnchor)

Creates an anchor for continuous tracking.

AREngine_ARStatus HMS_AREngine_ARSession_SetCameraGLTexture(AREngine_ARSession *session, uint32_t textureId)

Sets the OpenGL texture for storing the camera preview stream data.

AREngine_ARStatus HMS_AREngine_ARSession_SetDisplayGeometry(AREngine_ARSession *session, AREngine_ARPoseType rotation, int32_t width, int32_t height)

Sets the display height and width (in pixels). Make sure that the height and width you set here are consistent with those of the display view. Otherwise, an error will occur with the camera preview.

AREngine_ARStatus HMS_AREngine_ARSession_GetAllAnchors(const AREngine_ARSession *session, AREngine_ARAnchorList *outAnchorList)

Obtains all anchors, including anchors in all states contained in AREngine_ARTrackingState.

AREngine_ARStatus HMS_AREngine_ARSession_GetAllTrackables(const AREngine_ARSession *session, AREngine_ARTrackableType filterType, AREngine_ARTrackableList *outTrackableList)

Obtains the list of all trackable objects of the specified type.

AREngine_ARStatus HMS_AREngine_ARSession_GetCameraConfig(const AREngine_ARSession *session, AREngine_ARCameraConfig *outCameraConfig)

Obtains the camera configuration information.

AREngine_ARStatus HMS_AREngine_ARPose_Create(const AREngine_ARSession *session, const float *poseRaw, const uint32_t poseRawSize, AREngine_ARPose **outPose)

Allocates and initializes a new pose object. You can leave poseRaw empty to create an uninitialized pose object, and then call HMS_AREngine_ARPoint_GetPose and HMS_AREngine_ARAnchor_GetPose to assign a value to the pose object.

void HMS_AREngine_ARPose_Destroy(AREngine_ARPose *pose)

Releases the memory used by the pose object.

AREngine_ARStatus HMS_AREngine_ARPose_GetPoseRaw(const AREngine_ARSession *session, const AREngine_ARPose *pose, float *outPoseRaw, int32_t poseRawSize)

Obtains pose data from the pose object, including translation components and rotation components. The obtained pose data is an array with 7 elements: poseRaw[0] to poseRaw[3] are rotation quaternions, and poseRaw[4] to poseRaw[6] are translation components (x, y, z).

AREngine_ARStatus HMS_AREngine_ARPose_GetMatrix(const AREngine_ARSession *session, const AREngine_ARPose *pose, float *outMatrixColMajor4x4, int32_t matrixColMajor4x4Size)

Converts the pose data into a 4 x 4 matrix. outMatrixColMajor4x4 is the array for storing the matrix, where data is stored in column-major order. Coordinates in the local coordinate system can be converted into ones in the world coordinate system by multiplying this matrix with the coordinates in the local coordinate system.

AREngine_ARStatus HMS_AREngine_ARCamera_GetPose(const AREngine_ARSession *session, const AREngine_ARCamera *camera, AREngine_ARPose *outPose)

Sets outPose to the pose of the physical camera in the world space in the latest frame. The pose is that of the OpenGL camera, where the positive direction of the x-axis is to the right, the positive direction of the y-axis is upwards, and the negative direction of the z-axis is the look-at direction of the camera. The camera position refers to the physical camera position, and the orientation of the camera's x-axis and y-axis is not affected by the screen orientation (taking display rotation into account).

AREngine_ARStatus HMS_AREngine_ARCamera_GetDisplayOrientedPose(const AREngine_ARSession *session, const AREngine_ARCamera *camera, AREngine_ARPose *outPose)

Sets outPose to the pose of the virtual camera (facing the display) in the world space, in order to render AR content into the latest frame. The pose is that of the OpenGL camera, where the positive direction of the x-axis is to the right, the positive direction of the y-axis is upwards, and the negative direction of the z-axis is the look-at direction of the camera. The camera position refers to the physical camera position, and the orientation of the camera's x-axis and y-axis is affected by the screen orientation (taking display rotation into account).

AREngine_ARStatus HMS_AREngine_ARCamera_GetViewMatrix(const AREngine_ARSession *session, const AREngine_ARCamera *camera, float *outColMajor4x4, int32_t colMajor4x4Num)

Obtains the view matrix of the camera in the latest frame.

AREngine_ARStatus HMS_AREngine_ARCamera_GetTrackingState(const AREngine_ARSession *session, const AREngine_ARCamera *camera, AREngine_ARTrackingState *outTrackingState)

Obtains the current tracking status of the camera. The camera pose is available only when the tracking status is ARENGINE_TRACKING_STATE_TRACKING.

AREngine_ARStatus HMS_AREngine_ARCamera_GetTrackingStateReason(const AREngine_ARSession *session, const AREngine_ARCamera *camera, AREngine_ARTrackingStateReason *outTrackingStateReason)

Obtains the reason why the current tracking status of the camera is ARENGINE_TRACKING_STATE_PAUSED. When the current tracking status of the camera is ARENGINE_TRACKING_STATE_TRACKING, the function returns ARENGINE_TRACKING_STATE_REASON_NONE.

AREngine_ARStatus HMS_AREngine_ARCamera_GetProjectionMatrix(const AREngine_ARSession *session, const AREngine_ARCamera *camera, AREngine_ClipPlaneDistance clipPlaneDistance, float *outDestColMajor4x4, int32_t destColMajor4x4Num)

Obtains the projection matrix used for rendering virtual content on top of the camera image. This matrix can be used for converting from the camera coordinate system to the clip coordinate system.

AREngine_ARStatus HMS_AREngine_ARCamera_GetImageIntrinsics(const AREngine_ARSession *session, const AREngine_ARCamera *camera, AREngine_ARCameraIntrinsics *outIntrinsics)

Obtains the object of the offline intrinsic camera parameters. This object can be used obtain the camera's focal length, image size, principal point, and distortion parameters.

void HMS_AREngine_ARCamera_Release(AREngine_ARCamera *camera)

Releases the reference to the camera. You need to call HMS_AREngine_ARCamera_Release if you have called HMS_AREngine_ARFrame_AcquireCamera. Calling this method before HMS_AREngine_ARFrame_AcquireCamera is called does not take effect.

AREngine_ARStatus HMS_AREngine_ARCameraIntrinsics_Create(const AREngine_ARSession *session, AREngine_ARCameraIntrinsics **outIntrinsics)

Creates an object of the intrinsic camera parameters.

void HMS_AREngine_ARCameraIntrinsics_Destroy(AREngine_ARCameraIntrinsics *intrinsics)

Releases a specific object of intrinsic camera parameters.

AREngine_ARStatus HMS_AREngine_ARCameraIntrinsics_GetFocalLength(const AREngine_ARSession *session, const AREngine_ARCameraIntrinsics *intrinsics, float *outFocalX, float *outFocalY)

Obtains the focal length of a camera in pixels.

AREngine_ARStatus HMS_AREngine_ARCameraIntrinsics_GetPrincipalPoint(const AREngine_ARSession *session, const AREngine_ARCameraIntrinsics *intrinsics, float *outPrincipalX, float *outPrincipalY)

Obtains the principal point of a camera, with the location of the point expressed in pixels.

AREngine_ARStatus HMS_AREngine_ARCameraIntrinsics_GetImageDimensions(const AREngine_ARSession *session, const AREngine_ARCameraIntrinsics *intrinsics, int32_t *outWidth, int32_t *outHeight)

Obtains the camera image size, including the width and height (in pixels).

AREngine_ARStatus HMS_AREngine_ARCameraIntrinsics_GetDistortion(const AREngine_ARSession *session, const AREngine_ARCameraIntrinsics *intrinsics, float *outDistortion, int32_t distortionNum)

Obtains a camera's distortion coefficients, which include 5 components: outDistortion[0] to outDistortion [2] represent k1, k2, and k3 (radial distortion coefficients), and outDistortion [3] to outDistortion [4] are the tangential distortion coefficients.

AREngine_ARStatus HMS_AREngine_ARFrame_Create(const AREngine_ARSession *session, AREngine_ARFrame **outFrame)

Creates an AREngine_ARFrame object and stores the pointer in *outFrame.

void HMS_AREngine_ARFrame_Destroy(AREngine_ARFrame *frame)

Deletes the current AREngine_ARFrame object.

AREngine_ARStatus HMS_AREngine_ARFrame_GetDisplayGeometryChanged(const AREngine_ARSession *session, const AREngine_ARFrame *frame, int32_t *outGeometryChangeState)

Obtains whether the display (length, width, and rotation) changes. If so, you need to call HMS_AREngine_ARFrame_TransformDisplayUvCoords again to obtain the correct coordinates of the texture map. If the return value of outGeometryChangeState is 0, no changes have occurred. Otherwise, changes have occurred.

AREngine_ARStatus HMS_AREngine_ARFrame_GetTimestamp(const AREngine_ARSession *session, const AREngine_ARFrame *frame, int64_t *outTimestampNs)

Obtains the timestamp information (in nanoseconds) of the current frame.

AREngine_ARStatus HMS_AREngine_ARFrame_TransformDisplayUvCoords(const AREngine_ARSession *session, const AREngine_ARFrame *frame, int32_t elementSize, const float *uvsIn, float *uvsOut)

Converts the texture coordinates so that the background image captured by the camera can be correctly displayed.

AREngine_ARStatus HMS_AREngine_ARFrame_HitTest(const AREngine_ARSession *session, const AREngine_ARFrame *frame, float pixelX, float pixelY, AREngine_ARHitResultList *hitResultList)

Casts a ray from the camera, with the direction of the ray determined by the points (pixelX, pixelY) in the preview area. pixelX and pixelY can be obtained through the XComponent's DispatchTouchEvent() event.

AREngine_ARStatus HMS_AREngine_ARFrame_AcquirePointCloud(const AREngine_ARSession *session, const AREngine_ARFrame *frame, AREngine_ARPointCloud **outPointCloud)

Returns the point cloud data of the current frame.

AREngine_ARStatus HMS_AREngine_ARFrame_AcquireCamera(const AREngine_ARSession *session, const AREngine_ARFrame *frame, AREngine_ARCamera **outCamera)

Obtains the camera parameter object of the current frame.

AREngine_ARStatus HMS_AREngine_ARFrame_GetUpdatedTrackables(const AREngine_ARSession *session, const AREngine_ARFrame *frame, AREngine_ARTrackableType filterType, AREngine_ARTrackableList *outTrackableList)

Obtains the updated trackable object of the specified type after HMS_AREngine_ARSession_Update is called.

AREngine_ARStatus HMS_AREngine_ARFrame_AcquireCameraImage(const AREngine_ARSession *session, const AREngine_ARFrame *frame, AREngine_ARImage **outImage)

Obtains the image of the current frame of the camera.

AREngine_ARStatus HMS_AREngine_ARPointCloud_GetData(const AREngine_ARSession *session, const AREngine_ARPointCloud *pointCloud, const float **outPointCloudData)

Obtains the coordinates of all points in a point cloud, as well as their confidence array.

AREngine_ARStatus HMS_AREngine_ARPointCloud_GetNumberOfPoints(const AREngine_ARSession *session, const AREngine_ARPointCloud *pointCloud, int32_t *outNumberOfPoints)

Obtains the coordinates of all points in a point cloud, as well as their confidence array size. This function is used together with HMS_AREngine_ARPointCloud_GetData.

AREngine_ARStatus HMS_AREngine_ARPointCloud_GetTimestamp(const AREngine_ARSession *session, const AREngine_ARPointCloud *pointCloud, int64_t *outTimestampNs)

Obtains the timestamp when the current point cloud is detected, in nanoseconds.

void HMS_AREngine_ARPointCloud_Release(AREngine_ARPointCloud *pointCloud)

Releases the memory used by the point cloud object.

AREngine_ARStatus HMS_AREngine_ARAnchor_GetPose(const AREngine_ARSession *session, const AREngine_ARAnchor *anchor, AREngine_ARPose *outPose)

Obtains the pose of a specific anchor in the world coordinate system.

AREngine_ARStatus HMS_AREngine_ARAnchor_GetTrackingState(const AREngine_ARSession *session, const AREngine_ARAnchor *anchor, AREngine_ARTrackingState *outTrackingState)

Obtains the tracking status of the pose of a specific anchor.

AREngine_ARStatus HMS_AREngine_ARAnchor_Detach(AREngine_ARSession *session, AREngine_ARAnchor *anchor)

Instructs AR Engine to stop tracking and unbinds an anchor. However, this function does not release the anchor. You need to release the anchor by calling HMS_AREngine_ARAnchor_Release.

void HMS_AREngine_ARAnchor_Release(AREngine_ARAnchor *anchor)

Releases the memory used by a specific anchor object. Before releasing the memory, instruct AR Engine to stop tracking and unbind the anchor.

AREngine_ARStatus HMS_AREngine_ARTrackableList_Create(const AREngine_ARSession *session, AREngine_ARTrackableList **outTrackableList)

Creates a list of trackable objects.

void HMS_AREngine_ARTrackableList_Destroy(AREngine_ARTrackableList *trackableList)

Releases the list of trackable objects, along with all the anchor references it holds.

AREngine_ARStatus HMS_AREngine_ARTrackableList_GetSize(const AREngine_ARSession *session, const AREngine_ARTrackableList *trackableList, int32_t *outSize)

Obtains the number of trackable objects in the list.

AREngine_ARStatus HMS_AREngine_ARTrackableList_AcquireItem(const AREngine_ARSession *session, const AREngine_ARTrackableList *trackableList, int32_t index, AREngine_ARTrackable **outTrackable)

Obtains the object at a specific index from the trackable object list.

void HMS_AREngine_ARTrackable_Release(AREngine_ARTrackable *trackable)

Releases a trackable object.

AREngine_ARStatus HMS_AREngine_ARTrackable_GetType(const AREngine_ARSession *session, const AREngine_ARTrackable *trackable, AREngine_ARTrackableType *outTrackableType)

Obtains the type of a trackable object.

AREngine_ARStatus HMS_AREngine_ARTrackable_GetTrackingState(const AREngine_ARSession *session, const AREngine_ARTrackable *trackable, AREngine_ARTrackingState *outTrackingState)

Obtains the tracking status of the current trackable object.

AREngine_ARStatus HMS_AREngine_ARTrackable_AcquireNewAnchor(AREngine_ARSession *session, AREngine_ARTrackable *trackable, AREngine_ARPose *pose, AREngine_ARAnchor **outAnchor)

Creates an anchor object using the pose information of the trackable object. This anchor will be bound to the current trackable object.

AREngine_ARStatus HMS_AREngine_ARTrackable_GetAnchors(AREngine_ARSession *session, const AREngine_ARTrackable *trackable, AREngine_ARAnchorList *outAnchorList)

Obtains a list of anchor objects bound to the input trackable objects.

AREngine_ARStatus HMS_AREngine_ARPlane_AcquireSubsumedBy(const AREngine_ARSession *session, const AREngine_ARPlane *plane, AREngine_ARPlane **outSubsumedBy)

Obtains the parent plane of a plane (a parent plane is generated when a plane is merged with another one). If there is no parent plane, NULL is returned.

AREngine_ARStatus HMS_AREngine_ARPlane_GetType(const AREngine_ARSession *session, const AREngine_ARPlane *plane, AREngine_ARPlaneType *outPlaneType)

Obtains the plane type.

AREngine_ARStatus HMS_AREngine_ARPlane_GetCenterPose(const AREngine_ARSession *session, const AREngine_ARPlane *plane, AREngine_ARPose *outPose)

Obtains the pose information for the conversion from the local coordinate system of a plane to the world coordinate system.

AREngine_ARStatus HMS_AREngine_ARPlane_GetLabel(const AREngine_ARSession *session, const AREngine_ARPlane *plane, AREngine_ARSemanticPlaneLabel *label)

Obtains the semantic type of a plane, such as desktop and floor. When using this function, you need to call HMS_AREngine_ARConfig_SetSemanticMode to enable the semantic recognition mode.

AREngine_ARStatus HMS_AREngine_ARPlane_GetExtentX(const AREngine_ARSession *session, const AREngine_ARPlane *plane, float *outExtentX)

Obtains the length of the plane's bounding rectangle along the x-axis of the plane's local coordinate system, such as the width of the rectangle.

AREngine_ARStatus HMS_AREngine_ARPlane_GetExtentZ(const AREngine_ARSession *session, const AREngine_ARPlane *plane, float *outExtentZ)

Obtains the length of the plane's bounding rectangle along the z-axis of the plane's local coordinate system, such as the height of the rectangle.

AREngine_ARStatus HMS_AREngine_ARPlane_GetPolygonSize(const AREngine_ARSession *session, const AREngine_ARPlane *plane, int32_t *outPolygonSize)

Obtains the size of the 2D vertex array of the detected plane. This function is used together with HMS_AREngine_ARPlane_GetPolygon.

AREngine_ARStatus HMS_AREngine_ARPlane_GetPolygon(const AREngine_ARSession *session, const AREngine_ARPlane *plane, float *outPolygonXz, int32_t polygonSize)

Obtains the 2D vertex array of the detected plane, in the format of [x1, z1, x2, z2, ...].

AREngine_ARStatus HMS_AREngine_ARPlane_IsPoseInExtents(const AREngine_ARSession *session, const AREngine_ARPlane *plane, const AREngine_ARPose *pose, int32_t *outPoseInExtents)

Checks whether a pose is within the plane's bounding rectangle.

AREngine_ARStatus HMS_AREngine_ARPlane_IsPoseInPolygon(const AREngine_ARSession *session, const AREngine_ARPlane *plane, const AREngine_ARPose *pose, int32_t *outPoseInPolygon)

Checks whether a pose is within the plane's bounding polygon.

AREngine_ARStatus HMS_AREngine_ARPoint_GetOrientationMode(const AREngine_ARSession *session, const AREngine_ARPoint *point, AREngine_ARPointOrientationMode *outOrientationMode)

Obtains the orientation mode of an input point.

AREngine_ARStatus HMS_AREngine_ARPoint_GetPose(const AREngine_ARSession *session, const AREngine_ARPoint *point, AREngine_ARPose *outPose)

Obtains the pose information of an input point.

AREngine_ARStatus HMS_AREngine_ARHitResultList_Create(const AREngine_ARSession *session, AREngine_ARHitResultList **outHitResultList)

Creates a list of hit testing result objects.

void HMS_AREngine_ARHitResultList_Destroy(AREngine_ARHitResultList *hitResultList)

Releases the list of hit testing result objects, as well as all hit testing result objects in the list.

AREngine_ARStatus HMS_AREngine_ARHitResultList_GetSize(const AREngine_ARSession *session, const AREngine_ARHitResultList *hitResultList, int32_t *outSize)

Obtains the number of objects in the hit testing result object list.

AREngine_ARStatus HMS_AREngine_ARHitResultList_GetItem(const AREngine_ARSession *session, const AREngine_ARHitResultList *hitResultList, int32_t index, AREngine_ARHitResult *outHitResult)

Obtains the hit testing result object at a specific index from the hit testing result list.

AREngine_ARStatus HMS_AREngine_ARHitResult_Create(const AREngine_ARSession *session, AREngine_ARHitResult **outHitResult)

Creates an empty hit testing result object.

void HMS_AREngine_ARHitResult_Destroy(AREngine_ARHitResult *hitResult)

Releases the memory used by the hit testing result object.

AREngine_ARStatus HMS_AREngine_ARHitResult_GetDistance(const AREngine_ARSession *session, const AREngine_ARHitResult *hitResult, float *outDistance)

Obtains the distance from the camera to the hit location, in meters.

AREngine_ARStatus HMS_AREngine_ARHitResult_GetHitPose(const AREngine_ARSession *session, const AREngine_ARHitResult *hitResult, AREngine_ARPose *outPose)

Obtains the pose of an intersection. The pose's translation component corresponds to the intersection's coordinates in the world coordinate system, while its rotation component varies according to the type of the intersection (such as the intersection with a plane or a point cloud).

AREngine_ARStatus HMS_AREngine_ARHitResult_AcquireTrackable(const AREngine_ARSession *session, const AREngine_ARHitResult *hitResult, AREngine_ARTrackable **outTrackable)

Obtains the trackable object that is hit.

AREngine_ARStatus HMS_AREngine_ARHitResult_AcquireNewAnchor(AREngine_ARSession *session, AREngine_ARHitResult *hitResult, AREngine_ARAnchor **outAnchor)

Creates an anchor at the intersection.

AREngine_ARStatus HMS_AREngine_ARTarget_GetCenterPose(const AREngine_ARSession *session, const AREngine_ARTarget *target, AREngine_ARPose *outARPose)

Obtains the pose object for the conversion from the local coordinate system of the target semantic object to the world coordinate system.

AREngine_ARStatus HMS_AREngine_ARTarget_GetAxisAlignedBoundingBox(const AREngine_ARSession *session, const AREngine_ARTarget *target, float *outAabb, int32_t aabbSize)

Obtains the coordinates of the minimum bounding box of a semantic object, in the format of (xmin, ymin, zmin, xmax, ymax, zmax).

AREngine_ARStatus HMS_AREngine_ARTarget_GetRadius(const AREngine_ARSession *session, const AREngine_ARTarget *target, float *radius)

Obtains the sphere radius of a semantic object.

AREngine_ARStatus HMS_AREngine_ARTarget_GetShapeType(const AREngine_ARSession *session, const AREngine_ARTarget *target, AREngine_ARTargetShapeLabel *shape)

Obtains the shape type of a semantic object.

AREngine_ARStatus HMS_AREngine_ARAnchorList_Create(const AREngine_ARSession *session, AREngine_ARAnchorList **outAnchorList)

Creates a list of anchor objects.

void HMS_AREngine_ARAnchorList_Destroy(AREngine_ARAnchorList *anchorList)

Releases a list of anchor objects.

AREngine_ARStatus HMS_AREngine_ARAnchorList_GetSize(const AREngine_ARSession *session, const AREngine_ARAnchorList *anchorList, int32_t *outSize)

Obtains the number of anchors in the anchor object list.

AREngine_ARStatus HMS_AREngine_ARAnchorList_AcquireItem(const AREngine_ARSession *session, const AREngine_ARAnchorList *anchorList, int32_t index, AREngine_ARAnchor **outAnchor)

Obtains the anchor at a specific location from the anchor object list.

AREngine_ARStatus HMS_AREngine_ARCameraConfig_Create(const AREngine_ARSession *session, AREngine_ARCameraConfig **outCameraConfig)

Creates a camera configuration object.

void HMS_AREngine_ARCameraConfig_Destroy(AREngine_ARCameraConfig *cameraConfig)

Releases a camera configuration object.

AREngine_ARStatus HMS_AREngine_ARCameraConfig_GetImageDimensions(const AREngine_ARSession *session, const AREngine_ARCameraConfig *cameraConfig, int32_t *outWidth, int32_t *outHeight)

Obtains the size of the image sent by the camera to the CPU for processing from a camera configuration object.

AREngine_ARStatus HMS_AREngine_ARCameraConfig_GetTextureDimensions(const AREngine_ARSession *session, const AREngine_ARCameraConfig *cameraConfig, int32_t *outWidth, int32_t *outHeight)

Obtains the size of the image texture sent by the camera to the GPU for processing from a camera configuration object.

AREngine_ARStatus HMS_AREngine_ARImage_GetFormat(const AREngine_ARSession *session, const AREngine_ARImage *image, AREngine_ARImageFormat *outFormat)

Obtains the image data of the current frame.

AREngine_ARStatus HMS_AREngine_ARImage_GetWidth(const AREngine_ARSession *session, const AREngine_ARImage *image, int32_t *outWidth)

Obtains the image width of the current frame.

AREngine_ARStatus HMS_AREngine_ARImage_GetHeight(const AREngine_ARSession *session, const AREngine_ARImage *image, int32_t *outHeight)

Obtains the image height of the current frame.

AREngine_ARStatus HMS_AREngine_ARImage_GetPlaneCount(const AREngine_ARSession *session, const AREngine_ARImage *image, int32_t *outCount)

Obtains the number of planes in the current frame.

AREngine_ARStatus HMS_AREngine_ARImage_GetPlaneData(const AREngine_ARSession *session, const AREngine_ARImage *image, int32_t planeIndex, const uint8_t **outData, int32_t *outLength)

Obtains the plane data in the current frame.

AREngine_ARStatus HMS_AREngine_ARImage_GetPlanePixelStride(const AREngine_ARSession *session, const AREngine_ARImage *image, int32_t planeIndex, int32_t *outPixelStride)

Obtains the distance between the start points of two consecutive pixels in an image, in bytes. The pixel stride is always greater than 0.

AREngine_ARStatus HMS_AREngine_ARImage_GetPlaneRowStride(const AREngine_ARSession *session, const AREngine_ARImage *image, int32_t planeIndex, int32_t *outRowStride)

Obtains the number of bytes between the start positions of two consecutive pixel lines in an image. The line spacing is always greater than 0.

AREngine_ARStatus HMS_AREngine_ARImage_GetTimestamp(const AREngine_ARSession *session, const AREngine_ARImage *image, int64_t *outTimestamp)

Gets the timestamp of an image (in nanoseconds). Timestamps are usually monotonically increasing. The specific meaning and time base of the timestamp depend on the image source. Timestamps of images from different sources may have different time bases, so they should not be compared with each other.

void HMS_AREngine_ARImage_Release(AREngine_ARImage *image)

Releases the image object of the current frame, that is, the object created by HMS_AREngine_ARFrame_AcquireCameraImage.

AREngine_ARStatus HMS_AREngine_ARConfig_SetCameraPreviewMode(const AREngine_ARSession *session, AREngine_ARConfig *config, AREngine_ARPreviewMode mode)

Sets the preview mode.

AREngine_ARStatus HMS_AREngine_ARConfig_GetCameraPreviewMode(const AREngine_ARSession *session, AREngine_ARConfig *config, AREngine_ARPreviewMode *outMode)

Obtains the current preview mode.