MediaCapture:与相机应用程序相比质量较低,TrySetAuto无法正常工作

时间:2015-02-12 13:39:53

标签: windows-runtime windows-phone-8.1

我在诺基亚Lumia 930上使用MediaCapture拍照(使用默认分辨率,在我的情况下为500万像素)。我认为使用MediaCapture拍摄的照片质量远低于相机应用拍摄的照片质量。它们的颜色较少,有点暗,前景稍微模糊。

我尝试将焦距,亮度,对比度,曝光和白平衡设置为自动(就像在我的情况下在相机应用程序中),但TrySetAuto方法始终返回false(表示它不起作用)。

可能有什么不对?我怎样才能提高MediaCapture拍摄的照片质量。是TrySetAuto马车吗?

以下是我用于创建和初始化MediaCapture的代码:

  private async Task CreateMediaCapture()
  {

     this.mediaCapture = new MediaCapture();

     // Initialize the media capture
     var settings = new MediaCaptureInitializationSettings
     {
        VideoDeviceId = this.deviceInfoCollection[this.DeviceListBox.SelectedIndex].Id
     };
     await this.mediaCapture.InitializeAsync(settings);

     // Set focus, brightness, contrast, exposure and white balance to Auto
     // TODO: This does nothing so far. Photos made with MediaCapture still have a lower quality than
     // photos made with the Camera App. They have less color, are darker and slightly blurry in the
     // foreground
     if (mediaCapture.VideoDeviceController.Focus.TrySetAuto(true) == false)
     {
        Debug.WriteLine("Setting Focus to auto did not work");
     }
     if (mediaCapture.VideoDeviceController.Brightness.TrySetAuto(true) == false)
     {
        Debug.WriteLine("Setting Brightness to auto did not work");
     }
     if (mediaCapture.VideoDeviceController.Contrast.TrySetAuto(true) == false)
     {
        Debug.WriteLine("Setting Contrast to auto did not work");
     }
     if (mediaCapture.VideoDeviceController.Exposure.TrySetAuto(true) == false)
     {
        Debug.WriteLine("Setting Exposure to auto did not work");
     }
     if (mediaCapture.VideoDeviceController.WhiteBalance.TrySetAuto(true) == false)
     {
        Debug.WriteLine("Setting WhiteBalance to auto did not work");
     }
  }

以下是拍摄照片的代码(具有现有预览):

private async Task TakePhotoAsync
{
   ImageEncodingProperties imageFormat = ImageEncodingProperties.CreateJpeg();

   // Create a storage file in the picture library
   StorageFile photoFile = null;
   this.DisplayInfo("Creating storage file ...");
   photoFile = await KnownFolders.PicturesLibrary.CreateFileAsync(
      "TestPhoto.jpg", CreationCollisionOption.GenerateUniqueName);

   // Take photo
   await this.mediaCapture.CapturePhotoToStorageFileAsync(imageFormat, photoFile);
}

0 个答案:

没有答案
相关问题