コード例 #1
0
        private Task SetupCameraAsync()
        {
            lock (lockObj)
            {
#if UNITY_EDITOR
                UnityCompositorInterface.StartArUcoMarkerDetector(_markerDictionaryName, _markerSize);
                return(Task.CompletedTask);
#else
                if (setupCameraTask != null)
                {
                    DebugLog("Returning existing setup camera task");
                    return(setupCameraTask);
                }

                DebugLog("Setting up HoloLensCamera");
                if (_holoLensCamera == null)
                {
                    _holoLensCamera = new HoloLensCamera(CaptureMode.SingleLowLatency, PixelFormat.BGRA8);
                    _holoLensCamera.OnCameraInitialized += CameraInitialized;
                    _holoLensCamera.OnCameraStarted     += CameraStarted;
                    _holoLensCamera.OnFrameCaptured     += FrameCaptured;
                }

                return(setupCameraTask = _holoLensCamera.Initialize());
#endif
            }
        }