小编bit*_*ter的帖子

使用PhotoCaptureDevice拍摄照片的方向错误

我已经实现了自己的取景器和相机逻辑来捕捉图像.这一切都很好,除了一些奇怪的方向问题.使用我的应用拍摄的照片可以是纵向或横向模式.当我通过内置照片应用程序浏览照片时,方向符合预期.当我通过USB连接手机时从PC浏览图片时,缩略图始终处于横向状态,但是当我打开文件时,照片正好处于纵向模式.当我将应用程序中的图像绑定到Telerik PanAndZoom图像时,方向再次出错.

这是我的初始化代码.

Windows.Foundation.Size best;
            //   Initialize the camera, when available.
            if (PhotoCaptureDevice.AvailableSensorLocations.Contains(CameraSensorLocation.Back))
            {
                // Use the back camera.
                best = FindBestResolutuion(CameraSensorLocation.Back, AspectRatio.R_16_9);
                _captureDevice = await PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Back, best);
                _captureDevice.SetProperty(KnownCameraPhotoProperties.FlashMode, 
            }
            else if (PhotoCaptureDevice.AvailableSensorLocations.Contains(CameraSensorLocation.Front))
            {
                // Otherwise, use the front camera.
                best = FindBestResolutuion(CameraSensorLocation.Front);
                _captureDevice = await PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Front, best);
            }
            if (Math.Round(best.Width / best.Height, 1) == 1.3)
                _detecteAspectRatio = AspectRatio.R_4_3;
            else
                _detecteAspectRatio = AspectRatio.R_16_9;


            SetOrientation(this.Orientation);
            //Set the VideoBrush source to the camera.

            viewfinderBrush.SetSource(_captureDevice);
Run Code Online (Sandbox Code Playgroud)

这是捕获的代码.

    if (!_capturing)
        {
            _capturing = true;
            _captureMemoryStream …
Run Code Online (Sandbox Code Playgroud)

camera windows-phone windows-phone-8

3
推荐指数
1
解决办法
1728
查看次数

标签 统计

camera ×1

windows-phone ×1

windows-phone-8 ×1