C#:设置手机Windows Phone 8.1相机的亮度

时间:2015-03-12 10:41:39

标签: c# windows-phone-8 windows-phone-8.1

我试图更改Windows手机的相机亮度

我试过这段代码

private async Task StartCapture()
    {
                mediaCapture = new MediaCapture();

                var _deviceInformation = await GetCameraDeviceInfoAsync(Windows.Devices.Enumeration.Panel.Back);

                var settings = new MediaCaptureInitializationSettings();
                settings.StreamingCaptureMode = StreamingCaptureMode.Video;
                settings.PhotoCaptureSource = PhotoCaptureSource.VideoPreview;
                settings.AudioDeviceId = "";
                if (_deviceInformation != null)
                    settings.VideoDeviceId = _deviceInformation.Id;

                await mediaCapture.InitializeAsync(settings);
                mediaCapture.VideoDeviceController.Brightness.TrySetValue(50);



            captureReceipt.Source = mediaCapture;
            await mediaCapture.StartPreviewAsync();


    }

    private static async Task<DeviceInformation> GetCameraDeviceInfoAsync(Windows.Devices.Enumeration.Panel desiredPanel)
    {

        DeviceInformation device = (await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture))
            .FirstOrDefault(d => d.EnclosureLocation != null && d.EnclosureLocation.Panel == desiredPanel);


        return device;
    }

Xaml是:

<Grid>
    <CaptureElement x:Name="captureReceipt"/>
</Grid>

但我无法改变相机的亮度

有什么方法可以改变windows手机相机的亮度吗?

1 个答案:

答案 0 :(得分:1)

检查mediaCapture.VideoDeviceController.Brightness.Capabilities中的值。

是否支持且AutoModeSupported设置为true? Min,Max和Default的值是什么?