csp Posted June 29, 2017 Share Posted June 29, 2017 Hi, I would like to convert an rgb color value of an attribute at points to temperature (kelvin). I am wondering if anyone is aware of any algorithm related to that. cheers, C Quote Link to comment Share on other sites More sharing options...
michael Posted June 29, 2017 Share Posted June 29, 2017 this looks pretty good: http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/ Quote Link to comment Share on other sites More sharing options...
Juraj Posted June 29, 2017 Share Posted June 29, 2017 Just thinking out loud - color of blackbody radiation can be represented by temperature in Kelvins, or RGB color it emits. So Kelvins to RGB mapping should be straight forward, but backwards it might be tricky, as a RGB value may not be present in blackbody radiation spectrum. If I understand it right, then this plot is showing Kelvin temperatures mapped to RGB colors. So solution that comes to my mind is to find a Kelvin value, which is closest to the given RGB value. One way would be to take an array of Kelvin values converted to RGB values and to find the closest match (based on euclidean distance). Or if array of Kelvin values is not dense enough, you can linearly interpolate between two closest points found. It is not very precise, but should be good enough for some cases. Also, one more fancy thing would be to compute the distance of given RGB value and Kelvin sample in Lab color space, because if I remember correctly, then distances in Lab color space match the best to the perceived difference in colors (Maybe it is some other space, you can look it up) 1 Quote Link to comment Share on other sites More sharing options...
Martin47 Posted June 30, 2017 Share Posted June 30, 2017 On 6/29/2017 at 3:51 PM, michael said: this looks pretty good: http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/ here is a test with the equivalent code in VEX, this not answer the question, but maybe help to "reverse engineering" something . anyway as @Juraj said, build an array with kelvin-to-rgb values and match to the closest may do the trick, at least in a plausible approach. maybe this chart is useful? http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html Kelvin-to-rgb-00.hipnc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.