Search code examples
imagedecodegammagamma-function

Decode a gamma encoded image


I am working on a project, where the user can specify a gamma function on a image, for example:

y=(pow(10,(1023*x-681)/444)-.0408)/(1-.0408)) 

The image is then encoded with this gamma curve, and then my code must be able to return this image back to its original (linear) version:

(y=x)

My question is how I can decode a gamma corrected image back to a linear version if i know the encoding function?


Solution

  • Use inverse function

    x = (444 * (log ((1-.0408) * y + .0408) / log 10) + 681) / 1023