简体   繁体   English

在 opencv python 中获取图像的亮度和对比度

[英]Get brightness and contrast of an image in opencv python

I am trying to do some image processing in python3.7 using openCV 4+.我正在尝试使用 openCV 4+ 在 python3.7 中进行一些图像处理。 I need to add a filter where it checks for the brightness of the input image/frame(if video) and then decides whether to change brightness or not.我需要添加一个过滤器来检查输入图像/帧(如果是视频)的亮度,然后决定是否改变亮度。 Can some one help me how do I get the brightness of the current image?有人可以帮我如何获得当前图像的亮度吗? Thank you in advance先感谢您

There is no "brightness" absolute value stored in images.图像中没有存储“亮度”绝对值。 Whereas, you can compute the mean of the image luminance, and consider it to be the 0 brightness to enable the user to add/remove brightness, or calculate the difference between this mean and the wanted one, to adjust it.然而,您可以计算图像亮度的平均值,并将其视为0亮度以使用户能够添加/删除亮度,或者计算该平均值与所需亮度之间的差异,以进行调整。

You can refer to this post .你可以参考这篇文章

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

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