Skip to main content
Version: 21 Aug 2024

MLEyeCamera

NameSpace: MagicLeap

MLEyeCamera class exposes static functions to query eye camera related functions. Most functions are currently a direct pass through functions to the native C-API functions and incur no overhead.

Inherits from:
MLAutoAPISingleton< MLEyeCamera >,
MLLazySingleton< T >

Public Fields

ActiveCamerasCount

The number of active eye cameras.


public static int ActiveCamerasCount { get; set; }


Public Methods

void CopyImageFrameDataToByteArray

Converts an image frame data pointer into a byte array.

public static void CopyImageFrameDataToByteArray(
EyeCameraFrameBuffer imageFrame,
ref byte [] byteArray
)

Parameters

TypeNameDescription
EyeCameraFrameBufferimageFrameThe associated eye camera frame buffer for an eye camera.
ref byte []byteArrayThe image data from the native eye camera data as a byte array.

MLResult GetLatestCameraData

Polls for Frames. Returns EyeCameraData with this latest data when available. If there are no new camera frames within the timeout_ms duration then the API will return MLResult_Timeout.

public static MLResult GetLatestCameraData(
out EyeCameraData outData,
UInt64 timeoutMS
)

Parameters

TypeNameDescription
out EyeCameraDataoutDataEye camera data to be output.
UInt64timeoutMSTimeout in milliseconds.

Returns: MLResult.Result will be MLResult.Code.Ok if succesfully fetched the camera frames and released the native data. MLResult.Result will be MLResult.Code.Timeout returned because no new frame available at this time. MLResult.Result will be MLResult.Code.InvalidParam if one of the parameters is invalid. MLResult.Result will be MLResult.Code.UnspecifiedFailure if the operation failed due to an internal error.


MLResult UpdateSettings

Update the eye camera settings.

public static MLResult UpdateSettings(
MLEyeCameraIdentifier cameras
)

Parameters

TypeNameDescription
MLEyeCameraIdentifiercamerasThe specific eye cameras that will be active with the updated settings.

Returns: MLResult.Result will be MLResult.Code.Ok if the settings updated successfully. MLResult.Result will be MLResult.Code.InvalidParam if one of the parameters is invalid. MLResult.Result will be MLResult.Code.UnspecifiedFailure if the operation failed due to an internal error.


Protected Methods

StartAPI

Do API-specific creation/initialization of ML resources for this API, such as creating trackers, etc. Called automatically the first time Instance is accessed. Error checking on the return value is performed in the base class.

protected virtual override MLResult.Code StartAPI()

Reimplements: StartAPI


StopAPI

API-specific cleanup. Will be called whenever MLDevice is destroyed (at the latest, when the application is shutting down). Error checking on the return value is performed in the base class.

protected virtual override MLResult.Code StopAPI()

Reimplements: StopAPI


Public Attributes

ActiveCameras

The enumerated value representing which eye cameras are currently active.


public static MLEyeCameraIdentifier ActiveCameras => (MLEyeCameraIdentifier)Instance.settings.Cameras;

TypeDescription
MLEyeCameraIdentifierEnumeration of all the available eye camera sensors.

Returns:


MaxFrameCount

The maximum number of eye camera frames.


public const int MaxFrameCount = 4;


Public Enums

MLEyeCameraIdentifier

Enumeration of all the available eye camera sensors.

EnumeratorValueDescription
None0None.
LeftTemple1 << 0Left temple eye camera.
LeftNasal1 << 1Left nasal eye camera.
RightNasal1 << 2Right nasal eye camera.
RightTemple1 << 3Right temple eye camera.
AllLeftTempleLeftNasal