/** * Use this for initialization. */ private void Start() { // Variable initialization this.ShouldCapture = false; this.videoCaptureObject = null; this.tryStartRecording = false; this.tryStopRecording = false; this.isRecording = false; this.tryStartVideoMode = false; this.CaptureStarted = false; this.disposeAction = null; this.namingIndex = 0; // Get reference to other scripts in the scene this.logger = DebugLogger.Instance; // Deactivate this script if necessary components are missing if (this.logger == null) { Debug.LogError("VideoCapture: Script references not set properly."); this.enabled = false; return; } // Set camera parameters and create a MR-VideoCapture object this.cameraParameters = new MRC.CameraParameters { hologramOpacity = 1.0f, frameRate = this.VideoFramerate, cameraResolutionWidth = this.VideoResolution.width, cameraResolutionHeight = this.VideoResolution.height, pixelFormat = MRC.CapturePixelFormat.BGRA32 }; MRC.VideoCapture.CreateAsync(true, this.OnVideoCaptureCreated); }
/** * Use this for initialization. */ private void Start() { // Variable initialization this.ShouldCapture = false; this.photoCaptureObject = null; this.isProcessing = false; this.tryStartPhotoMode = false; this.tryStopPhotoMode = false; this.CaptureStarted = false; this.timeSinceLastFocusChange = 0.0f; this.resetTime = false; this.photoCount = 1; this.waitMode = false; this.waitCounter = 0; this.focusedObjectTag = ""; this.active = false; this.disposeAction = null; // Get reference to other scripts in the scene this.logger = DebugLogger.Instance; this.objectRecognition = ObjectRecognition.Instance; this.gazeManager = GazeManager.Instance; // Deactivate this script if necessary components are missing if ((this.logger == null) || (this.objectRecognition == null) || (this.gazeManager == null)) { Debug.LogError("PhotoCapture: Script references not set properly."); this.enabled = false; return; } // Subscibe to notifications about focused objects this.gazeManager.FocusedObjectChanged += this.OnFocusedObjectChanged; // Set camera parameters and create a MR-PhotoCapture object this.cameraParameters = new MRC.CameraParameters { hologramOpacity = 0.0f, cameraResolutionWidth = this.CameraResolution.width, cameraResolutionHeight = this.CameraResolution.height, pixelFormat = MRC.CapturePixelFormat.BGRA32 }; MRC.PhotoCapture.CreateAsync(false, this.OnPhotoCaptureCreated); }
public void StartPhotoModeAsync(CameraParameters setupParams, OnPhotoModeStartedCallback onPhotoModeStartedCallback) { if (this.m_NativePtr == IntPtr.Zero) { throw new InvalidOperationException("You must create a Photo Capture Object before starting its photo mode."); } if (onPhotoModeStartedCallback == null) { throw new ArgumentException("onPhotoModeStartedCallback"); } if ((setupParams.cameraResolutionWidth == 0) || (setupParams.cameraResolutionHeight == 0)) { throw new ArgumentOutOfRangeException("setupParams", "The camera resolution must be set to a supported resolution."); } this.StartPhotoMode_Internal(this.m_NativePtr, onPhotoModeStartedCallback, setupParams.hologramOpacity, setupParams.frameRate, setupParams.cameraResolutionWidth, setupParams.cameraResolutionHeight, (int) setupParams.pixelFormat); }