Search code examples
opencvcolor-mappingcolor-codescolor-coding

false-/pseudo color coding for temperature


I have some temperature values in a given range, lets say between 0-100 Celsius. Now I want to map these values to colors, so blue=RGB(0,0,255) means 0°C, red=RGB(255,0,0) means 100°C and the colors in between mean some temperatures in between.

Matlab actually has a function called colormap. My stuff is implemented in OpenCV & C++. Is there anyone, who already has some experience in color coding or knows any good mathematical way to do that?


Solution

  • The HSV colourspace might be helpful here.

    Hue is periodic, however,, which is to say if you go from red all the way to the other end of the spectrum, you'll be back at red, which isn't that useful in your case. What you'll probably want to do is choose a subset of the hue spectrum that goes from red, through yellow and green, to blue (omitting pink/purple). There's an image in the RGB-HSV section that should show you what I mean.


    Update: In fact, this previous answer tells you how to implement exactly the MATLAB Jet palette that you describe.

    It seems that Jet is actually a variation on the HSV colourspace anyway!