How are gamma and brightness combined?
I'm wondering about what pixel values to expect when I use both Brightness > 0 and Gamma > 1. As the simplest data point, I'm looking at pixels which are black with Brightness = 0 and Gamma = 1. For this discussion, I'm using RGB8. This pixel value becomes 20 if I set Brightness to 320 (=20/256*4096, or 7.81 absValue). If I instead leave Brightness = 0 and set Gamma = 2.2, the pixel value remains 0. Both of those results are as I expect
But when I set Brightness to 320 and Gamma = 2.2, a pixel which was previously 0 becomes about 60. Why? If I can understand this point, I hope to be able to predict the linear values from the gamma-encoded, brightness-offset values in the image.
-
Hi MJ,
I think this article might answer your question: https://www.teledynevisionsolutions.com/support/support-center/technical-guidance/iis/how-is-gamma-calculated-and-applied/
Best regards,Manuel
0 -
Thank you for the link to that description of how gamma is applied. That is extremely helpful and does explain some of the data that I've been seeing. But it still doesn't explain the exact value I'm seeing for "black" pixels.
With no gamma encoding, RGB8 output, and Brightness = 0, a black pixel has a value of 0. If I increase the Brightness to 320, that pixel's value becomes 20. If this value were encoded with a theoretical gamma of 2.2, it would become 80.17. What I observe is a value of 62. From your reply, I've learned that the gamma is implemented with a piece-wise linear curve, which would explain a lower measured value than theoretical value.
The link you shared says "In 8-bit-per-pixel modes (including RGB8) gamma is applied as a sixteen section piece-wise linear approximation using the camera's LUT." But that still doesn't agree with my data. What _would_ agree with my data is if there were 8 sections.
If there were 8 sections, each section would have 256/8=32 bit levels, so my value of 20 would be on the first segment, between (0,0) and (32,99.27). Interpolating between those would be (20,62.04), exactly what I measure. (The same is true for every possible value of brightness- purple circles in my plot below).
If there were 16 sections, 20 would be on the 2nd segment, and be 79.1, much closer to the theoretical value. I wouldn't have noticed the discrepancy.
Another experiment suggests that there are 8 segments: If I disable gamma and capture images of increasing exposure times yielding pixel values from 0 to 255, and then repeat the experiment with gamma = 2.2, there is an obvious knee at the exposure time which yielded a pixel value of 32 with no gamma.
Is it possible that my Blackfly implements gamma with an 8-segment piecewise linear approximation?
0
Please sign in to leave a comment.
Comments
2 comments