Skip to main content
Version: 14 Oct 2024

MLWorldCamera

NameSpace: MagicLeap

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. More...

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

Detailed Description

public class MLWorldCamera : MLAutoAPISingleton< MLWorldCamera > 

Details*

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


Public Fields

CurrentSettings


public Settings CurrentSettings { get; set; }

TypeDescription
SettingsA structure to encapsulate the camera settings.

IsConnected


public bool IsConnected { get; set; }


Public Methods

MLResult Connect

Connect to world cameras.

public MLResult Connect(
in Settings settings
)

Parameters

TypeNameDescription
in SettingssettingsA structure to encapsulate the camera settings.

MLResult Disconnect

Disconnect from world camera. This will disconnect from all the world camera currently connected.

public MLResult Disconnect()

MLResult GetLatestWorldCameraData

Poll for Frames. Returns #MLWorldCameraData with this latest data when available. The memory is owned by the system. Application should copy the data it needs to cache it and then release the memory by calling #MLWorldCameraReleaseCameraData. This is a blocking call. API is not thread safe. If there are no new world camera data frames for a given duration (duration determined by the system) then the API will return MLResult_Timeout. To Do : Are there any other meaningful return codes that we need to consider. Say something like MLResult_ResourceNotAvailble for cases where the world camera is not ready yet or is not generating any data because its been turned off.

public MLResult GetLatestWorldCameraData(
out Frame [] data,
uint timeOutMs =1
)

Parameters

TypeNameDescription
out Frame []dataA structure to encapsulate per plane info for each camera frame.
uinttimeOutMs

MLResult UpdateSettings

Update the world camera settings.

public MLResult UpdateSettings(
in Settings settings
)

Parameters

TypeNameDescription
in SettingssettingsA structure to encapsulate the camera settings.

Protected Methods

OnApplicationPause

Callback sent to all MagicLeap APIs on application pause.

protected virtual override void OnApplicationPause(
bool pauseStatus
)

Parameters

TypeNameDescription
boolpauseStatusTrue if the application is paused, else False.

Reimplements: OnApplicationPause


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 Enums

CameraId

Enumeration of all the available world camera sensors.

EnumeratorValueDescription
Left1 << 0Left World camera.
Right1 << 1Right World camera.
Center1 << 2Center World camera.
AllLeftRight

Mode

Enumeration of world camera modes.

EnumeratorValueDescription
Unknown0None.
LowExposure1 << 0Low exposure mode. This mode is currently only available when the controller is being tracked.
NormalExposure1 << 1Normal exposure mode.