Reputation: 18239
Here is the standard fwd Gamma 2.22 (1 / 0.45) correction formula:
for R,G,B < 0.018
R´ = 4.5 * R
G´ = 4.5 * G
B´ = 4.5 * B
for R,G,B ≥ 0.018
R´ = 1.099 * R^0.45 - 0.099
G´ = 1.099 * G^0.45 - 0.099
B´ = 1.099 * B^0.45 - 0.099
Where do the figures 0.18, 4.5, 1.099, and 0.099 come from? I specifically need to know how they are derived.
I need to know because I am writing a gamma correction function, and the simple approach of using a power and scaling, rather than the above, yields different results.
Upvotes: 1
Views: 1183
Reputation: 6905
So here is how far I figured it.
The gamma correction function had to be designed with the following requirements (see this paper):
so this problem can be solved by finding the numbers {a,b,c,x0} defining a function g:x->g(x) such as:
which yields the following equations:
equivalent to:
if you set x0 to 0.018, you get :
The remaining questions is: how did they choose x0? I could not find any justification for the 0.018 value... Or they could have started with any of the other 3 parameters (for instance, set the toe slope to 4.5, they derive a,b and x0).
Not sure this will solve your problem, anyway I hope this helps (I had fun with the math).
Upvotes: 1