THE ROLE OF GAMMA CORRECTION

IN COLOUR IMAGE PROCESSING

Wilfried Kubinger, Markus Vincze, Minu Ayromlou

Institute of Flexible Automation,

Vienna UniversityofTechnoloy,

Gusshausstr. 27-29/361,

A-1040 Vienna, AUSTRIA

e-mail: wk,vm,[email protected]

ABSTRACT re-correction (the pro cess of nding the original image

tristimuli from gamma corrected tristimuli). Further-

In this pap er we analyse the in uence of gamma cor-

more we show that it is necessary to work with linear

rection of digital colour cameras on computer vision al-

colour signals to achieve correct colour information for

0 0 0

gorithms. These nonlinear signals R , G , and B yield

robust and reliable colour image pro cessing.

a nonlinear shift in colour space mo dels and can cause

algorithms to fail. Exp eriments of colour segmentation

2 GAMMA CORRECTED SIGNALS AND

and tracking con rm the claims. We suggest to use li-

DIGITAL COLOUR IMAGE PROCESSING

near light signals R, G, and B for calculating most co-

0 0

2.1 Colour space mo dels

lour space mo dels instead of the nonlinear signals R , G ,

0

Based on the RGB mo del, a lot of colour space mo dels

and B .To obtain linear light signals either the camera

have b een develop ed, prop osed, and used to yield a b et-

has to b e con gured linear using the gamma switch (if

ter description of the acquired colour information [8], [6].

available) or by removing the nonlinearity analytically

These mo dels can b e group ed into linear and nonlinear

using the inverse op eration (gamma re-correction).

colour space mo dels dep ending on the typ e of transfor-

1 INTRODUCTION

mation [2]. The rst group contains mo dels like Euro-

p ean PAL{TV YUV, CIE (Commission Internationale

For to day's computer vision systems it is a matter-of-



de L'Eclairage) XYZ, YCbCr for digital co ding of TV

course to handle colour cameras and to supp ort colour

pictures [1], or I1I2I3 prop osed by[8]. Popular memb ers

image pro cessing. The main reason to add colour in-

of the second group are the Hue{Saturation{Intensity

formation to conventional intensity signals is to gain

mo del HSI [2], the Hue{Saturation{Value mo del HSV

robustness and reliability in visual applications. Com-

[1], [5], the RGB mo del in spherical co ordinates r '

monly available CCD cameras represent the colour infor-

[4], L1 normalised colours YT1T2 [7], or CIE L*a*b*

mation of a pixel using the tristimuli values red, green,

[12].

and blue. This is referred to as the RGB colour space

The main advantage of representing colour in one of

mo del. The mo del is strongly device dep endent, since

these mo dels is the p ossibility of separating the informa-

there is no widely accepted de nition of colour wave

tion in an achromatic (for example, I) and a chromatic

length and the characteristics of the lters to obtain

part (for example, S and H) [2]. This chromatic part

these colour values [12].

can b e used for low level image pro cessing tasks like

This tristimuli are not very intuitive in directly de-

segmentation solely based on the colour of an ob ject.

termining and interpreting the actual colour of a pixel.

Due to this it is p ossible to avoid distortions caused by

Thus, based on the RGB mo del, a lot of colour space

variations in the intensity.

mo dels have b een develop ed, to yield a b etter descrip-

As noted in [3] and [9], colour information generated

tion of the acquired colour information [8].

by a colour space mo del should b e invariant to b oth

Although present computers handle colour images at

scene geometry and variations in the intensity of the

resp ectable rates, very little work investigates the ef-

illuminant to obtain robust and reliable colour informa-

fects of image acquisition devices onto colour space mo-

tion from a scene. The resp onse of each sensor channel

dels. Commonlyavailable digital CCD colour cameras

s = R; G; B can b e describ ed [3]by

are equipp ed with a gamma correction circuit to com-

Z

p ensate for the nonlinearities of the Catho de RayTu-

s=M (g; a) f ()L()C ()d; M (g; a)= aM (g ):

a s a

b es (CRT) used in TV sets and computer monitors [10].



(1) This pap er shows that tracking of colour patches stron-

f () is the sp ectral sensitivity of the sensor s, L()is gly dep ends on the chosen colour space mo del and the

s

the sp ectral p ower distribution of the illuminant, C () correct use of the gamma correction resp ectively gamma

1

stands for the re ection prop erties of the material, 

0.9

denotes the wavelength, g denotes the dep endence of

0.8

photometric angles, and a indicates the variation of the

1 0.7

intensity of the illuminant . Therefore a change in b oth

0.6

scene geometry and intensity can b e mo deled bymulti-

h tristimuli R, G, and B with the same value plying eac 0.5

= M (g; a). This scaling test is demonstrated on the

c 0.4

a

ery p opular YT1T2 mo del [7]. The two colour com- v 0.3

Normalised signal

ts T 1 and T 2 yield the same values indep endent

p onen 0.2 uli, that is of scaling the tristim 0.1

0

0 0.2 0.4 0.6 0.8 1 cR

R Normalised incoming light intensity

= T 1 =

R + G + B cR + cG + cB

G cG

Figure 1: Gamma corrected (solid) and linear light si-

T 2 = = : (2)

gnals (dotted).

R + G + B cR + cG + cB

These two colour comp onents hold their values and are

therefore invarianttochanges in scene geometry and

tristimuli are gamma corrected using eq. (3) and trans-

variations in intensity of light. Therefore T 1 and T 2

formed to the YT1T2 mo del. Fig. 2 presents the results

from the YT1T2 mo del are a go o d choice for the robust

of this simulation and shows the unwanted colour shift

description of the colour of an ob ject in a scene.

in the colour mo del. Due to the nonlinear resp onse of

the camera a false colour shift o ccurs, b oth in T 1 and T 2

2.2 The in uence of gamma correction

and these two comp onents are now no longer invariant

to scene geometry and variations in intensity.

In a colour image acquisition system, the light resp onse

Clearly this colour shift is unwanted and can cause

of eachchannel R, G, and B of a digital colour camera

2

vision algorithms to fail . Shadows are often areas of low

is transformed into a nonlinear signal by applying the

intensity and, as can b e seen in Fig. 2, cause a signi cant

gamma correction [10]. Eachchannel is corrected se-

non-linearity.

parately. The International Telecommunication Union (ITU) prop osed in 1990 her Recommendation ITU{R

0.35 0.66

BT.709 [10] for basic parameters for the HDTV stan-

0.64

dard. In this publication the transfer function in eq. (3) 0.34

h takes linear lightintensity (here R) is prop osed whic 0.62

0.33

0

to a nonlinear, gamma corrected signal R . 0.6 0.32 T1

T2 

0.58

4:5  R ; R  0:018

0

= (3)

R 0.31

0:45

:099  R 0:099 ; R>0:018 1 0.56

0.3

0.54

This transformation is applied on each of the tristimuli

0.29

0 0

0 0 0.2 0.4 0.6 0.8 1 0.52

. R, G, B , R , G , and B are in the range separately Normalised intensity of incoming light 0 0.2 0.4 0.6 0.8 1

Normalised intensity of incoming light

[0; 1]. These nonlinear signals (solid line in Fig. 1) are

necessary to comp ensate for the nonlinearities of a CRT

Figure 2: T1 and T2 based on linear light (dotted) and

and to obtain a linear resp onse on the viewing device as

gamma corrected (solid) tristimuli. The curve is caused

p erceived by the human user.

by using gamma corrected stimuli instead of the original

In colour image pro cessing gamma corrected signals

(linear) values.

lead to a nonlinear shift in the colour information of an

image. During the nonlinear resp onse of the signals the

amountofchange of each tristimuli dep ends on the col-

2.3 Gamma re-correction

lected light at eachchannel. This leads to a nonlinear

Toavoid this unwanted colour shift it is necessary to

shift of the colour of the pixel and can therefore cause

undo the gamma correction of the camera. There are

a wrong classi cation in a colour image pro cessing algo-

two p ossible ways to remove this nonlinearity. The rst

rithm.

way is to con gure the camera to deliver linear light

To demonstrate the problem of gamma correction in

signals. Since most cameras are not equipp ed with a

colour image pro cessing we applied the scaling test on

gamma switch, this way is normally not applicable. The

the linear tristimuli and scaled eachvalue of the triple

110 50 10

2

(R; G; B )=( ; ; ) with a = [0...1]. The scaled

Please note, that in black/white (graylevel) image pro cessing,

255 255 255

the e ect of this nonlinear relationship is minor. The acquired

1

image app ears brighter than the original scene and therefore only Avariation in intensity is describ ed by L ()= aL(),

new

thresholds for segmentation or edge detection are a ected. where a denotes a scalar.

9000 9000

second way is to apply an infers transfer function to

8000 8000

obtain linear light signals [10] (shown as dotted line in

alues as given by

Fig. 1) from the gamma corrected v 7000 7000 (

6000 6000

0

R

0

; R  0:081

4:5

R = (4) 0

1 5000 5000

R +0:099

0

0:45

) ( ; R > 0:081:

1:099

4000 4000

This op eration is applied on each of the nonlinear tristi-

3000 3000

0 0 0

muli R , G , and B separately and can b e called gamma

2000 2000

re-correction.

ab. 1 shows the correct sequence for calculating co-

T 1000 1000 lour space mo dels from gamma corrected R'G'B' tristi- 0 0

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

muli. For most mo dels the nonlinearities havetobe

removed b efore the transformation. Then the colour of

Figure 3: Exp erimental results with our tracking algo-

an ob ject holds its value during a change of lightinten-

rithm. The left gure shows the numb er of YT1T2-

sity, whichisvery imp ortant for many real time appli-

segmented pixels (Y-axis) when scaling the value of each

cations like robust tracking of coloured ob jects through

tristimuli (X-axis). The dotted line gives the result of

shadows. Note, that it is necessary for some mo dels to

using linear signals, the solid line gives the result of using

start with gamma corrected signals and re-correct only

gamma corrected signals. The right gure presents the

the achromatic value (e.g. Y in YUV). This is based

results of this exp eriment for the HSI-mo del.

on the background of these mo dels, which are used for

TV broadcasting and therefore as a direct interconnec-

tion b etween a gamma corrected camera and a nonlinear

Our exp eriments show that under similar lighting con-

CRT of a TV set [10], [1].

ditions gamma corrected and linear light (gamma re-

corrected) pixel values yield similar results. However,

3 EXPERIMENTS

when reducing the intensity of lighting, e.g. due to chan-

ges in surface orientation, scene geometry, or caused

In this section we demonstrate the e ects of tracking

by shadows, results have b een quite di erent. Images

colour patches for gamma corrected and for normal (li-

using conventional gamma corrections have diculties

near light) images. The exp eriments use segmentation

and lo ose track early. Using linear light signals and in-

by classifying colour pixels. The classi cation is based

variant colour space mo dels highly increases robustness.

on the statistical distribution of the initialised patch.

Colour patches are then tracked at a wide varietyof

Tracking is the re- nding of pixel memb ers of the ob-

shades and orientations.

tained ellipsoid [11]. The statistical comp onent is based

on a two dimensional principal comp onent analysis [2]

of the colour information (e.g. H and S).

4 SUMMARY

Fig. 4 shows the results of the segmentation of our

This pap er shows that tracking of coloured patches can

tracking algorithm. A decreasing intensitywas simula-

b e highly improved by correctly treating the gamma

ted by scaling the original linear light image by factors

correction. Since common cameras automatically use

of 1.0, 0.4, 0.3, 0.2, and 0.1 (from left to right). Using

a gamma correction for purp oses of viewing, digital

linear light signals (upp er row) to obtain a HSI{mo del

colour image pro cessing has to handle nonlinear si-

for tracking yields stable segmentation results. On the

gnals which should b e rendered linear using the correct

other hand segmentation and tracking based on gamma

gamma re-correction. Exp eriments of segmentation and

corrected signals (lower row) fails early when intensity

tracking based on di erent colour space mo dels con rm

decreases.

the claims.

In many applications a change of lightintensityis

Future investigations will consider di erences b etween

very common. While tracking coloured ob jects through

colour space mo dels. Some mo dels show less and others

shadows or under varying lightintensity conditions, one

higher sensitivity to lighting and shade changes. Ano-

should avoid the outlined e ects caused by the nonlinear

ther consequence is to investigate the radiometric e ects

resp onse of the camera. Wehave exp erimented with our

and nd a metho d to obtain linear signals by radiome-

tracking algorithm using di erent nonlinear colour space

tric calibration of the camera.

mo dels. The results are shown in Fig. 3. These gures

shows that not only colour space mo dels explicitly based

on linear light signals like HSI [1], [2] are a ected by the

5 ACKNOWLEDGMENT

gamma correction. Mo dels such as normalised colours

YT1T2 [7]orRGB in spherical co ordinates r ' [4] are This work was supp orted in part by the Austrian Science

also a ected. Foundation, contract numb er P11420{MAT.

CS mo del RGB YUV XYZ YCbCr HSI HSV YT1T2 r ' L*a*b*

Reference [2] [1] [1] [1] [2] [1] [7] [9] [8]

base mo del R'G'B' R'G'B' R'G'B' R'G'B' R'G'B' R'G'B' R'G'B' R'G'B' XYZ

re-correction RGB | RGB | RGB RGB RGB RGB |

CS transformation | Y'UV XYZ Y'CbCr HSI HSV YT1T2 r ' L*a*b*

re-correction | YUV | YCbCr | | | { {

Table 1: Sequence for transforming gamma corrected tristimuli to other colour spaces (CS). The ' denotes gamma corrected signals, otherwise they are linear.

Figure 4: Tracking a yellow sphere using the HSI colour space mo del (upp er row: linear light signals, lower row:

gamma corrected signals). The tracking algorithm is initialised on the same p osition for b oth images (left). The linear

sensor resp onse is scaled down from left to right using scaling factors s of 1.0, 0.4, 0.3, 0.2, and 0.1, resp ectively. Each

segmented pixel is marked by a black dot.

[8] Ohta, Y.-I., Kanade, T., Sakai, T.: Color Informa- References

tion for Region Segmentation. Computer Graphics

[1] Ford, A., Rob erts, A: Colour Space Conversions.

and Image Pro cessing 13 (1980) 222{241

http://www.wmin.ac.uk/ITRG/docs/coloureq/

(1996)

[9] Pla, F., Juste, F., Ferri, F., Vicens, M.: Colour

segmentation based on a light re ection mo del to

[2] Gonzalez, R.C., Wo o ds, R.E.: Digital Image

lo cate citrus fruits for rob otic harvesting. Compu-

Pro cessing. Addison-Wesley Publishing Company,

ters and Electronics in Agriculture 9 (1993) 53{70

Reading, Massachusetts, 2. Edition (1993)

[10] Poynton, C.A.: A Technical Intro duction to Digital

[3] Healey, G.: Segmenting Images Using Normalized

Video. John Wiley & Sons (1996)

Color. IEEE Transactions on Systems, Man, and

[11] Rasmussen, C., Toyama, K., Hager, G.D.: Tracking

Cyb ernetics 27 (1) (1992) 64{73

Ob jects By Color Alone. Yale University,Tech. Re-

p ort TR 1114, (1996)

[4] Lee, J.-H., Chang, B.-H., Kim, S.-D.: Comparison

of colour transformations for image segmentation.

[12] Sharma, G., Trussell, H.J.: Digital Color Imaging.

Electronics Letters 30 (20) (1994) 1660{1661

IEEE Trans. on Image Pro cessing 6 (7) (1997) 901{

932

[5] Levkowitz, H., Herman, G.T.: GLHS: A Genera-

lized , Hue, and Saturation Color Mo del.

CVGIP: Graphical Mo dels 55 (4) (1993) 271{285

[6] Liu, J., Yang, Y.-H.: Multiresolution Color Image

Segmentation. IEEE Trans. on PAMI 16 (7) (1994)

689{700

[7] Nevatia, R.: A Color Edge Detector and Its Use

in Scene Segmentation. IEEE Trans. on Systems,

Man, and Cyb ernetics 7 (11) (1977) 820{826