问题描述
我正在为灰度图像寻找一个简单的伽马校正公式,其值介于0到255之间。
I'm looking for a simple gamma correction formula for grayscale images with values between 0 and 255.
假设屏幕的灰度为2.2(它是一个液晶显示屏,所以我可能需要用更复杂的程序估算它,但让我们假设我的屏幕表现得很好。)
Let's say that the gamma of my screen is 2.2 (it's a LCD screen so i would probably need to estimate it with a more complicated procedure, but let's assume my screen is behaving nicely).
以下哪个公式是正确的一个?
Which one of the following formulas would be the correct one ?
(1)更正= 255 *(图像/ 255)。^ 2.2
(1) Corrected = 255 * (Image/255).^2.2
或
(2)更正= 255 *(图像/ 255)。^(1 / 2.2)
(2) Corrected = 255 * (Image/255).^(1/2.2)
(那些注定是matlab代码,但我希望即使对非matlab人也是可以理解的)
(those are destined to be matlab codes but i hope they are understandable even to non-matlab people)
我一直在互联网上环顾四周但发现这两个公式都在。我怀疑(2)是正确的,我的困惑是由于倾向于将伽玛值称为实际伽马值的倒数,但我真的很感激那些知道他们在谈论什么的人的一些反馈。 。
I've been looking around on the internet but found both formulas going around. I suspect (2) is the right one, and my confusion is due to the tendency to call "gamma value" the inverse of the actual gamma value, but i would really appreciate some feedback by people who know what they are talking about...
谢谢: - )
推荐答案
Gamma校正控制图像的整体亮度。未经校正的图像可能看起来漂白或太暗。假设计算机显示器具有 2.2
功率函数作为强度到电压响应曲线。这只是意味着如果您向监视器发送一条消息,某个像素的强度应该等于 x
,它实际上会显示一个强度等于的像素x 因为发送到监视器的电压范围在 0
和 1 $ c之间$ c>,这意味着显示的强度值将小于您想要的强度值。据说这样的显示器的伽马值
2.2
。
Gamma correction controls the overall brightness of an image. Images which are not corrected can look either bleached out or too dark. Suppose a computer monitor has 2.2
power function as an intensity to voltage response curve. This just means that if you send a message to the monitor that a certain pixel should have intensity equal to x
, it will actually display a pixel which has intensity equal to x Because the range of voltages sent to the monitor is between 0
and 1
, this means that the intensity value displayed will be less than what you wanted it to be. Such a monitor is said to have a gamma of 2.2
.
所以在你的情况下,
Corrected = 255 * (Image/255)^(1/2.2).
这篇关于伽马校正公式:。^(gamma)或。^(1 / gamma)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!