Skip to main content
Version: 12 Dec 2024

CV Camera

APIs for camera pose. More...

Enums

Name
enumMLCVCameraID
{
MLCVCameraID_ColorCamera = 0,
MLCVCameraID_Ensure32Bits = 0x7FFFFFFF
}
Camera id enum.

Functions

Name
MLResultMLCVCameraTrackingCreate(MLHandle * out_handle)
Create CV Camera Tracker.
MLResultMLCVCameraGetFramePose(MLHandle camera_handle, MLHandle head_handle, MLCVCameraID id, MLTime camera_timestamp, MLTransform * out_transform)
Get the camera pose in the world coordinate system.
MLResultMLCVCameraTrackingDestroy(MLHandle camera_handle)
Destroy Tracker after usage.

Detailed Description

APIs for camera pose.

Shared Object:

  • perception.magicleap*

Enums Documentation

MLCVCameraID

EnumeratorValueDescription
MLCVCameraID_ColorCamera0Default camera id.
MLCVCameraID_Ensure32Bits0x7FFFFFFFCamera id.

Camera id enum.

API Level:

  • 5

Functions Documentation

MLCVCameraTrackingCreate

MLResult MLCVCameraTrackingCreate(
MLHandle * out_handle
)

Create CV Camera Tracker.

Parameters

MLHandle *out_handleTracker handle.

Returns

MLResultMLResult_OkOn success.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.
MLResultMLResult_PermissionDeniedNecessary permission is missing.

Required Permissions:

  • android.permission.CAMERA (protection level: dangerous)

API Level:

  • 5

MLCVCameraGetFramePose

MLResult MLCVCameraGetFramePose(
MLHandle camera_handle,
MLHandle head_handle,
MLCVCameraID id,
MLTime camera_timestamp,
MLTransform * out_transform
)

Get the camera pose in the world coordinate system.

Parameters

MLHandlecamera_handleMLHandle previously created with MLCVCameraTrackingCreate.
MLHandlehead_handleMLHandle previously created with MLHeadTrackingCreate.
MLCVCameraIDidCamera id.
MLTimecamera_timestampTime to request the pose.
MLTransform *out_transformTransform from camera to world origin.

Returns

MLResultMLResult_InvalidParamid parameter was not valid or out_transform parameter was not valid (null).
MLResultMLResult_OkObtained transform successfully.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.
MLResultMLResult_PoseNotFoundPose is currently not available.
MLResultMLResult_UnspecifiedFailureFailed to obtain transform due to internal error.

Required Permissions:

  • None

Use the timestamp provided from the #on_video_buffer_available callback from ml_camera_v2.h. The camera tracker only caches a limited set of poses. Retrieve the camera pose as soon as the timestamp is available else the API may return MLResult_PoseNotFound.

API Level:

  • 5

MLCVCameraTrackingDestroy

MLResult MLCVCameraTrackingDestroy(
MLHandle camera_handle
)

Destroy Tracker after usage.

Parameters

MLHandlecamera_handleMLHandle previously created with MLCVCameraTrackingCreate.

Returns

MLResultMLResult_OkOn success.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.

Required Permissions:

  • None

API Level:

  • 5