MediaCapture:让网络摄像头在拍摄前适应光线 [英] MediaCapture: Let the Webcam accommodate to light before capturing

查看:188
本文介绍了MediaCapture:让网络摄像头在拍摄前适应光线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的UWP应用程序目前按如下方式拍摄照片:

My UWP app currently captures a photo as follows:

m_mediaCapture = new MediaCapture();
await m_mediaCapture.InitializeAsync();

ImageEncodingProperties imageProperties = ImageEncodingProperties.CreateUncompressed(MediaPixelFormat.Bgra8);


Low​Lag​Photo​Capture photoCapture = await m_mediaCapture.PrepareLowLagPhotoCaptureAsync(imageProperties);

CapturedPhoto photo = await photoCapture.CaptureAsync();
CapturedFrame frame = photo.Frame;
SoftwareBitmap SWBitmap = frame.SoftwareBitmap;

除了一件事情以外它运作良好:我的网络摄像头需要一秒左右才能适应明亮的光线。所以在明亮的光线条件下,这段代码会产生一张褪色的照片,几乎所有东西都只是白色。

It works well except one thing: my webcam takes a second or so to accommodate to bright light. So in bright light conditions, this code produces a washed out photo where almost everything is just white.

如何让网络摄像头适应并降低亮度?

How would I go about letting the webcam accommodate and dial down the brightness?

提前致谢。

- 彼得

推荐答案

嗨Peter Ps,

>> 如何让b $ b让网络摄像头适应并调低亮度?

>>How would I go about letting the webcam accommodate and dial down the brightness?

可以使用
亮度
属性
< span style ="font-size:10.5pt; font-family:'Segoe UI',sans-serif; border:none windowtext 1.0pt; padding:0in"> VideoDeviceController
Class
。喜欢
这个

It is possible to adjust the brightness for webcam using Brightness property of VideoDeviceController Class. Like this:


  

            MediaDeviceControl control = mediaCapture.VideoDeviceController.Brightness;

            MediaDeviceControlCapabilities capapbility = _ control.Capabilities;
		// make sure webcam supports this capability. If it doesn’t support, these code won’t be executed.
            if (capability.Supported == true)
            {
                //get the value
                double val = 0;
                control.TryGetValue(out val);

                //set the value and note the limit for this value
                double max = capapbility.Max;
                double min = capapbility.Min;

                control.TrySetValue(val);

                // make the app auto supported
                if (capapbility.AutoModeSupported)
                {
                    bool isAuto;
                    _control.TryGetAuto(out isAuto);
                }
            }




此外,您可以打开自己喜欢的浏览器并搜索"在运行时调整网络摄像头的
亮度UWP
",你可以找到某人关于使用这个属性的视频。

Besides, you could open your favorite browser and search for "Adjust the brightness of a webcam at runtime UWP", you could find someone’s video about using this property.

祝你好运,

Roy


这篇关于MediaCapture:让网络摄像头在拍摄前适应光线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆