Skip to main content
Version: 12 Dec 2024

MagicLeapCameras

NameSpace: Android

Three Camera Devices are supported: Camera Id 0, Camera Id 1, Camera Id 3. Camera Id 0 and 1 support Camera_Only capture. Camera Id 3 supports Mixed_Reality capture, Virtual_Only capture, Camera_Only capture. Camera Id 0 and Camera Id 1 support a total of 3 streams. Streams are dynamically allocated between Camera Id 0 and Camera Id 1. Camera Id 0 and Camera Id 3 are conflicting devices, a higher priority application using Camera Id 3 will evict client using Camera Id 0. Camera Id 3(Mixed Reality Camera) only supports 1 stream.

Public Attributes

CVCamera

ID for the device most commonly reserved for use with CVCamera operations.


public const string CVCamera = "1";


DevicesForCaptureMode


public static readonly Dictionary< VideoCaptureMode, string[]> DevicesForCaptureMode = new()
{
{ VideoCaptureMode.MixedReality, new string[] { MixedRealityCamera } },
{ VideoCaptureMode.VirtualOnly, new string[] { MixedRealityCamera } },
{ VideoCaptureMode.CameraOnly, new string [] { MainCamera, CVCamera, MixedRealityCamera } }
};


MainCamera

ID for the device most commonly used for regular main camera capture.


public const string MainCamera = "0";


MixedRealityCamera

ID for the device that supports virtual-only or mixed reality camera capture.


public const string MixedRealityCamera = "3";


SupportedModesForDevice


public static readonly Dictionary< string, VideoCaptureMode[]> SupportedModesForDevice = new()
{
{ "0", new VideoCaptureMode[] { VideoCaptureMode.CameraOnly } },
{ "1", new VideoCaptureMode[] { VideoCaptureMode.CameraOnly } },
{ "3", new VideoCaptureMode[] { VideoCaptureMode.CameraOnly, VideoCaptureMode.VirtualOnly, VideoCaptureMode.MixedReality } }
};


Public Enums

MetadataTags

MagicLeap specific extensions to Camera Metadata. The metadata tags can be used with NDK apis to get and set camera metadata.

EnumeratorValueDescription
ML_CONTROL_CAMERA_FORCEAPPLY_MODEVENDOR + 0x1Can be used to force apply camera settings. Camera Id 0 and Camera Id 1 share the same camera hardware resources. It is recommended that applications try to use as much as possible the default template metadata otherwise metadata properties from one camera can affect the other. When both cameras are streaming, request metadata settings for both cameras are merged and then applied. While merging, the metadata settings from Camera Id 0 take precedence over Camera Id 1. The Force Apply mode setting can be used to override this. If Camera Id 1 Request metadata has force apply mode on, the Camera Id 1 metadata settings take precedence over Camera Id 0 properties. The tag is available in both Capture Request and Capture Result metadata. The tag has data type uint8 and can be set to 1 to force apply the camera settings. The name for this tag is "com.amd.control.forceapply" which can be used with android java camera API.
ML_CONTROL_CAMERA_EFFECT_MODEVENDOR + 0x2Can be used to configure special effects. The tag is available in both Capture Request and Capture Result metadata. The tag has data type uint8 and can be set to the following values for configuring effect modes: 0 - Off, 1 - Grayscale, 2 - Negative, 3 - Sepia, 4 - Color Selection, 5 - Sharpen, 6 - Emboss, 7 - Sketch. The name for this tag is "com.amd.control.effectmode" which can be used with android java camera API.
ML_CONTROL_CAMERA_APP_EXPOSURE_UPPER_TIME_LIMITVENDOR + 0x4Can be used to limit the max exposure time selected by auto exposure algorithm. The tag can be used to limit exposure time in a high motion environment to reduce motion blur. The auto exposure algorithm uses max time of 16ms/20ms in 60Hz/50Hz env, any value less than 16ms/20ms can be used. The tag is available in both Capture Request and Capture Result metadata. The tag has data type int64 and can be used to set max exposure time in nanoseconds. The name for this tag is "com.amd.control.app_exposure_time_upper_limit" which can be used with android java camera API.
ML_CONTROL_CAMERA_NUM_INTRINSICSVENDOR + 0x1BCan be used to query no. of camera intrinsics in Capture Result Metadata. The tag can be used to query no. of intrinsics which is the no. of streams configured for camera. The tag is available in Capture Result metadata. The tag has data type int32. The name for this tag is "com.amd.control.num_intrinsics" which can be used with android java camera API.
ML_CONTROL_CAMERA_INTRINSICSVENDOR + 0x1CCan be used to query the camera intrinsics in Capture Result Metadata. The tag can be used to query intrinsics for camera. The tag is available in Capture Result metadata. The tag has data type float and returns an array of floats which can be interpreted as: num_intrinsics* {width, height, focal_length_x, focal_length_y, principal_point_x, principal_point_y, field_of_view, k1, k2, p1, p2, k3 }. The name for this tag is "com.amd.control.intrinsics" which can be used with android java camera API.
ML_CONTROL_MRCAMERA_TINTVENDOR + 0x103Can be used to control tint for virtual and camera frames composition. The tag is available in Capture Request and Capture Result metadata. The tag has data type float and can be set between 0.0 to 1.0 to control the tint of mixed reality content. The name for this tag is "com.ml.control.tint" which can be used with android java camera API.
ML_CONTROL_MRCAMERA_ALPHA_BIASVENDOR + 0x104Can be used to control alpha for virtual and camera frames composition. The tag is available in Capture Request and Capture Result metadata. The tag has data type float and can be set between -1.0 to 1.0 to control the opacity/transparency of virtual content. The name for this tag is "com.ml.control.alpha_bias" which can be used with android java camera API.
ML_CONTROL_MRCAMERA_CAPTURE_MODEVENDOR + 0x105Can be used to set the capture mode for mixed reality capture. The tag is available in Capture Request and Capture Result metadata. The tag has data type uint8_t and can be set to 0 for Mixed_Reality capture or 1 for Virtual_Only capture. The name for this tag is "com.ml.control.capture_mode" which can be used with android java camera API.
ML_CONTROL_MRCAMERA_NUM_INTRINSICSVENDOR + 0x112Can be used to query no. of camera intrinsics in Capture Result Metadata. The tag can be used to query no. of intrinsics which is the no. of streams configured for camera. The tag is available in Capture Result metadata. The tag has data type int32. The name for this tag is "com.ml.control.num_intrinsics" which can be used with android java camera API.
ML_CONTROL_MRCAMERA_INTRINSICSVENDOR + 0x113can be used to query the camera intrinsics in Capture Result Metadata. The tag can be used to query intrinsics for camera. The tag is available in Capture Result metadata. The tag has data type float and returns an array of floats which can be interpreted as: num_intrinsics* {width, height, focal_length_x, focal_length_y, principal_point_x, principal_point_y, field_of_view, k1, k2, p1, p2, k3}. The name for this tag is "com.ml.control.intrinsics" which can be used with android java camera API.

VideoCaptureMode

EnumeratorValueDescription
MixedReality0
VirtualOnly1
CameraOnly2