Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gamma correction seems wrong #27

Open
iZhangHui opened this issue Mar 7, 2019 · 3 comments
Open

gamma correction seems wrong #27

iZhangHui opened this issue Mar 7, 2019 · 3 comments

Comments

@iZhangHui
Copy link

The gamma correction calculation formula in colorview.ino seems not right.
`for (int i=0; i<256; i++) {

float x = i;

x /= 255;

x = pow(x, 2.5);

x *= 255;

`

I think it should be x = pow(x, 2.5); --> x = pow(x, 1/2.5);

@ladyada
Copy link
Member

ladyada commented Mar 7, 2019

@PaintYourDragon any thoughts?

@cedricp
Copy link

cedricp commented May 27, 2019

It's an interesting issue, that would need to be studied.

At first, we must know what's the OETF (opto electronic transfer function) of a LED, from what I read, brightness is linear with current (here we're driving LED with voltage).
Then we could apply the correct EOTF (electro optical transfer function) and get a correct result.

Note that I'm not using the term "gamma", it's a too much global actually and means nothing.
I'll do some measures and report if you are interested.

@cedricp
Copy link

cedricp commented May 27, 2019

In an RGB led datasheet (https://www.arduino.cc/documents/datasheets/LEDRGB-L-154A4SURK.pdf), we can see the current/voltage transfer curve. Search for the forward current vs. forward voltage chart.
So the I think a more correct EOTF would indeed be something like pow(x, 1/y), where y is still to find. We must also consider the voltage offset (at what voltage the LED starts to emit light)
RGBled curVSlum
EDIT : y seems to be close to 2.35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants