Question

I have raw pixel data (640x480 pixels) from an infrared camera which stand for a specific measured temperature. These pixel values have a 16 bit range from 0 to 65535.

I can display the pixel values as 8 bit greyscale, which works very well.

But now I want to display those pixels by using a false color palette.

I noticed 2 challenges here:
1.) Creating a false color palette. This means not just a simple RGB or HSV palette...I am thinking of a transition from black to yellow, to orange, to red and finally to purple
2.) Associating the pixel values to a color on my palette (e.g. 0 = black, 65535 = purple, but 31521 = ???)

Do you have an idea how I should approach this problem? I use Qt4 and Python (PyQt) but also I would be very happy if you just share the way for a solution.

Was it helpful?

Solution

One simple way would be to define colors at certain points in your range - as in your example, 0 is black, 65535 is purple, maybe 10000 is red, whatever you want to do. Set up a table with those key rgb values, and then simply interpolate between the rgb values of the key values above and below your input value to find the rgb color for any given value.

eg. if you're looking up the color for the value 1000, and your table has

value=0, color=(0,0,0)
value=5000, color=(255, 0, 255)

Then you would interpolate between these values to get the color (51, 0, 51)

OTHER TIPS

The easiest method is as follows: Cast your unsigned short to a QRgb type, and use that in the QColor constructor.

unsigned short my_temp=...;
QColor my_clr((QRgb)my_temp);

This will make your values the colors between black and cyan.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top