Windows 8.1 MediaCapture预览在聚焦时变慢

时间:2015-08-27 21:35:17

标签: camera windows-8.1 tablet

我正在使用MediaCapture实例显示Dell Venue 8 Pro平板电脑相机的取景器。平板电脑正在运行Windows 8.1 Pro。我面临的问题是相机在聚焦和调整时似乎很慢,根据房间的灯光。预览可以非常快速地在太暗和太亮之间闪烁,并且似乎很难获得最佳的照明设置。使用相机应用程序可以轻松聚焦。这是我用来初始化相机的代码。

// Attempt to get the back camera if one is available, but use any camera device if not
var cameraDevice = await FindCameraDeviceByPanelAsync(Windows.Devices.Enumeration.Panel.Back);
if (cameraDevice == null)
{
    Debug.WriteLine("No camera device found!");
    return;
}
var settings = new MediaCaptureInitializationSettings { 
    VideoDeviceId = cameraDevice.Id, 
    AudioDeviceId = "",
    StreamingCaptureMode = StreamingCaptureMode.Video, 
    PhotoCaptureSource = PhotoCaptureSource.VideoPreview
};
//setup media capture
mediaCapture = new MediaCapture();
await mediaCapture.InitializeAsync(settings);
mediaCapture.VideoDeviceController.PrimaryUse = CaptureUse.Photo;
ViewFinder.Source = mediaCapture;
mediaCapture.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
await mediaCapture.StartPreviewAsync();

如何优化MediaCapture以快速聚焦? (该应用需要MediaCapture来解码QR码)

1 个答案:

答案 0 :(得分:0)

听起来你想要使用连续自动对焦。这个片段应该让你开始:

<?php 
$searchPage = custom function that gets my template-search.php(search results page) which is a custom post type
$sPID = $searchPage->getPostID();
$searchURL = get_permalink($sPID);
?>

<form action="<?=$searchURL?>" method="GET">
        <div>
        <input type="text" name="wd_keyword" placeholder="Find deals for..."/>
        <input type="submit"/>
        </div>
</form>

另外,我注意到你正在使用SetPreviewRotation。官方CameraStarterKit sample建议按以下方式轮换预览,以提高效率:

var focusControl = _mediaCapture.VideoDeviceController.FocusControl;

await focusControl.UnlockAsync();

// You may want to use AutoFocusRange.Macro for QR codes. Make sure it's within the supported modes though
var settings = new FocusSettings { Mode = FocusMode.Continuous, AutoFocusRange = AutoFocusRange.FullRange };

focusControl.Configure(settings);
await focusControl.FocusAsync();

您可以从//build/ presentation

了解有关相机会话预览旋转的更多信息