Пример #1
0
        public Task <bool> StartCapture()
        {
            if (FrameHeight == 0 && FrameWidth == 0)
            {
                Debug.LogError("StartCapture() invoked before camera initialized.");
                return(Task.FromResult(false));
            }
            PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject)
            {
                _photoCaptureObject = captureObject;
                UnityEngine.Windows.WebCam.CameraParameters cameraParameters = new UnityEngine.Windows.WebCam.CameraParameters
                {
                    hologramOpacity        = 0.0f,
                    cameraResolutionWidth  = FrameWidth,
                    cameraResolutionHeight = FrameHeight,
                    pixelFormat            = CapturePixelFormat.NV12
                };

                _photoCaptureObject?.StartPhotoModeAsync(cameraParameters, delegate
                {
                    _photoCaptureObject.TakePhotoAsync(OnCapturedPhotoToMemory);
                });
            });
            return(Task.FromResult(true));
        }
Пример #2
0
    /// <summary>
    /// Setup the PhotoCapture with the relevant parameters
    /// </summary>
    void TakePhoto()
    {
        CameraParameters camParameters = new CameraParameters
        {
            hologramOpacity        = 0.0f,
            cameraResolutionWidth  = width,
            cameraResolutionHeight = height,
            //pixelFormat = CapturePixelFormat.BGRA32
            pixelFormat = CapturePixelFormat.JPEG
        };

        // initialize the camera
        photoCaptureObject.StartPhotoModeAsync(camParameters, delegate(PhotoCapture.PhotoCaptureResult result)
        {
            photoCaptureObject.TakePhotoAsync(OnCapturedPhotoToMemory);
        });
    }
Пример #3
0
    void OnPhotoCaptureCreated(PhotoCapture captureObject)
    {
        _photoCaptureObject = captureObject;

        // find the best supported resolution
        Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();

        CameraParameters c = new CameraParameters();

        c.hologramOpacity        = 0.0f;
        c.cameraResolutionWidth  = cameraResolution.width;
        c.cameraResolutionHeight = cameraResolution.height;
        c.pixelFormat            = CapturePixelFormat.BGRA32;

        // start the capture
        captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
    }
Пример #4
0
    void StartCaptureImage()
    {
        Debug.Log("1. Loading started");
        try
        {
            _targetTexture = new Texture2D(1920, 1080);

            Debug.Log("2. Texture created, PhotoCapture.CreateAsync");

            // Create a PhotoCapture object
            PhotoCapture.CreateAsync(false, captureObject =>
            {
                Debug.Log("3. PhotoCapture.CreateAsync callback started");

                _photoCaptureObject = captureObject;
                _cameraParameters   = new CameraParameters(WebCamMode.PhotoMode);
                _cameraParameters.hologramOpacity        = 0.0f;
                _cameraParameters.cameraResolutionWidth  = 1920;
                _cameraParameters.cameraResolutionHeight = 1080;
                _cameraParameters.pixelFormat            = CapturePixelFormat.BGRA32;

                Debug.Log("4. Camera params set done, StartPhotoModeAsync");

                // Activate the camera
                _photoCaptureObject.StartPhotoModeAsync(_cameraParameters, result =>
                {
                    Debug.Log("5. StartPhotoModeAsync completed");
                    if (!VerifyPhotoResult(result))
                    {
                        Debug.LogError("VerifyPhotoResult is incorrect");
                        return;
                    }
                    Debug.Log("6. Photo result verified");

                    // taking photo
                    Debug.Log("7. TakePhotoAsync started");
                    _photoCaptureObject.TakePhotoAsync(OnCapturedPhotoToMemory);
                });
            });
        }
        catch (Exception e)
        {
            Debug.LogError($"EXCEPTION: PreLoadCapture, {e.Message}");
        }
    }
Пример #5
0
        public void OnInputClicked(InputClickedEventData e)
        {
            if (photoCapture != null)
            {
                Debug.Log("");
                return;
            }

            Debug.Log("OnInputClicked");
            PhotoCapture.CreateAsync(false, captureObject =>
            {
                photoCapture = captureObject;
                photoCapture.StartPhotoModeAsync(cameraParameters, result =>
                {
                    photoCapture.TakePhotoAsync(OnCapturedPhotoToMemory);
                });
            });
        }
Пример #6
0
    public void CreatePhotoCapture()
    {
        _targetTexture = new Texture2D(1920, 1080);
        toShow         = new Texture2D(_targetTexture.width, _targetTexture.height, _targetTexture.format, false);
        PhotoCapture.CreateAsync(false, captureObject =>
        {
            Debug.Log("PhotoCapture.CreateAsync callback started");
            _photoCaptureObject = captureObject;
            _cameraParameters   = new CameraParameters(WebCamMode.PhotoMode);
            _cameraParameters.hologramOpacity        = 0.0f;
            _cameraParameters.cameraResolutionWidth  = 1920;
            _cameraParameters.cameraResolutionHeight = 1080;
            _cameraParameters.pixelFormat            = CapturePixelFormat.BGRA32;

            _photoCaptureObject.StartPhotoModeAsync(_cameraParameters, OnPhotoCaptureStart);
        }
                                 );
    }
Пример #7
0
    void OnPhotoCaptureCreated(PhotoCapture captureObject)
    {
        if (photoCaptureObject_ == null)
        {
            photoCaptureObject_ = captureObject;

            cameraResolution_ = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
            targetTexture_    = new Texture2D(cameraResolution_.width, cameraResolution_.height, TextureFormat.RGBA32, false);
            CameraParameters c = new CameraParameters();
            c.hologramOpacity = 0.0f;

            c.cameraResolutionWidth  = targetTexture_.width;
            c.cameraResolutionHeight = targetTexture_.height;
            //c.pixelFormat = CapturePixelFormat.PNG;

            c.pixelFormat = CapturePixelFormat.BGRA32;
            captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
        }
    }
Пример #8
0
    void OnPhotoCaptureCreated(PhotoCapture captureObject)
    {
        photoCaptureObject = captureObject;
        Resolution       cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
        CameraParameters c = new CameraParameters();

        c.hologramOpacity        = 0.0f;
        c.cameraResolutionWidth  = cameraResolution.width;
        c.cameraResolutionHeight = cameraResolution.height;
        c.pixelFormat            = CapturePixelFormat.BGRA32;
        try
        {
            captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
        }
        catch (System.Exception)
        {
            //throw;
        }
    }
Пример #9
0
        private void OnPhotoCaptureCreated(PhotoCapture captureObject)
        {
            if (text != null)
            {
                text.text += "\nPhotoCapture created...";
            }

            photoCaptureObject = captureObject;

            CameraParameters cameraParameters = new CameraParameters(WebCamMode.PhotoMode)
            {
                hologramOpacity        = 0.0f,
                cameraResolutionWidth  = cameraResolution.width,
                cameraResolutionHeight = cameraResolution.height,
                pixelFormat            = CapturePixelFormat.BGRA32
            };

            captureObject.StartPhotoModeAsync(cameraParameters, OnPhotoModeStarted);
        }
Пример #10
0
        protected override bool InitCamera()
        {
            _cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
            PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject) {
                _photoCapture = captureObject;

                CameraParameters cameraParameters       = new CameraParameters();
                cameraParameters.hologramOpacity        = 1.0f;
                cameraParameters.cameraResolutionWidth  = _cameraResolution.width;
                cameraParameters.cameraResolutionHeight = _cameraResolution.height;
                cameraParameters.pixelFormat            = CapturePixelFormat.BGRA32;      // CapturePixelFormat.PNG;

                // Start the photo mode and start taking pictures
                _photoCapture.StartPhotoModeAsync(cameraParameters, delegate(PhotoCapture.PhotoCaptureResult result) {
                    Invoke("ProcessCameraFrame", 0);
                });
            });
            return(true);
        }
Пример #11
0
    public void CapturePhotoAsync(OnCaptured _callback)
    {
        callback = _callback;

        PhotoCapture.CreateAsync(false, (_photoCapture) => {
            Debug.Log("PhotoInput start");
            this.photoCapture           = _photoCapture;
            Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();

            CameraParameters c       = new CameraParameters();
            c.hologramOpacity        = 0.0f;
            c.cameraResolutionWidth  = cameraResolution.width;
            c.cameraResolutionHeight = cameraResolution.height;
            c.pixelFormat            = CapturePixelFormat.BGRA32;
            c.hologramOpacity        = 0;
            this.cameraParameters    = c;
            photoCapture.StartPhotoModeAsync(cameraParameters, onPhotoModeStarted);
        });
    }
Пример #12
0
    void OnPhotoCaptureCreated(PhotoCapture captureObject)
    {
        photoCaptureObject = captureObject;

        //Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
        foreach (Resolution resolution in PhotoCapture.SupportedResolutions)
        {
            Debug.Log("Resolution: (" + resolution.width + ", " + resolution.height + ") refresh=" + resolution.refreshRate);
        }

        CameraParameters c = new CameraParameters();

        c.hologramOpacity        = 0.0f;
        c.cameraResolutionWidth  = textureWidth;  // cameraResolution.width;
        c.cameraResolutionHeight = textureHeight; // cameraResolution.height;
        c.pixelFormat            = CapturePixelFormat.BGRA32;

        captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
    }
Пример #13
0
        private void OnPhotoCaptureCreated(PhotoCapture captureobject)
        {
            //ShowText("Photo Capture Created");

            _capturedPhotoObject = captureobject;
            var cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending(res => res.width * res.height).First();

            _targetTexture = new Texture2D(cameraResolution.width, cameraResolution.height);

            var cameraParameters = new CameraParameters
            {
                hologramOpacity        = 0.0f,
                cameraResolutionWidth  = cameraResolution.width,
                cameraResolutionHeight = cameraResolution.height,
                pixelFormat            = CapturePixelFormat.BGRA32
            };

            captureobject.StartPhotoModeAsync(cameraParameters, OnPhotoModeStarted);
        }
Пример #14
0
 private void OnPhraseRecognized(PhraseRecognizedEventArgs args)
 {
     if (!_startingPhotoMode)
     {
         if (args.text == _keywords[0] && !_readyToTakePicture && !_takingPicture)
         {
             _startingPhotoMode = true;
             _infoText.text     = _startingPhotoModeString;
             _photoCaptureObject.StartPhotoModeAsync(_cameraParameters, OnPhotoModeStarted);
         }
         else if (args.text == _keywords[1] && _readyToTakePicture)
         {
             _readyToTakePicture = false;
             _takingPicture      = true;
             _infoText.text      = _takingPictureString;
             TakePictureToDisk();
         }
     }
 }
Пример #15
0
        /// <summary>
        /// Called when a capture object has been created, it configures the camera for the capture process
        /// </summary>
        /// <param name="captureObject">Contains the camera intent to open</param>
        private void OnPhotoCaptureCreated(PhotoCapture captureObject)
        {
            //Debug.Log("################### CameraCaptureHololens -> OnPhotoCaptureCreated() -> start function!");
            photoCaptureObject = captureObject;

            var cameraParameters = new CameraParameters();

            cameraParameters.hologramOpacity = 0.0f;
            photoHeight = VerticalCameraResolution;
            photoWidth  = HorizontalCameraResolution;
            cameraParameters.cameraResolutionWidth  = photoWidth;
            cameraParameters.cameraResolutionHeight = photoHeight;
            cameraParameters.pixelFormat            = CapturePixelFormat.BGRA32;
            //Debug.Log("################### CameraCaptureHololens -> OnPhotoCaptureCreated() -> photoHeight! "+photoHeight);
            //Debug.Log("################### CameraCaptureHololens -> OnPhotoCaptureCreated() -> photoWidth! "+photoWidth);
            //Debug.Log("################### CameraCaptureHololens -> OnPhotoCaptureCreated() -> CapturePixelFormat.BGRA32! "+CapturePixelFormat.BGRA32);
            captureObject.StartPhotoModeAsync(cameraParameters, OnPhotoModeStarted);
            //Debug.Log("################### CameraCaptureHololens -> OnPhotoCaptureCreated() -> end function!");
        }
Пример #16
0
        private void TakePhotoCore(bool showHolograms)
        {
            canTakePhoto.Value = false;

            PhotoCapture.CreateAsync(showHolograms, p =>
            {
                photoCapture = p;

                var cameraParameters = new CameraParameters
                {
                    cameraResolutionHeight = Resolution.height,
                    cameraResolutionWidth  = Resolution.width,
                    hologramOpacity        = showHolograms ? 0.9f : 0,
                    pixelFormat            = canSave ? CapturePixelFormat.BGRA32 : CapturePixelFormat.JPEG,
                };

                photoCapture.StartPhotoModeAsync(cameraParameters, onPhotoModeStartedCallback);
            });
        }
Пример #17
0
        // For when photo capture object gets created. initializes object
        public static void OnPhotoCaptureCreated(PhotoCapture captureObject)
        {
            photoCaptureObject = captureObject;

            // Get the first camera resolution available - should be correct
            // ERROR TESTING is the first resolution the best resolution? May have to order this
            //Resolution cameraRes = PhotoCapture.SupportedResolutions.GetEnumerator().Current;

            Resolution cameraRes = Constants.Camera.CameraResolution();

            CameraParameters c = new CameraParameters();

            c.hologramOpacity        = 0.0f;
            c.cameraResolutionWidth  = cameraRes.width;
            c.cameraResolutionHeight = cameraRes.height;
            c.pixelFormat            = CapturePixelFormat.BGRA32;

            photoCaptureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
        }
Пример #18
0
    // This method store the PhotoCapture object just created and retrieve the high quality
    // available for the camera and then request to start capturing the photo with the
    // given camera parameters.
    private void OnPhotoCreated(PhotoCapture captureObject)
    {
        this.photoCapture = captureObject;

        Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();

        this.TextVerificationStatus.gameObject.SetActive(true);
        this.TextVerificationStatus.text = "Obteniendo informacion de la camara.";

        CameraParameters c = new CameraParameters()
        {
            hologramOpacity        = 0.0f,
            cameraResolutionWidth  = cameraResolution.width,
            cameraResolutionHeight = cameraResolution.height,
            pixelFormat            = CapturePixelFormat.BGRA32
        };

        captureObject.StartPhotoModeAsync(c, this.OnPhotoModeStarted);
    }
Пример #19
0
    private void OnPhotoCaptureCreated(PhotoCapture captureObject)
    {
        Debug.Log("OnPhotoCaptureCreated");
        _photoCaptureObject = captureObject;

        //TODO: Try enumerating all of the support resolutions (in OnStart), we may not need the highest resolution for what we're doing
        //Grab highest resolution camera
        var cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
        //var cameraResolution = PhotoCapture.SupportedResolutions.First(r => r.width == 640 && r.height == 480);

        var cameraParameters = new CameraParameters
        {
            hologramOpacity        = 0.0f,
            cameraResolutionWidth  = cameraResolution.width,
            cameraResolutionHeight = cameraResolution.height,
            pixelFormat            = CapturePixelFormat.BGRA32
        };

        captureObject.StartPhotoModeAsync(cameraParameters, false, OnPhotoModeStarted);
    }
Пример #20
0
        public void TakeAPictureToDisk()
        {
#if UNITY_METRO && !UNITY_EDITOR
            PhotoCapture.CreateAsync(true, delegate(PhotoCapture captureObject) {
                photoCaptureObject = captureObject;
                // Activate the camera
                photoCaptureObject.StartPhotoModeAsync(cameraParameters, delegate(PhotoCapture.PhotoCaptureResult result) {
                    // Take a picture
                    //photoCaptureObject.TakePhotoAsync(OnCapturedPhotoToMemory);
                    //string filename = string.Format(@"CapturedImage{0}.jpg", capturedImageCount);

                    //string filePath = System.IO.Path.Combine(Application.persistentDataPath, filename);
                    if (ReadWrite.Instance.FileExist(filePath))
                    {
                        ReadWrite.Instance.FileDelete(filePath);
                    }
                    photoCaptureObject.TakePhotoAsync(filePath, PhotoCaptureFileOutputFormat.JPG, OnCapturedPhotoToDisk);
                });
            });
#endif
        }
Пример #21
0
    void OnPhotoCaptureCreated(PhotoCapture captureObject)
    {
        this.debug.PrintPlus("in onphotocapturecreate");
        //reference the captureobject
        photoCaptureObject = captureObject;
        //find the first camera resolution
        Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
        //create a camera parameters object
        CameraParameters c = new CameraParameters();

        //set the hologram opacity to zero to prevent hologram rendering
        c.hologramOpacity = 0.0f;
        //set the camera resolution width
        c.cameraResolutionWidth = cameraResolution.width;
        //set the camera resolution height
        c.cameraResolutionHeight = cameraResolution.height;
        //set the pixel format
        c.pixelFormat = CapturePixelFormat.BGRA32;
        //start photo capture mode
        captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
    }
Пример #22
0
    void OnPhotoCaptureCreated(PhotoCapture captureObject)
    {
        Debug.LogWarning("Photo Capture created");
        photoCaptureObject = captureObject;

        foreach (var res in PhotoCapture.SupportedResolutions)
        {
            Debug.LogWarning(String.Format("resolution : {0} * {1}", res.width, res.height));
        }

        Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => - res.width * res.height).First();

        CameraParameters c = new CameraParameters();

        c.hologramOpacity        = 0.0f;
        c.cameraResolutionWidth  = cameraResolution.width;
        c.cameraResolutionHeight = cameraResolution.height;
        c.pixelFormat            = CapturePixelFormat.PNG;

        captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
    }
Пример #23
0
    public void TakePicture()
    {
        // Create a PhotoCapture object
        PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject)
        {
            _photoCaptureObject = captureObject;
            CameraParameters cameraParameters = new CameraParameters
            {
                hologramOpacity        = 0.0f,
                cameraResolutionWidth  = _cameraResolution.width,
                cameraResolutionHeight = _cameraResolution.height,
                pixelFormat            = _debugPane != null ? CapturePixelFormat.BGRA32 : CapturePixelFormat.JPEG
            };

            // Activate the camera
            _photoCaptureObject.StartPhotoModeAsync(cameraParameters, p =>
            {
                _photoCaptureObject.TakePhotoAsync(OnCapturedPhotoToMemory);
            });
        });
    }
    // Use this for initialization
    void Start()
    {
        Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();

        targetTexture = new Texture2D(cameraResolution.width, cameraResolution.height);

        // Create a PhotoCapture object
        PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject) {
            photoCaptureObject = captureObject;
            CameraParameters cameraParameters       = new CameraParameters();
            cameraParameters.hologramOpacity        = 0.0f;
            cameraParameters.cameraResolutionWidth  = cameraResolution.width;
            cameraParameters.cameraResolutionHeight = cameraResolution.height;
            cameraParameters.pixelFormat            = CapturePixelFormat.BGRA32;

            // Activate the camera
            photoCaptureObject.StartPhotoModeAsync(cameraParameters, delegate(PhotoCapture.PhotoCaptureResult result) {
                // Take a picture
            });
        });
    }
        private void StartPhotoMode()
        {
            var cameraResolution = PhotoCapture.SupportedResolutions
                                   .OrderByDescending((res) => res.width * res.height)
                                   .First();

            var cameraParams = new CameraParameters()
            {
                hologramOpacity        = 0f,
                cameraResolutionWidth  = cameraResolution.width,
                cameraResolutionHeight = cameraResolution.height,
                pixelFormat            = CapturePixelFormat.JPEG
            };

            photoCapture.StartPhotoModeAsync(cameraParams, startResult =>
            {
                Debug.Log($"Camera system start result = {startResult.resultType}.");
                IsCameraActive = startResult.success;
                onCameraStarted?.Invoke();
            });
        }
Пример #26
0
    void Start()
    {
        cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
        audioSource.Stop();

        CoreServices.DiagnosticsSystem.ShowDiagnostics = false;
        CoreServices.DiagnosticsSystem.ShowProfiler    = false;

        // create PhotoCapture object
        PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject)
        {
            photoCaptureObject = captureObject;
            CameraParameters cameraParameters       = new CameraParameters();
            cameraParameters.hologramOpacity        = 0.0f;
            cameraParameters.cameraResolutionWidth  = cameraResolution.width;
            cameraParameters.cameraResolutionHeight = cameraResolution.height;
            cameraParameters.pixelFormat            = CapturePixelFormat.BGRA32;

            photoCaptureObject.StartPhotoModeAsync(cameraParameters, delegate(PhotoCapture.PhotoCaptureResult result) { });
        });
    }
    public void StartTheFunction()
    {
        audiop.Play();
        PrimaryInterface.SetActive(false);
        cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
        PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject)
        {
            photoCapt = captureObject;

            CameraParameters cameraPar       = new CameraParameters();
            cameraPar.hologramOpacity        = 0.0f;
            cameraPar.cameraResolutionWidth  = cameraResolution.width;
            cameraPar.cameraResolutionHeight = cameraResolution.height;
            cameraPar.pixelFormat            = CapturePixelFormat.JPEG;

            photoCapt.StartPhotoModeAsync(cameraPar, delegate(PhotoCapture.PhotoCaptureResult result)
            {
                PictureShoot();
            });
        });
    }
Пример #28
0
    void OnPhotoCaptureCreated(PhotoCapture photoCapture)
    {
        if (photoCapture != null)
        {
            m_PhotoCapture = photoCapture;

            Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();

            CameraParameters cameraParameters = new CameraParameters();
            cameraParameters.hologramOpacity        = 1.0f;
            cameraParameters.cameraResolutionWidth  = cameraResolution.width;
            cameraParameters.cameraResolutionHeight = cameraResolution.height;
            cameraParameters.pixelFormat            = CapturePixelFormat.BGRA32;

            m_PhotoCapture.StartPhotoModeAsync(cameraParameters, OnPhotoModeStarted);
        }
        else
        {
            Debug.LogError("Failed to create PhotoCapture Instance!");
        }
    }
Пример #29
0
    void OnPhotoCaptureCreated(PhotoCapture captureObject)
    {
        gui.text           = "Start Capture";
        photoCaptureObject = captureObject;

        Resolution?cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).FirstOrDefault();

        if ((cameraResolution == null) || (cameraResolution.Value.width == 0))
        {
            gui.text = "Could not determine camera resolution";
            return;
        }

        CameraParameters c = new CameraParameters();

        c.hologramOpacity        = 0.0f;
        c.cameraResolutionWidth  = cameraResolution.Value.width;
        c.cameraResolutionHeight = cameraResolution.Value.height;
        c.pixelFormat            = CapturePixelFormat.BGRA32;

        captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
    }
Пример #30
0
    void OnPhotoCaptureCreated(PhotoCapture captureObject)
    {
        photoCaptureObject = captureObject;

        Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();

        cameraResolution = new Resolution()
        {
            width       = 896,
            height      = 504,
            refreshRate = 0
        };

        CameraParameters c = new CameraParameters();

        c.hologramOpacity        = 0.0f;
        c.cameraResolutionWidth  = cameraResolution.width;
        c.cameraResolutionHeight = cameraResolution.height;
        c.pixelFormat            = CapturePixelFormat.JPEG;

        captureObject.StartPhotoModeAsync(c, false, OnPhotoModeStarted);
    }