1. Contributed paper
OPTO-ELECTRONICS REVIEW 11(3), 193–196 (2003)
Colour temperature estimation algorithm for digital images
– properties and convergence
K. WNUKOWICZ* and W. SKARBEK
Institute of Radioelectronics, Warsaw University of Technology,
15/19 Nowowiejska Str., 00-665 Warsaw, Poland
The paper presents an algorithm for estimation of temperature of image. Colour temperature is important, perceptual feature
describing colour and content of images. The main idea of the algorithm is to average pixel values of image, omitting the
values which have meaningless influence on perception of colour temperature. It is done in an iterative procedure. The con-
vergence of the procedure is discussed. The algorithm can be applied in image search/retrieval tasks and is proposed in the
MPEG-7 colour temperature descriptor for estimation of colour temperature of images.
Keywords: colour temperature, colour perception, image retrieval.
1. Introduction This article presents a colour temperature estimation al-
gorithm for image to represent general visual impression of
Colour temperature is one of the visual features essentially colour temperature a viewer has of the image. The impres-
influencing perception of colour by the human visual sys- sion depends on elements like image colour content, illumi-
tem. Categories such as hot, warm, moderate, and cool are nation of the scene while it was photographed, and to some
used for describing the felt temperature of the touched ob- extent on observation conditions. The procedure consists of
jects. The same categories can be considered in the case of two main steps. In the first step, the image average colour
colour temperature feeling by observer who is viewing col- value is computed by omitting pixels having poor influence
our scene or image. This feeling depends mostly on proper- on colour temperature impression. In the second step, the
ties of illumination of the viewed scene. Different kinds of colour temperature value is estimated for previously com-
illumination of the same scene gives different colour tem- puted colour, utilizing its chromaticity coordinate values. It
perature feelings, adequately to the illumination. For exam- is done by Robertson’s algorithm [1] which approximates
ple, natural daylight can have light in broad range of colour colour temperature by means of the fixed lines on uv chro-
temperature values depending on the time of the day as maticity diagram called isotemperature lines.
well as atmospheric and weather conditions which have an The estimated colour temperature of image can be clas-
influence on colour temperature perception in outdoor im- sified into one of subjective categories: hot, warm, moder-
ages. The view of the same landscape in various viewing ate, and cold. The whole range of colour temperature val-
conditions such as a sunny day at noon, cloudy sky or at ues should be divided into 4 sub-ranges. This task was ap-
twilight gives varied feelings of colour temperature. In the proached by conducting subjective experiments on a group
same way works artificial light – different light sources can of people who visually assessed test images with respect to
give different colour temperature feelings for the illumi- colour temperature feeling. The result of the assessment
nated scene. was used for partition objectively computed colour temper-
The concept of colour temperature is not explicitly re- ature values into the subjective categories [2].
lated to thermal temperature of the viewed objects. It is de- The estimated colour temperature could be applied for
rived from a relationship between the temperature of a hy- image indexing and searching engines and is proposed as a
pothetical object called black body and its appeared colour. basis for a new visual descriptor in MPEG-7 standard [3,4].
The colour chromaticity of black body just depends on
temperature of this body. Being based on this assumption 2. Procedure for estimation of temperature of
one can classify colours in the range from hot to cold ac- image
cording to its similarity to of colour black body in appro-
priate temperature. A basic definition of colour temperature can be stated as an
absolute temperature of the black body whose spectral dis-
tribution of radiance power is proportional to the given
*e-mail: stimulus. It means that the both radiations have the same
K.Wnukowicz@elka.pw.edu.pl
Opto-Electron. Rev., 11, no. 3, 2003 K. Wnukowicz 193
3. Contributed paper
The obtained sRGB colour components are in the range pixels not indicated for discarding”. The averaging proce-
[0,1], what simplifies further computation. Next, pixel val- dure is carried out for all of the three colour components X,
ues are converted into XYZ colour space by multiplying the Y and Z. The f coefficient is a multiplier for the colour
conversion matrix M and the sRGB colour vectors component average value to obtain threshold above which
pixels are discarded. Its typical value is 3, what was ob-
é X (i, j ) ù é R(i, j ) ù tained in the subjective experiments [6].
ê Y (i, j ) ú = M ´ ê G(i, j ) ú , (2) The procedure for averaging image pixels was verified
ê ú ê ú on a test set of images. Typical number of iterations for the
ë Z (i, j ) û
ê ú êë B(i, j ) û
ú test images was in the range from 4 to 8 depending on the
where pixel value distributions in images. Maximum number of
é0.4124 0.3576 01805 ù
. iterations was above 20. The convergence of the averaging
M= ê 0.2126 07152 0.0722 ú
. procedure can be described as in Eq. (5).
ê ú
ë 0.0193 01192 0.9505û
ê . ú
Let A n = X n , K n = X n , and Sn is a sum of pixel val-
Black and near black colours do not impact signifi- ues in the set Xn, and n is the loop number
cantly colour temperature perception, so the dark pixels are
omitted from calculation. The auxiliary table p is a mask æ S ö
Sn = K n An ç An = n ÷
for marking discarded pixels. This is a matrix which has è Kn ø
the same dimensions as the image. If the mask value at the
specific position p(i,j) is 0 then the corresponding pixel in and
the image is omitted from further calculations. Tll is a
threshold for pixel discarding having its typical value 5%
S n = S n +1 + å x,
x Î Xn
of maximal component range. Only the luminance compo- x > fAn
nent Y is used for discarding dark pixels where
ì if Y (i, j ) < Tll then p(i, j ) = 0 K n A n = K n +1 A n +1 + åx ³
í . (3) x Î Xn
îelse p(i, j ) = 1 x > fAn
³ K n +1 A n +1 + fA n (K n - K n +1 ),
In the next step, the remaining pixels are iteratively av- A n (K n - fK n + fK n +1 ) ³ K n +1 A n +1, (5)
eraged. In this process, a threshold for indicating colours
standing out is assessed in each iteration and pixels exceed- é (1 - f )K n + fK n +1 ù
A n +1 £ A n ê ú =
ing the threshold are marked for omitting. The pixels dis- ë K n +1 û
carded here are too much different from the averaged mean
é K ù
value and represent self-luminous regions or objects [6] = A n ê f - ( f - 1) n ú .
ë K n +1 û
X Ts (0) = 0
An is the decreasing sequence if
loop
row - 1 col - 1 é Kn ù
1 ê f - ( f - 1) K ú £ 1,
Xa = å
row ´ col i = 0
å X (i, j), ë n +1 û
j =0
X Ts = f ´ X a (4) thus
if ( X Ts (t ) = X Ts (t - 1)) return X a é æ K n öù
ê ( f - 1)ç 1 - ÷ ú £ 0.
ì if X (i, j ) > X Ts then p(i, j ) = 0 ë è K n +1 ø û
í
îelse p(i, j ) = 1
end loop It is true because f >1 and Kn > = Kn+1, therefore 0 £ An+1 £
An. The sequence is convergent because it is not increasing
and is lower bounded.
In averaging procedure, Eq. (4), XTs(t) indicates the
The (xs,ys) chromaticity values are obtained from com-
threshold in the current loop t above which the pixels are
puted average colour as follows.
discarded. If the threshold value is the same as in the previ-
ous loop [XTs(t – 1)], it means that no pixels were discarded Xa
xs = ,
in that loop and the mean value Xa is returned. The compu- X a + Ya + Z a
tation of mean value Xa is done only for pixels which have (6)
Ya
corresponding mask value p(i, j) above 0. The same is for ys = .
expression row´cols. It intuitively means: “the number of X a + Ya + Z a
Opto-Electron. Rev., 11, no. 3, 2003 K. Wnukowicz 195