ml_cv_camera.h
Enums
Name | |
---|---|
enum | MLCVCameraID { MLCVCameraID_ColorCamera = 0, MLCVCameraID_Ensure32Bits = 0x7FFFFFFF } Camera id enum. |
Functions
Name | |
---|---|
MLResult | MLCVCameraTrackingCreate(MLHandle * out_handle) Create CV Camera Tracker. |
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. |
MLResult | MLCVCameraTrackingDestroy(MLHandle camera_handle) Destroy Tracker after usage. |
Enums Documentation
MLCVCameraID
Enumerator | Value | Description |
---|---|---|
MLCVCameraID_ColorCamera | 0 | Default camera id. |
MLCVCameraID_Ensure32Bits | 0x7FFFFFFF | Camera id. |
Camera id enum.
API Level:
- 5
Functions Documentation
MLCVCameraTrackingCreate
MLResult MLCVCameraTrackingCreate(
MLHandle * out_handle
)
Create CV Camera Tracker.
Parameters
MLHandle * | out_handle | Tracker handle. |
Returns
MLResult | MLResult_Ok | On success. |
MLResult | MLResult_PerceptionSystemNotStarted | Perception System has not been started. |
MLResult | MLResult_PermissionDenied | Necessary 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
MLHandle | camera_handle | MLHandle previously created with MLCVCameraTrackingCreate. |
MLHandle | head_handle | MLHandle previously created with MLHeadTrackingCreate. |
MLCVCameraID | id | Camera id. |
MLTime | camera_timestamp | Time to request the pose. |
MLTransform * | out_transform | Transform from camera to world origin. |
Returns
MLResult | MLResult_InvalidParam | id parameter was not valid or out_transform parameter was not valid (null). |
MLResult | MLResult_Ok | Obtained transform successfully. |
MLResult | MLResult_PerceptionSystemNotStarted | Perception System has not been started. |
MLResult | MLResult_PoseNotFound | Pose is currently not available. |
MLResult | MLResult_UnspecifiedFailure | Failed 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
MLHandle | camera_handle | MLHandle previously created with MLCVCameraTrackingCreate. |
Returns
MLResult | MLResult_Ok | On success. |
MLResult | MLResult_PerceptionSystemNotStarted | Perception System has not been started. |
Required Permissions:
- None
API Level:
- 5
Source code
// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2017 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement,
// located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying
// this distribution may also be found in the top-level NOTICE file
// appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%
#pragma once
#include "ml_api.h"
#include "ml_types.h"
ML_EXTERN_C_BEGIN
typedef enum MLCVCameraID {
MLCVCameraID_ColorCamera = 0,
MLCVCameraID_Ensure32Bits = 0x7FFFFFFF
} MLCVCameraID;
ML_API MLResult ML_CALL MLCVCameraTrackingCreate(MLHandle *out_handle);
ML_API MLResult ML_CALL MLCVCameraGetFramePose(MLHandle camera_handle, MLHandle head_handle, MLCVCameraID id, MLTime camera_timestamp, MLTransform *out_transform);
ML_API MLResult ML_CALL MLCVCameraTrackingDestroy(MLHandle camera_handle);
ML_EXTERN_C_END