且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MediaCapture Windows 8桌面-照片很暗

更新时间:2023-10-21 12:55:58

最新答复,但以防将来对人们有所帮助:深色图片通常是由于缺少视频预览而导致的。相机驱动程序使用预览流来运行其3A算法(自动白平衡/对焦/曝光)。目前,要让MediaCapture在桌面应用程序中进行预览有点挑战。一种方法是创建D3DImage并依靠某些本机互操作调用Media Foundation和DirectX。它不是很简单,但是可以封装,因此C#API表面仍然很简单。这是一些代码示例:
https://github.com/mmaitre314/MediaCaptureWPF

Late reply, but in case that helps folks in the future: 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). At the moment getting MediaCapture to preview in Desktop apps is a bit challenging. One way to do it is to create a D3DImage and rely on some native interop to call Media Foundation and DirectX. It is not trivial but can be encapsulated so the C# API surface remains simple. Here is some code sample: https://github.com/mmaitre314/MediaCaptureWPF