我正在爲windows phone 8.1編程並使用MediaCapture(Windows.Media.Capture)構建了一個基本相機。 如何將焦點和閃光燈添加到相機?這是我當前的代碼:如何將焦點和閃光燈支持添加到相機
protected override void OnNavigatedTo(NavigationEventArgs e)
{
DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
width = Convert.ToInt32(Window.Current.Bounds.Width);
height = Convert.ToInt32(Window.Current.Bounds.Height);
capturePreview.Width = width;
capturePreview.Height = height;
Starter();
}
async private void Starter()
{
captureManager = new MediaCapture();
await captureManager.InitializeAsync();
StartCapturePreview_Click();
}
async private void StartCapturePreview_Click()
{
capturePreview.Source = captureManager;
await captureManager.StartPreviewAsync();
}
async private void StopCapturePreview_Click(object sender, RoutedEventArgs e)
{
await captureManager.StopPreviewAsync();
}
//private void focus_Click(object sender, RoutedEventArgs e)
//{
//FocusManager.TryMoveFocus(FocusNavigationDirection.Next);
//}
async private void CapturePhoto_Click(object sender, RoutedEventArgs e)
{
ImageEncodingProperties imgFormat = ImageEncodingProperties.CreateJpeg();
// create storage file in local app storage
StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(
"Photo.jpg",
CreationCollisionOption.ReplaceExisting);
// take photo
await captureManager.CapturePhotoToStorageFileAsync(imgFormat, file);
// Get photo as a BitmapImage
BitmapImage bmpImage = new BitmapImage(new Uri(file.Path));
// imagePreivew is a <Image> object defined in XAML
imagePreview.Source = bmpImage;
}
什麼是添加焦點和閃光燈的最佳方式?我嘗試過使用FocusManager,但沒有成功使用它。
看來相機拍攝p中的整個捕獲預覽,有沒有辦法爲我做的重點工作還通過在區域手動按下我想集中 – IsaacDj
我?我不知道,我只發現它集中在屏幕中心的物體上,我通過拍攝我的手並檢查哪些指紋和手跡最清晰,只有中心的部分是這樣,然後添加了ar矩形來查看物體在不再聚焦之前距物體中心多遠的距離。我不認爲重點領域可以移動。 – mcb
如何添加矩形以查看焦點區域? – IsaacDj