我正试图在Windows Phone 8.1 Store App中直接从相机捕捉图片。
我已成功为设备初始化MediaCapture
并拍摄照片,但它们总是黑色或曝光方式。
有人能指出我如何让相机自动曝光,如果可能的话也引发焦点,因为当我拨打photoManager.VideoDeviceController.FocusControl.FocusAsync()
时我会遇到灾难性的失败吗?
答案 0 :(得分:6)
对于自动对焦,我使用以下代码:
mediaCapture = new MediaCapture();
var settings = new MediaCaptureInitializationSettings();
settings.StreamingCaptureMode = StreamingCaptureMode.Video;
settings.PhotoCaptureSource = PhotoCaptureSource.VideoPreview;
await mediaCapture.InitializeAsync(settings);
var focusSettings = new FocusSettings();
focusSettings.AutoFocusRange = AutoFocusRange.FullRange;
focusSettings.Mode = FocusMode.Auto;
focusSettings.WaitForFocus = true;
focusSettings.DisableDriverFallback = false;
mediaCapture.VideoDeviceController.FocusControl.Configure(focusSettings);
曝光,试试这个:
await mediaCapture.VideoDeviceController.ExposureControl.SetAutoAsync(true);