MLCamera
NameSpace: MagicLeap
Provides a multithreadig implementation of the camera api. Handles pause behavior automatically.
Inherits from:
MLCameraBase,
MLAPIBase
Public Methods
Task< MLResult > CaptureImageAsync
Asynchronously capture still image. Result will be availble via the MLCamera.OnRawImageAvailable event.
public Task< MLResult > CaptureImageAsync(
uint numImages =1
)
Parameters
Type | Name | Description |
---|---|---|
uint | numImages | Number of images to capture. Valid range is 1-10 |
Task< MLResult > CapturePreviewStartAsync
Asynchronously start preview capture The captured preview YUV frames will be returned to the application via OnPreviewCaptureCompleted. Use CapturePreviewStop or CapturePreviewStopAsync to stop the capture.
public Task< MLResult > CapturePreviewStartAsync()
Task< MLResult > CapturePreviewStopAsync
Asynchronously stop preview capture.
public Task< MLResult > CapturePreviewStopAsync()
Task< MLResult > CaptureVideoStartAsync
Asynchronously start video capture of either encoded video or YUV/RGBA frames. YUV/RGBA frames are provides through callback. For encoded video capture valid MediaRecorder object should be configured in the PrepareCapture(CaptureConfig, out Metadata) call. The captured video YUV/RGBA frames will be returned via the OnRawVideoFrameAvailable and OnRawVideoFrameAvailable_NativeCallbackThread events.
public Task< MLResult > CaptureVideoStartAsync()
Task< MLResult > CaptureVideoStopAsync
Asynchronously stop video capture. Should only be called at least 500ms after CaptureVideoStart or CaptureVideoStartAsync.
public Task< MLResult > CaptureVideoStopAsync()
new static MLCamera Create
public static new static MLCamera Create()
MLCamera CreateAndConnect
Creates an MLCamera instance and connects the camera device. Will return null if the [ConnectContext] is incorrectly configured. For example, if the context's Flags are set to MLCamera.ConnectFlag.VirtualOnly when targeting the CV camera.
public static MLCamera CreateAndConnect(
ConnectContext connectContext
)
Parameters
Type | Name | Description |
---|---|---|
ConnectContext | connectContext | Connection settings |
Returns: MLCamera instance if connection was successful, null otherwise
Task< MLCamera > CreateAndConnectAsync
Asynchronously creates an MLCamera instance and connects the camera device. Will return null if the [ConnectContext] is incorrectly configured. For example, if the context's Flags are set to MLCamera.ConnectFlag.VirtualOnly when targeting the CV camera.
public static Task< MLCamera > CreateAndConnectAsync(
ConnectContext connectContext
)
Parameters
Type | Name | Description |
---|---|---|
ConnectContext | connectContext | Connection settings |
Returns: MLCamera instance if connection was successful, null otherwise
Task< MLResult > DisconnectAsync
Asynchronously isconnect the camera. Should call MLCamera.Connect() again on this instance or create a new MLCamera object using MLCamera.CreateAndConnect() function.
public Task< MLResult > DisconnectAsync()
Task< MLResult > PreCaptureAEAWBAsync
Trigger asynchronous AEAWB Convergence. This API triggers AEAWB sequence and completes when AEAWB convergence has been achieved. The users can either trigger and converge AEAWB metadata settings or use this API.
public Task< MLResult > PreCaptureAEAWBAsync()
Protected Methods
OnApplicationPause
Callback sent to all MagicLeap APIs on application pause.
protected virtual override void OnApplicationPause(
bool pauseStatus
)
Parameters
Type | Name | Description |
---|---|---|
bool | pauseStatus | True if the application is paused, else False. |
Reimplements: OnApplicationPause