Adam Lee
Adam Lee

Reputation: 25738

How to process Gamma correction if having RGB data

I have RGB data and Gamma correction ration

Can I use the following to calculate

R = pow(R, 1/Gamma)
G = pow(G, 1/Gamma)
B = pow(B, 1/Gamma)

or Gamma correction only applies to intensity.(brightness)

Upvotes: 1

Views: 7248

Answers (2)

Kasparov92
Kasparov92

Reputation: 1384

I think it shall be pow(R, gamma) and not 1/gamma and the same goes for the rest of the channels http://en.wikipedia.org/wiki/Gamma_correction

Upvotes: 0

Glenn
Glenn

Reputation: 1079

This should work correctly. For most RGB color encodings, gamma is applied per-channel.

Just be careful, R, G, and B are expected to be on a range [0,1] before applying the inverse gamma function.

Upvotes: 4

Related Questions