Captures a photo from the web camera and stores it in memory or on disk.

Inheritance: IDisposable
Exemplo n.º 1
0
 /**
  * Callback method that is called after the MR-PhotoCapture object has been created.
  *
  * @param captureObject reference to MR-PhotoCapture
  */
 private void OnPhotoCaptureCreated(MRC.PhotoCapture captureObject)
 {
     // Save the current capture object
     if (captureObject != null)
     {
         this.photoCaptureObject = captureObject;
     }
     else
     {
         this.logger.Log("Failed to create MR-PhotoCapture instance.");
     }
 }
Exemplo n.º 2
0
        /**
         * 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);
        }
Exemplo n.º 3
0
 /**
  * This method disposes of the inactive capturing object.
  */
 public void DisposeInactive()
 {
     this.logger.Log("Photo capture object disposed.");
     this.photoCaptureObject.Dispose();
     this.photoCaptureObject = null;
 }
Exemplo n.º 4
0
 public IntPtr GetUnsafePointerToVideoDeviceController()
 {
     return(PhotoCapture.GetUnsafePointerToVideoDeviceController_Internal(this.m_NativePtr));
 }
Exemplo n.º 5
0
 private static void InvokeOnCapturedPhotoToDiskDelegate(PhotoCapture.OnCapturedToDiskCallback callback, long hResult)
 {
     callback(PhotoCapture.MakeCaptureResult(hResult));
 }
Exemplo n.º 6
0
 private static void InvokeOnPhotoModeStoppedDelegate(PhotoCapture.OnPhotoModeStoppedCallback callback, long hResult)
 {
     callback(PhotoCapture.MakeCaptureResult(hResult));
 }