Calculate colour temperature in K

前端 未结 6 1019
忘掉有多难
忘掉有多难 2021-01-07 19:55

I have written a lib for working with colours and stuck trying to calculate Tc(k). From what I have read working in the CIE 1931 XYZ colour space i

6条回答
  •  不思量自难忘°
    2021-01-07 20:23

    If I understand you correctly please see this pdf where a number of methods (briefly :( ) described. From this PDF:

    [CCT1] Calculations are performed using CIE 1960 uniform color space coordinates u and v. Coordinates u and v are derived from x and y using the formulae: u = 4x/(12y-2x+3) and v = 6y/(12y-2x+3) The correlated color temperature is defined as the temperature of a blackbody that lies closest to the u,v coordinates of the test source. Two separate methods provide results: one is an iterative method based on the definition, and the other is the commonly used Robertson’s method involving interpolation based on a table of 30 pre-calculated u, v and inverse-slope parameters. Iteration If uS and vS are the values for a test source, and uT and vT are the blackbody values at temperature T, the correlated color temperature is the value of T where:

    sqrt( (uS - uT)^2 + (vS - vT)^2 )
    

    is minimized. Adjusting the temperature T to obtain the minimum of this function was done using spreadsheets (Quattro Pro 8 and Excel 97). Both spreadsheets gave identical values.

    Don't know if it actually helps you.

提交回复
热议问题