我试图直接从Windows Phone 8.1 Store App中的相机捕获图片。
我已经成功初始化了该设备的MediaCapture
并可以拍照,但它们始终是黑色的或暴露在外。
有人可以指出我如何使相机自动曝光的方向,并且如果可能的话,当我致电photoManager.VideoDeviceController.FocusControl.FocusAsync()
时遇到灾难性故障时,也会触发对焦吗?
最佳答案
对于自动对焦,我使用以下代码:
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);