gamma correction formula : .^(gamma) or .^(1/gamma)?

后端 未结 2 477
执念已碎
执念已碎 2021-01-30 08:52

I\'m looking for a simple gamma correction formula for grayscale images with values between 0 and 255.

Let\'s say that the gamma of my screen is 2.2 (it\'s an LCD screen

相关标签:
2条回答
  • 2021-01-30 09:21

    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 x2.2 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.

    So in your case,

    Corrected = 255 * (Image/255)^(1/2.2).
    
    0 讨论(0)
  • 2021-01-30 09:28

    Both formulas are used, one to encode gamma, and one to decode gamma.

    Gamma encoding is used to increase the quality of shadow values when an image is stored as integer intensity values, so to do gamma encoding you use the formula:

    encoded = ((original / 255) ^ (1 / gamma)) * 255
    

    Gamma decoding is used to restore the original values, so the formula for that is:

    original = ((encoded / 255) ^ gamma) * 255
    

    If the monitor does the gamma decoding, you would want to use the first formula to encode the image data.

    0 讨论(0)
提交回复
热议问题