World Camera
Module: Pixel Sensors
APIs to access the world camera data. More...
Classes
Name | |
---|---|
struct | MLWorldCameraSettings A structure to encapsulate the camera settings. |
struct | MLWorldCameraIntrinsics World camera intrinsic parameters. |
struct | MLWorldCameraFrameBuffer A structure to encapsulate per plane info for each camera frame. |
struct | MLWorldCameraFrame A structure to encapsulate output data for each camera sensor. |
struct | MLWorldCameraData A structure to encapsulate output data for each camera sensor. |
Types
Name | |
---|---|
typedef struct MLWorldCameraSettings | MLWorldCameraSettings A structure to encapsulate the camera settings. |
typedef struct MLWorldCameraIntrinsics | MLWorldCameraIntrinsics World camera intrinsic parameters. |
typedef struct MLWorldCameraFrameBuffer | MLWorldCameraFrameBuffer A structure to encapsulate per plane info for each camera frame. |
typedef struct MLWorldCameraFrame | MLWorldCameraFrame A structure to encapsulate output data for each camera sensor. |
typedef struct MLWorldCameraData | MLWorldCameraData A structure to encapsulate output data for each camera sensor. |
Enums
Name | |
---|---|
enum | Anonymous Enum 32 { MLWorldCameraIntrinsics_MaxRadialDistortionCoefficients = 4, MLWorldCameraIntrinsics_MaxTangentialDistortionCoefficients = 2 } |
enum | MLWorldCameraIdentifier { MLWorldCameraIdentifier_None = 0, MLWorldCameraIdentifier_Left = 1 << 0, MLWorldCameraIdentifier_Right = 1 << 1, MLWorldCameraIdentifier_Center = 1 << 2, MLWorldCameraIdentifier_All = MLWorldCameraIdentifier_Left |
MLWorldCameraIdentifier_Right | |
MLWorldCameraIdentifier_Center, MLWorldCameraIdentifier_Ensure32Bits = 0x7FFFFFFF } Camera Identifier. | |
enum | MLWorldCameraMode { MLWorldCameraMode_Unknown = 0, MLWorldCameraMode_LowExposure = 1 << 0, MLWorldCameraMode_NormalExposure = 1 << 1, MLWorldCameraMode_Ensure32Bits = 0x7FFFFFFF } Enumeration of world camera modes. |
enum | MLWorldCameraFrameType { MLWorldCameraFrameType_Unknown = 0, MLWorldCameraFrameType_LowExposure = 1, MLWorldCameraFrameType_NormalExposure = 2, MLWorldCameraFrameType_Ensure32Bits = 0x7FFFFFFF } Enumeration of camera mode used when capturing a frame. |
Functions
Name | |
---|---|
void | MLWorldCameraSettingsInit(MLWorldCameraSettings * inout_handle) Initialize the camera settings structure. Shall be called before calling MLWorldCameraConnect(). |
void | MLWorldCameraDataInit(MLWorldCameraData * inout_world_camera_data) Initialize MLWorldCameraData with version. |
MLResult | MLWorldCameraConnect(const MLWorldCameraSettings settings, MLHandle out_handle) Connect to world cameras. |
MLResult | MLWorldCameraUpdateSettings(MLHandle handle, const MLWorldCameraSettings * settings) Update the world camera settings. |
MLResult | MLWorldCameraGetLatestWorldCameraData(MLHandle handle, uint64_t timeout_ms, MLWorldCameraData ** out_data) Poll for Frames. |
MLResult | MLWorldCameraReleaseCameraData(MLHandle handle, MLWorldCameraData * world_camera_data) Releases specified MLWorldCameraData object. |
MLResult | MLWorldCameraDisconnect(MLHandle handle) Disconnect from world camera. |
Detailed Description
APIs to access the world camera data.
Magic Leap 2 has three world cameras which it uses for environment tracking. The three cameras area located on the left, center, and right side of the headset. This API will provide a way to query for the frames from these world cameras, at this point the app will not be able to configure the world camera parameters.
\experimental This is an experimental API which may be modified or removed without any prior notice.
Enums Documentation
Anonymous Enum 32
Enumerator | Value | Description |
---|---|---|
MLWorldCameraIntrinsics_MaxRadialDistortionCoefficients | 4 | Default radial distortion vector size. |
MLWorldCameraIntrinsics_MaxTangentialDistortionCoefficients | 2 | Default tangential distortion vector size. |
MLWorldCameraIdentifier
Enumerator | Value | Description |
---|---|---|
MLWorldCameraIdentifier_None | 0 | None. |
MLWorldCameraIdentifier_Left | 1 << 0 | Left World camera. |
MLWorldCameraIdentifier_Right | 1 << 1 | Right World camera. |
MLWorldCameraIdentifier_Center | 1 << 2 | Center World camera. |
MLWorldCameraIdentifier_All | MLWorldCameraIdentifier_Left | |
MLWorldCameraIdentifier_Right | ||
MLWorldCameraIdentifier_Center | All World cameras. | |
MLWorldCameraIdentifier_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Camera Identifier.
Enumeration of all the available world camera sensors.
MLWorldCameraMode
Enumerator | Value | Description |
---|---|---|
MLWorldCameraMode_Unknown | 0 | None. |
MLWorldCameraMode_LowExposure | 1 << 0 | Low exposure mode. This mode is currently only available when the controller is being tracked. |
MLWorldCameraMode_NormalExposure | 1 << 1 | Normal exposure mode. |
MLWorldCameraMode_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Enumeration of world camera modes.
MLWorldCameraFrameType
Enumerator | Value | Description |
---|---|---|
MLWorldCameraFrameType_Unknown | 0 | None. |
MLWorldCameraFrameType_LowExposure | 1 | Frame captured using MLWorldCameraMode_LowExposure mode. |
MLWorldCameraFrameType_NormalExposure | 2 | Frame captured using MLWorldCameraMode_NormalExposure mode. |
MLWorldCameraFrameType_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Enumeration of camera mode used when capturing a frame.
Types Documentation
MLWorldCameraSettings
typedef struct MLWorldCameraSettings MLWorldCameraSettings;
A structure to encapsulate the camera settings.
This structure must be initialized by calling MLWorldCameraSettingsInit before use.
API Level:
- 23
MLWorldCameraIntrinsics
typedef struct MLWorldCameraIntrinsics MLWorldCameraIntrinsics;
World camera intrinsic parameters.
API Level:
- 23
MLWorldCameraFrameBuffer
typedef struct MLWorldCameraFrameBuffer MLWorldCameraFrameBuffer;
A structure to encapsulate per plane info for each camera frame.
API Level:
- 23
MLWorldCameraFrame
typedef struct MLWorldCameraFrame MLWorldCameraFrame;
A structure to encapsulate output data for each camera sensor.
API Level:
- 23
MLWorldCameraData
typedef struct MLWorldCameraData MLWorldCameraData;
A structure to encapsulate output data for each camera sensor.
This structure must be initialized by calling MLWorldCameraDataInit before use.
API Level:
- 23
Functions Documentation
MLWorldCameraSettingsInit
static inline void MLWorldCameraSettingsInit(
MLWorldCameraSettings * inout_handle
)
Initialize the camera settings structure. Shall be called before calling MLWorldCameraConnect().
Parameters
MLWorldCameraSettings * | inout_handle | MLWorldCameraSettings structure to initialize. |
Required Permissions:
- None
API Level:
- 23
MLWorldCameraDataInit
static inline void MLWorldCameraDataInit(
MLWorldCameraData * inout_world_camera_data
)
Initialize MLWorldCameraData with version.
Parameters
MLWorldCameraData * | inout_world_camera_data | Set up the version for inout_world_camera_data. |
API Level:
- 23
MLWorldCameraConnect
MLResult MLWorldCameraConnect(
const MLWorldCameraSettings * settings,
MLHandle * out_handle
)
Connect to world cameras.
Parameters
const MLWorldCameraSettings * | settings | A pointer to MLWorldCameraSettings structure. |
MLHandle * | out_handle | A pointer to camera handle to be used in later APIs. |
Returns
MLResult | MLResult_InvalidParam | One of the parameters is invalid. |
MLResult | MLResult_Ok | Connected to camera device(s) successfully. |
MLResult | MLResult_PermissionDenied | Necessary permission is missing. |
MLResult | MLResult_UnspecifiedFailure | The operation failed with an unspecified error. |
Required Permissions:
- android.permission.CAMERA (protection level: dangerous)
API Level:
- 23
MLWorldCameraUpdateSettings
MLResult MLWorldCameraUpdateSettings(
MLHandle handle,
const MLWorldCameraSettings * settings
)
Update the world camera settings.
Parameters
MLHandle | handle | Camera handle obtained from MLWorldCameraConnect. |
const MLWorldCameraSettings * | settings | Pointer to MLWorldCameraSettings. |
Returns
MLResult | MLResult_InvalidParam | Invalid handle. |
MLResult | MLResult_Ok | Settings updated successfully. |
MLResult | MLResult_UnspecifiedFailure | Failed due to internal error. |
Required Permissions:
- None
API Level:
- 23
MLWorldCameraGetLatestWorldCameraData
MLResult MLWorldCameraGetLatestWorldCameraData(
MLHandle handle,
uint64_t timeout_ms,
MLWorldCameraData ** out_data
)
Poll for Frames.
Parameters
MLHandle | handle | Camera handle obtained from MLWorldCameraConnect. |
uint64_t | timeout_ms | Timeout in milliseconds. |
MLWorldCameraData ** | out_data | World camera data. Will be set to NULL if no valid data is available at this time. |
Returns
MLResult | MLResult_InvalidParam | Invalid handle. |
MLResult | MLResult_Ok | World camera data fetched successfully. |
MLResult | MLResult_Timeout | Returned because no new frame available at this time. |
MLResult | MLResult_UnspecifiedFailure | Failed due to internal error. |
Required Permissions:
- None
Returns MLWorldCameraData with this latest data when available. The memory is owned by the system. Application should copy the data it needs to cache and release the memory by calling MLWorldCameraReleaseCameraData.
This is a blocking call. API is not thread safe.
If there are no new camera frames within the timeout_ms duration then the API will return MLResult_Timeout.
API Level:
- 23
MLWorldCameraReleaseCameraData
MLResult MLWorldCameraReleaseCameraData(
MLHandle handle,
MLWorldCameraData * world_camera_data
)
Releases specified MLWorldCameraData object.
Parameters
MLHandle | handle | Camera handle obtained from MLWorldCameraConnect. |
MLWorldCameraData * | world_camera_data | Pointer to a valid MLWorldCameraData object. |
Returns
MLResult | MLResult_Ok | Successfully released world camera data. |
MLResult | MLResult_InvalidParam | world_camera_data parameter was not valid (NULL). |
MLResult | MLResult_UnspecifiedFailure | Failed due to internal error. |
Required Permissions:
- None
This function should be called exactly once for each successfull call to #MLWorldCameraGetLatestCameraData.
MLWorldCameraDisconnect
MLResult MLWorldCameraDisconnect(
MLHandle handle
)
Disconnect from world camera.
Parameters
MLHandle | handle | Camera handle obtained from MLWorldCameraConnect. |
Returns
MLResult | MLResult_InvalidParam | Invalid handle. |
MLResult | MLResult_Ok | Disconnected camera successfully. |
MLResult | MLResult_UnspecifiedFailure | Failed to disconnect camera. |
Required Permissions:
- None
This will disconnect from all the world camera currently connected.
API Level:
- 23