简体   繁体   English

如何使用 EmguCV 设置网络摄像头属性?

[英]How to set webcam properties with EmguCV?

I made an application in C# following the EmguCV tutorials for capture of web camera.我按照 EmguCV 教程使用 C# 制作了一个应用程序,用于捕获网络摄像头。 Preview is working fine, but I can't change the camera properties like brightness,exposure etc. and I need to implement this in my application.预览工作正常,但我无法更改亮度、曝光等相机属性,我需要在我的应用程序中实现这一点。 In documention it's said I should do it with CAP_PROP Enumeration, but it's not working, here is my code where I change brightness:在文档中说我应该用 CAP_PROP 枚举来做,但它不起作用,这是我改变亮度的代码:

_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_BRIGHTNESS, newBrightnessValue);

but nothing changes...但什么都没有改变……

I found some responses on EmguCV forums, in which they say this should not be done with EmguCV, but I have done most of my project using EmguCV and I wouldn't like to start over with some other library just because of this :/我在 EmguCV 论坛上找到了一些回复,他们说这不应该用 EmguCV 来完成,但我已经使用 EmguCV 完成了我的大部分项目,我不想仅仅因为这个而重新开始使用其他一些库:/

Is there some alternative way of doing this, but not too complicated like DirectShow?有没有其他方法可以做到这一点,但不像 DirectShow 那样复杂? Maybe some lib which could set these properties, without need to change the rest of code I have made using Emgu CV?也许一些可以设置这些属性的库,而无需更改我使用 Emgu CV 制作的其余代码?

我遇到了同样的问题,发现这是有效的:

CvInvoke.cvSetCaptureProperty(_capture.Ptr, CAP_PROP.CV_CAP_PROP_BRIGHTNESS, newBrightnessValue);

You can directly manipulate the brightness,contrast,gamma values of an image after its captured.您可以在捕获后直接操作图像的亮度、对比度、伽马值。

So some of the techniques will be like this.所以有些技巧会是这样。

Image<Bgr, byte> myImage;// you can store a static image from disk or 
                         //load one from web cam frame in it

myImage= myImage.Mul(brightValue);// multiply the image with decimal number 
                                  //to increase the brightness

myImage._EqualizeHist(); //to improve the contrast read documentation,
                         //as you can play around the threshold values too.

myImage._GammaCorrect(1.8d);// give a decimal value to adjust the gamma value

You can refer to this post as it might help.您可以参考这篇文章,因为它可能会有所帮助。

I also facing the problem for setting exposure _capture.SetCaptureProperty(CapProp.Exposure, 30000.0) do you have the solution? 我还面临设置曝光_capture.SetCaptureProperty(CapProp.Exposure, 30000.0)的问题,您有解决方案吗?

I am using Basler camera (acA1300-30gm). 我正在使用Basler相机(acA1300-30gm)。

Thank. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM