Gamma correction - the constant value?

5 views (last 30 days)
Can someone help me out how to determine the constant from the Gamma correction in terms of gamma so that the interval [0,255] is mapped to itself?
The Gamma correction is: I out(m,n) = c[ I in(m,n)]^ gamma, where c is the constant
What I think: If the interval is mapped to itself, this means that I out = I in, right? So if I out = I in = A, then
c = A/A^gamma = A^(1-gamma).
But how to make the constant c in terms only of gamma?
Thanks!
  2 Comments
Image Analyst
Image Analyst on 19 Oct 2015
Do you have the Statistics and Machine Learning Toolbox?
Lachezar Petkov
Lachezar Petkov on 19 Oct 2015
What do you mean by that? Sorry if I ask stupid questions, but I try to learn everything by myself. The question I was looking at does not say anything about mechanical and machine learning toolbox.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 19 Oct 2015
It means that 255^gamma * c = 255, so c = 255 / (255^gamma), so c = 255 ^ (1-gamma)
  2 Comments
Lachezar Petkov
Lachezar Petkov on 19 Oct 2015
Why it is 255? How does this maps it to itselfs? I just don't want to get anything for granted and to understand everything. Thank you for the answer!
Walter Roberson
Walter Roberson on 19 Oct 2015
The interval has to map on to itself, so the transformed 0 has to map to 0, and the transformed 255 has to map to 255. For non-zero gamma, 0^gamma = 0, and multiply that by anything other than Nan or infinities gives 0, so the mapping of 0 to 0 does not allow you to constrain the value of c. But the mapping of 255 to 255 does allow you to calculate c.
When it is said that the interval must map to itself, it does not mean that each value in the interval must map to itself: that requirement would impose that gamma = 1 and c = 1 to satisfy it. It means that the values in [0, 255] must map to [0, 255]. The transform is continuous and monotonic so the maximum and minimum are at the boundaries so you only need to check the boundaries.
Note for future reference: when it is said that the interval is transformed to itself, it is not necessarily the case that the order of values remains the same. The transform x to 255-x would also transform the interval to itself. Transforming the interval to itself implies that the maximum of the transform is the maximum of the interval and the minimum of the transform is the minimum of the interval, and that no values are transformed to values outside the interval, but it does not require that the order be maintained.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!