// %BANNER_BEGIN% // --------------------------------------------------------------------- // %COPYRIGHT_BEGIN% // Copyright (c) (2018-2022) Magic Leap, Inc. All Rights Reserved. // Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2 // Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein. // %COPYRIGHT_END% // --------------------------------------------------------------------- // %BANNER_END% namespace UnityEngine.XR.MagicLeap { using System.Runtime.InteropServices; /// /// MLCamera class exposes static functions to query camera related /// functions. Most functions are currently a direct pass through functions to the /// native C-API functions and incur no overhead. /// public sealed partial class MLCVCamera { /// /// See ml_cv_camera.h for additional comments. /// private partial class NativeBindings : Native.MagicLeapNativeBindings { /// /// MLCVCameraIntrinsics_MaxDistortionCoefficients from ml_cv_camera.h /// public const uint MaxDistortionCoefficients = 5; /// /// MLCVCameraID enum from ml_cv_camera.h /// public enum CameraID : uint { /// /// RGB Camera. /// ColorCamera = 0, } /// /// Create Camera Tracker. /// /// tracker Handle. /// MLResult_Ok On success. /// MLResult_PermissionDenied Necessary permission is missing. /// MLResult_UnspecifiedFailure Unable to create tracker. [DllImport(MLPerceptionClientDll, CallingConvention = CallingConvention.Cdecl)] public static extern MLResult.Code MLCVCameraTrackingCreate(ref ulong cvCameraHandle); /// /// Destroy Tracker after usage. /// /// MLHandle previously created with MLCVCameraTrackingCreate. /// /// MLResult_Ok On success. /// MLResult_PermissionDenied Necessary permission is missing. /// MLResult_UnspecifiedFailure Unable to create tracker. /// [DllImport(MLPerceptionClientDll, CallingConvention = CallingConvention.Cdecl)] public static extern MLResult.Code MLCVCameraTrackingDestroy(ulong cvCameraHandle); /// /// Get the camera pose in the world coordinate system. /// /// MLHandle previously created with MLCVCameraTrackingCreate. /// MLHandle previously created with MLHeadCameraCreate. /// The camera id. /// The timestamp of the frame pose. /// The transform of the frame pose. /// /// MLResult.Result will be MLResult.Code.Ok if successful. /// MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. /// /// [DllImport(MLPerceptionClientDll, CallingConvention = CallingConvention.Cdecl)] public static extern MLResult.Code MLCVCameraGetFramePose(ulong cvCameraHandle, ulong headHandle, CameraID id, long vcamTimestamp, ref MLTransform outTransform); } } }