Skip to main content
Version: 12 Dec 2024

Eye Camera

Module: Pixel Sensors

APIs to access the eye camera data. More...

Classes

Name
structMLEyeCameraSettings
A structure to encapsulate the camera settings.
structMLEyeCameraFrameBuffer
A structure to encapsulate per plane info for each camera frame.
structMLEyeCameraFrame
A structure to encapsulate output data for each camera sensor.
structMLEyeCameraData
A structure to encapsulate all the eye camera data.

Types

Name
typedef struct MLEyeCameraSettingsMLEyeCameraSettings
A structure to encapsulate the camera settings.
typedef struct MLEyeCameraFrameBufferMLEyeCameraFrameBuffer
A structure to encapsulate per plane info for each camera frame.
typedef struct MLEyeCameraFrameMLEyeCameraFrame
A structure to encapsulate output data for each camera sensor.
typedef struct MLEyeCameraDataMLEyeCameraData
A structure to encapsulate all the eye camera data.

Enums

Name
enumMLEyeCameraIdentifier
{
MLEyeCameraIdentifier_None = 0,
MLEyeCameraIdentifier_LeftTemple = 1 << 0,
MLEyeCameraIdentifier_LeftNasal = 1 << 1,
MLEyeCameraIdentifier_RightNasal = 1 << 2,
MLEyeCameraIdentifier_RightTemple = 1 << 3,
MLEyeCameraIdentifier_All = MLEyeCameraIdentifier_LeftTemple
MLEyeCameraIdentifier_LeftNasal
MLEyeCameraIdentifier_RightNasal
MLEyeCameraIdentifier_RightTemple,
MLEyeCameraIdentifier_Ensure32Bits = 0x7FFFFFFF
}
Camera Identifier.

Functions

Name
voidMLEyeCameraSettingsInit(MLEyeCameraSettings * inout_settings)
Initialize the camera settings structure. Shall be called before calling MLEyeCameraConnect().
voidMLEyeCameraDataInit(MLEyeCameraData * inout_eye_camera_data)
Initialize MLEyeCameraData with version.
MLResultMLEyeCameraConnect(const MLEyeCameraSettings settings, MLHandle out_handle)
Connect to eye cameras.
MLResultMLEyeCameraUpdateSettings(MLHandle handle, const MLEyeCameraSettings * settings)
Update the eye camera settings.
MLResultMLEyeCameraGetLatestCameraData(MLHandle handle, uint64_t timeout_ms, MLEyeCameraData * out_data)
Poll for Frames.
MLResultMLEyeCameraReleaseCameraData(MLHandle handle, MLEyeCameraData * eye_camera_data)
Releases specified MLEyeCameraData object.
MLResultMLEyeCameraDisconnect(MLHandle handle)
Disconnect from eye camera(s).

Detailed Description

APIs to access the eye camera data.

\experimental This is an experimental API which may be modified or removed without any prior notice.


Enums Documentation

MLEyeCameraIdentifier

EnumeratorValueDescription
MLEyeCameraIdentifier_None0None.
MLEyeCameraIdentifier_LeftTemple1 << 0Left temple eye camera.
MLEyeCameraIdentifier_LeftNasal1 << 1Left nasal eye camera.
MLEyeCameraIdentifier_RightNasal1 << 2Right nasal eye camera.
MLEyeCameraIdentifier_RightTemple1 << 3Right temple eye camera.
MLEyeCameraIdentifier_AllMLEyeCameraIdentifier_LeftTemple
MLEyeCameraIdentifier_LeftNasal
MLEyeCameraIdentifier_RightNasal
MLEyeCameraIdentifier_RightTempleAll Eye cameras.
MLEyeCameraIdentifier_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Camera Identifier.

Enumeration of all the available eye camera sensors.


Types Documentation

MLEyeCameraSettings

typedef struct MLEyeCameraSettings MLEyeCameraSettings;

A structure to encapsulate the camera settings.

This structure must be initialized by calling MLEyeCameraSettingsInit before use.

More Info

API Level:

  • 26

MLEyeCameraFrameBuffer

typedef struct MLEyeCameraFrameBuffer MLEyeCameraFrameBuffer;

A structure to encapsulate per plane info for each camera frame.

More Info

API Level:

  • 26

MLEyeCameraFrame

typedef struct MLEyeCameraFrame MLEyeCameraFrame;

A structure to encapsulate output data for each camera sensor.

More Info

API Level:

  • 26

MLEyeCameraData

typedef struct MLEyeCameraData MLEyeCameraData;

A structure to encapsulate all the eye camera data.

This structure must be initialized by calling MLEyeCameraDataInit before use.

More Info

API Level:

  • 26

Functions Documentation

MLEyeCameraSettingsInit

static inline void MLEyeCameraSettingsInit(
MLEyeCameraSettings * inout_settings
)

Initialize the camera settings structure. Shall be called before calling MLEyeCameraConnect().

Parameters

MLEyeCameraSettings *inout_settingsMLEyeCameraSettings structure to initialize.

Required Permissions:

  • None

API Level:

  • 26

MLEyeCameraDataInit

static inline void MLEyeCameraDataInit(
MLEyeCameraData * inout_eye_camera_data
)

Initialize MLEyeCameraData with version.

Parameters

MLEyeCameraData *inout_eye_camera_dataSet up the version for inout_eye_camera_data.

API Level:

  • 26

MLEyeCameraConnect

MLResult MLEyeCameraConnect(
const MLEyeCameraSettings * settings,
MLHandle * out_handle
)

Connect to eye cameras.

Parameters

const MLEyeCameraSettings *settingsA pointer to MLEyeCameraSettings structure.
MLHandle *out_handleA pointer to camera handle to be used in later APIs.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkConnected to camera device(s) successfully.
MLResultMLResult_PermissionDeniedNecessary permission is missing.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • com.magicleap.permission.EYE_CAMERA (protection level: dangerous)

API Level:

  • 26

MLEyeCameraUpdateSettings

MLResult MLEyeCameraUpdateSettings(
MLHandle handle,
const MLEyeCameraSettings * settings
)

Update the eye camera settings.

Parameters

MLHandlehandleCamera handle obtained from MLEyeCameraConnect.
const MLEyeCameraSettings *settingsPointer to MLEyeCameraSettings.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkSettings updated successfully.
MLResultMLResult_UnspecifiedFailureFailed due to internal error.

Required Permissions:

  • None

API Level:

  • 26

MLEyeCameraGetLatestCameraData

MLResult MLEyeCameraGetLatestCameraData(
MLHandle handle,
uint64_t timeout_ms,
MLEyeCameraData * out_data
)

Poll for Frames.

Parameters

MLHandlehandleCamera handle obtained from MLEyeCameraConnect.
uint64_ttimeout_msTimeout in milliseconds.
MLEyeCameraData *out_dataEye camera data. Will be set to NULL if no valid data is available at this time.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkCamera frames fetched successfully.
MLResultMLResult_TimeoutReturned because no new frame available at this time.
MLResultMLResult_UnspecifiedFailureFailed due to internal error.

Required Permissions:

  • None

Returns MLEyeCameraData 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 MLEyeCameraReleaseCameraData.

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:

  • 26

MLEyeCameraReleaseCameraData

MLResult MLEyeCameraReleaseCameraData(
MLHandle handle,
MLEyeCameraData * eye_camera_data
)

Releases specified MLEyeCameraData object.

Parameters

MLHandlehandleCamera handle obtained from MLEyeCameraConnect.
MLEyeCameraData *eye_camera_dataPointer to a valid MLEyeCameraData object.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkSuccessfully released eye camera data.
MLResultMLResult_UnspecifiedFailureFailed due to internal error.

Required Permissions:

  • None

This function should be called exactly once for each call to MLEyeCameraGetLatestCameraData.

API Level:

  • 26

MLEyeCameraDisconnect

MLResult MLEyeCameraDisconnect(
MLHandle handle
)

Disconnect from eye camera(s).

Parameters

MLHandlehandleCamera handle obtained from MLEyeCameraConnect.

Returns

MLResultMLResult_InvalidParamInvalid handle.
MLResultMLResult_OkDisconnected camera(s) successfully.
MLResultMLResult_UnspecifiedFailureFailed to disconnect camera(s).

Required Permissions:

  • None

This will disconnect from all the eye camera(s) currently connected.

API Level:

  • 26