How do I convert image colour temperature in a calibrated way?

106 views Asked by At

How do you adjust an image in a calibrated RGB colour space to have a specific colour temperature, using the colour Python library or similar?

I have an image that has been captured in uncalibrated 16-bit linear RGB space and then calibrated in the ProPhoto RGB colour space using a colour checker included in the image. This is done by mapping the manufacturer-supplied colour target values from L*a*b* to ProPhoto RGB, detecting the corresponding source colours in the input image calibration card, and then applying the colour.colour_correction function.

The answer here describes how to calculate the colour temperature of a "white" RGB value, and I can do the following to find that the colour temperature of the white reference in the image is currently 6250 k:

import colour

ref_gray = [0.85007768, 0.89948808, 1.11035624]

XYZ = colour.RGB_to_XYZ(ref_gray, "ProPhoto RGB")
xy = colour.XYZ_to_xy(XYZ)
CCT = colour.xy_to_CCT(xy, method="hernandez1999")

# CCT is 6250.9622746435989

There is also a colour.CCT_to_xy function that will go the other direction, but I don't know how you would use the resulting xy chromaticity coordinates to adjust the image or whether it even makes sense to talk about doing so.

How can the image be adjusted so that the white tile has a colour temperature of 5500 k instead?

0

There are 0 answers