我正在尝试制作当您单击 livetile 时拍照的应用程序。不幸的是,智能手机上存在一些问题:此应用程序保存的照片全黑。我不知道我会做错什么。
事实:
- 此 UWP 应用在 PC 上运行正常,问题仅出现在我的 Lumia 设备上
- 正确检测到相机
- 这不是 livetile 的问题:无论我点击 livetile 还是点击按钮拍照都不起作用
- 并非所有照片都是全黑的。当我拍摄 window (由于阳光而明亮)的照片时,我可以看到它模糊的形状。也许照片拍摄正确,但不知何故变暗了?
代码太多要粘贴,所以我决定在 GitHub 上发布整个项目。
您知道为什么它不起作用吗?这段代码大部分是从一个教程中复制过来的,所以很奇怪它有问题。
最佳答案
我找到了灵魂:
初始化MediaCapture后、拍照前,需要创建CaptureElement并开始预览。
var captureElement = new CaptureElement();
captureElement.Source = _mediaCapture;
await _mediaCapture.StartPreviewAsync();
Why you need to start previewing
dark pictures are often due to the lack of video preview. Camera drivers use the preview stream to run their 3A algorithms (auto-whitebalance/focus/exposure).
Why you need to create Capture Element
This error [that is shown when you use StartPreviewAsync without CaptureElement] occurs because currently StartPreviewAsync requires a sink to output frames to. This can be fixed by creating a capture element in xaml to display the frames.
关于c# - 媒体捕捉 - 手机拍摄的照片较暗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37031540/