Contributed paperOPTO-ELECTRONICS REVIEW 11(3), 193–196 (2003)              Colour temperature estimation algorithm for di...
Colour temperature estimation algorithm for digital images – properties and convergence                                   ...
Contributed paper    The obtained sRGB colour components are in the range          pixels not indicated for discarding”. T...
Colour temperature estimation algorithm for digital images – properties and convergence4. Estimation of colour temperature...
Upcoming SlideShare
Loading in …5



Published on

Published in: Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Contributed paperOPTO-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, PolandThe paper presents an algorithm for estimation of temperature of image. Colour temperature is important, perceptual featuredescribing colour and content of images. The main idea of the algorithm is to average pixel values of image, omitting thevalues 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 theMPEG-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 ofColour 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 someused for describing the felt temperature of the touched ob- extent on observation conditions. The procedure consists ofjects. The same categories can be considered in the case of two main steps. In the first step, the image average colourcolour temperature feeling by observer who is viewing col- value is computed by omitting pixels having poor influenceour scene or image. This feeling depends mostly on proper- on colour temperature impression. In the second step, theties 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. Itperature feelings, adequately to the illumination. For exam- is done by Robertson’s algorithm [1] which approximatesple, 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 groupsame way works artificial light – different light sources can of people who visually assessed test images with respect togive different colour temperature feelings for the illumi- colour temperature feeling. The result of the assessmentnated 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 forrived from a relationship between the temperature of a hy- image indexing and searching engines and is proposed as apothetical 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 ontemperature of this body. Being based on this assumption 2. Procedure for estimation of temperature ofone can classify colours in the range from hot to cold ac- imagecording 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 Rev., 11, no. 3, 2003 K. Wnukowicz 193
  2. 2. Colour temperature estimation algorithm for digital images – properties and convergence Fig. 2. Isotemperature lines on the uv chromaticity diagram. The estimation of colour temperature for the given col-Fig. 1. Planck’s locus of black body on xy chromaticity diagram. our has the steps as follows: • convert chromaticity coordinates from (xs,ys) to (us,vs) (according to CIE 1960 UCS),chromaticity values. The chromaticity of black body radia- • find two adjecent isotemperature lines, from collectiontion depends only on its temperature and is defined by of 31 isotemperature lines, which are neighbours to thePlanck’s formula [1]. It is convenient to depict this depend- point (us,vs) on the chromaticity diagram,ency on a chromaticity diagram. Figure 1 shows the curved • compute value of colour temperature from the distanceline named Planck’s locus, corresponding to the chromatic- ratio between the point and both of the two adjacentity of a black body at the temperature changing from isotemperature lines.2000 K (red colour) to 25000 K (blue colour). Because of the fact that having the basic definition of 3. Calculation of the perceptional averagecolour temperature it can be determined only for a small set chromaticity coordinates of imageof colours, a correlated colour temperature concept is intro-duced. A correlated colour temperature is the temperature In the first stage of colour temperature estimation there areof Planck’s black body whose perceived colour most computed the chromaticity coordinates of average colourclosely resembles that of the given stimulus. So, it is de- of image pixels related to human perception of colour tem-fined rather in perceptual aspect. In practice, the term of perature. Pixels which have poor or meaningless influencecolour temperature is used also for correlated colour tem- on this perception are discarded during calculation. Firstly,perature for shortness. The calculation of colour tempera- image pixels are converted into standard linear colourture is performed by use of the perceptually homogeneous space sRGB [5]. EquationUV chromaticity diagram (CIE 1960). It is assumed that if R(i, j ) £ 0.03928 ´ 2550 .the colour temperature is constant along the lines which areperpendicular to the Planck’s locus on this diagram æ R(i, j ) ö(Fig. 2). These short straight lines are called isotemperature RsRGB (i, j ) = ç ÷lines. è 255 ´ 12.92 ø The algorithm for calculation of the chromaticity coor- else (1)dinates of image has its main steps as follows: 2 .4• linearize image pixels: RGB –> sRGB, é R(i, j ) ù ê 255 + 0.055 ú• convert colour space sRGB –> XYZ, RsRGB (i, j ) = ê ú• discard pixels with Y luminance value below threshold ê . 1055 ú Tl, ë û• iteratively average remaining pixels discarding the ones presents calculation of R colour component for most com- with values above a threshold adapted after each itera- monly available images represented in the form suited to tion, PC computer monitors. The G and B components are con-• take chromaticity coordinates (xs,ys) of average colour verted in the same way. Parameters i and j indicate the given in XYZ. pixel position in rows and columns respectively.194 Opto-Electron. Rev., 11, no. 3, 2003 © 2003 COSiW SEP, Warsaw
  3. 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 colourconversion 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 thewhere 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 numbercantly colour temperature perception, so the dark pixels areomitted 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 thespecific position p(i,j) is 0 then the corresponding pixel in andthe image is omitted from further calculations. Tll is athreshold for pixel discarding having its typical value 5% S n = S n +1 + å x, x Î Xnof maximal component range. Only the luminance compo- x > fAnnent 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 coloursstanding 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 atation of mean value Xa is done only for pixels which have (6) Yacorresponding 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 aOpto-Electron. Rev., 11, no. 3, 2003 K. Wnukowicz 195
  4. 4. Colour temperature estimation algorithm for digital images – properties and convergence4. Estimation of colour temperature of given proximated by a ratio of distances from the point to the colour two adjacent isotemperature lines. The formula for resulting colour temperature is given asAfter computing the chromaticity coordinates of the aver-age colour of image, its colour temperature can be esti- di TRc = TRi + (TRi +1 - TRi ). (9)mated. Firstly, the chromaticity coordinates need to be con- d i - d i +1verted to (us,vs) coordinates according to the CIE 5. Conclusions 4x s us = -2x s + 12 y s + 3 In the article, the algorithm for estimation of colour tem- (7) 6y s perature of image is presented. The purpose of the estima- vs = tion is to render human visual perception of this colour fea- -2x s + 12 y s + 3 ture in static images as well as in moving ones (video se- quences). Thereby, it is a considerable feature of image for Secondly, the line perpendicular to the Planck’s locus, application in image search and retrieval tasks. That is justthe crossing point (us,vs), must be determined on the dia- what was a need, and a motivation for its designing origin.gram. The line in question is an isotemperature line for the MPEG-7, a standard for describing an image content, haveobtained averaged image colour. For this purpose, Robert- got a contribution, proposing a descriptor for visual contentson’s algorithm can be used [1], which utilizes 31 fixed browsing based on colour temperature. Other possible ap-isotemperature lines given in the form of parameters gath- plication of the colour temperature feature may be conver-ered in a table. The given isotemperature lines are within a sion of colour temperature of image. Users of multimediarange from 1667 K to 100000 K, and they are specified by systems often have their personal preferences on colour4 parameters: their colour temperatures Ti and geometrical temperature of viewed images. If the colour temperature oflocations on a diagram, which are tangents of an angle be- image is known as well as the user preference on it, conver-tween the line and the horizontal direction ti and the point sion of image appearance can be easy done to conform toof crossing the Planck’s locus given by (ui,vi) coordinates. user needs. Further, potentially beneficial domain is pho-To find out an isotemperature line for the point (us,vs), the tography. Knowledge of the colour temperature of phototwo neighbouring adjacent fixed isotemperature lines image makes it possible to do an automatic conversion ofshould be determined at first. It is done by calculating the it, just to meet user needs.distances to all of the 31 given lines and picking two adja-cent ones of which the ratio between the distances from the Referencespoint to them is negative (di/di+1 <0 as one of the distancesis negative and the second is positive). The formula for cal- 1. G. Wyszecki and W.S. Stiles, Colour Science Concepts andculation of the distance between a point and a line is given Methods, Quantitative Data and Formulae, (2nd Edition), Aby Wiley-Interscience Publication, 1982. 2. W. Skarbek, “Optimal intervals for fuzzy categories of col- (v s - v i ) - t i (u s - u i ) our temperature”, ISO/IEC JTC1/SC29/ WG11 M7625, di = . (8) (2001). (1 + t i2 )1 2 3. S.K. Kim and D.S. Park, “Proposal for colour temperature de s c riptor for ima ge de s c ription” , ISO/ I EC In the next step, the colour temperature of the point JTC1/SC29/WG11 M6966, (2001).(us,vs) is approximated from the ratio between the distances 4. S.K. Kim and D.S. Park, “Report of VCE-6 on MPEG-7from the point to each of the neighbouring isotemperature colour temperature browsing descriptors”, ISO/IEClines. The approximation is done on the assumption that JTC1/SC29/WG11 M7265, (2001). 5. M. Stokes, M. Anderson, S. Chandrasekar, and R. Motta,• the Planck’s locus of a black body between the adjacent “A standard default colour space for the internet – sRGB”, isotemperature lines (Ti and Ti+1) is approximated by a Version 1.10, (1996). circular arc. 6. A.P. Petrow, C.Y. Kim, I.S. Kweon, and Y.S. Seo, “Per-• colour temperature presented in reciprocal scale TR = ceived illumination measured”, Colour Res. Appl. 23, No 3 106/T is a linear function of its position on this arc. (1998).• the angle between adjacent isotemperature lines is 7. A. Borbely, A. Samson, and J. Schanda, “The concept of small, so a ratio of the arc lengths between the two correlated temperature revised”, Colour Res. Appl. 26, No 6 fixed and the point’s isotemperature lines can be ap- (2001).196 Opto-Electron. Rev., 11, no. 3, 2003 © 2003 COSiW SEP, Warsaw