On Gamma correction
W. H¨am¨al¨ainen
Problem: displays produce light intensity L in a non-linear manner:
L ≈ vγ,
where v is the coded intensity value and γ is a display-dependent constant.
If RGB-image, then all intensity functions have their own γ values:
L(R) ≈ v(R)γR L(G) ≈ v(G)γG L(B) ≈ v(B)γB
1
⇒ cameras do already assume some γ-values and code γ-corrected intensity values:
v(X) = I(X)1/γX
Now the display represents the colours correctly, if the γ-values just are the same:
L(X) = v(X)γX = (I(X)1/γX)γX = I(X)
2
Other colour spaces
• XY Z: only Y (luminosity) is affected
• Lab and Luv: only L (lightness) is affected
• HSI: only I (intensity) is affected Gray-scale images: just one γ (brightness) Typical γ-values
• most CRTs (cathode ray tubes): γ ∈ [2.0, 2.4]
• MacIntosh: γ ≈ 1.5
• SGI: γ ≈ 1.3
E.g. if γ = 2.2 (PC monitor), then the camera encodes the intensity by v = I1/2.2 ≈ I0.45.
3
When γ is problem?
• often the used γ-value is unknown and varies between devices
• the same colour has different codes, when the lightning varies → has intensity, chrom- asity or both changed?
• often the image processing algorithms need the true colours
E.g. how to find the same hue of wood or stone, when the images are taken under different light- ning conditions?
⇒ we should eliminate γ-correction!
4
Eliminating γ -correction
Easy, if γ-values are known!
Otherwise:
• empirical estimation using known reflectance and reference light
• mathematically in the log-space (logR,log G,log B):
1. calculate the standard deviation of log X values over all pixels
2. divide the X-values by stdev(log X) (Reason: log Xγ = γ log X [Finlayson and Xu])
• by analyzing higher order statistics – How??
[Farid]
5
Task
Test the effect of different γ-values in Linux!
You can change the values by command xgamma.
xgamma -gamma n changes all γ-values to the positive integer n. If you want to change γ- values for R-, G- and B components separately, use three options: xgamma -rgamma n1 -bgamma n2 -bgamma n3, where n1, n2 and n3 are pos- itive integers. You can return the default set- ting by xgamma -gamma 1. (This means that the real γ-value is scaled such that 1.0 is the default in a PC monitor).
You can also try coolgamma-program.
6
Sources
• Angulo and Serra: Modelling and segmen- tation of colour images in polar represen- tations. Image and Vision Computing 25:
475-495, 2007.
• Daul, R¨osch, and Clauss: Building a color classification system for textured and hue homogenous surfaces: system calibration and algorithm. Machine Vision and Applications, 12: 137-148, 2000.
• Farid: Blind inverse gamma correction. IEEE transactions on image processing, vol. 10, no. 10, 1428-1433, 2001.
• Finlayson and Xu: Illuminant and gamma comprehensive normalisation in log RGB space.
Pattern Recognition Letters 24: 1679-1690, 2003.
• Reinhard, Shirley et al.: Second order statis- tics in computer graphics. Proc. of the 1st Symposium on Applied perception in graph- ics and visualization 99–106, ACM 2004.
7