Thursday 13 March 2014

Choosing the appropriate colour palette for thermal imaging in animals

This might sound like a strange thing to write about, the choosing of a colour palette for a thermal image. Why be concerned about which colour to use? Isn't it just for presentation? It happens to be one of my pet peeves with thermal imaging and how people new to the field do not appreciate how a colour choice might enhance small differences in temperature and overemphasize something rather minor.

My reasons will be illuminated below, but suffice it to say it relates ultimately to contrast and detectability of different temperatures through the use of colour itself.

From a computational perspective these concerns are not important. Almost all thermal imaging devices actually provide a proper temperature estimate for each pixel on the screen and as the images are typically stored in proprietary format in 12 or 14 bit files, this is not a concern from a quantitative perspective.

However, images captured are eventually converted into a digital format that is easily visualized by others, typically a jpg, png, tiff or bmp file. When presented online, then, you have a colourised rendition of temperature that is essence a filter of the real data mapped onto a pre-existing spectrum. This spectrum of colours is referred to as a palette in most graphical software.

There are a number of palettes that you might find available on your thermal imaging camera:

Grey Gradient Iron Gradient Rain gradient Glowbow gradient Yellow gradient

From left to right, these palettes are described as: Greyscale, Iron, Rain, Glowbow and Yellow (terminology comes from FLIR™). Each palette 'translates' temperature into a specific colour, with cold colours at the bottom (typically darker colours) and warm colours at the top (typically lighter colours).

At first glance it might be tempting to choose the funkiest colours, since it looks 'pretty' (this is a common reaction I get from people when I show them thermal images). Indeed, for some purposes this is entirely appropriate. Some palettes were designed specifically to create a large contrast in colour intensity across a narrow range of temperatures.

People generally do not believe me until i demonstrate it, but I often prefer to use the greyscale palette when imaging animals in the field for the simple reason that it is easier to focus on edges. Although greyscale might not offer a large degree of contrast between similar temperatures, it is a simple, natural scale of intensity where black is the lowest intensity, white is the highest intensity and greys provide a gradient of intensities in between.

For presentation purposes and for publication purposes, however, a visually appealing colour might be appropriate (instead of greyscale). My own favourite palette is the Iron palette, as demonstrated in the following image of Yellow Crowned Night Heron from Galapagos:

Yellow Crowned Night Heron 22 to 32 Iron

Note how I have set the temperature range to go from 22 to 32C, where 22 is the lowest colour on the gradient and 32 is the highest. This maximizes the potential contrast of temperatures within the visible colour palette without saturating or eliminating any potential temperature.
So, why all the fuss about palette choice? Let's consider the same image as I've shown you above, but this time using 5 different palettes. I have purposely rescaled the image to range from 5 to 32C, which actually masks some of the potential colour differences but it also shows how the different palettes may obscure potential temperature differences.


Thermal Image Comparison

The picture above shows the yellow crowned night heron depicted using 5 different palettes. Inset line graphs depict the "intensity" of the gradient scale used in common units. All I did was import the images into ImageJ and drew a line down the gradient to obtain the "grey intensity" as a function of the colour palette. All palettes are compared in the lower right-hand graph to show how these different palettes translate "intensity" differently.

Although the human eye can certainly detect chromatic signals (i.e. different colours), the achromatic signals are what I am trying to highlight above. See how the different palettes show varying degrees of linearity and non-linearity. Clearly the greyscale gradient shows a monotonic decline in intensity, as you would expect for an achromatic response.

The other palettes however are not all the same as the greyscale. Sadly, my own favourite palette is shows a slightly curvilinear function with some intensities rising before falling again. The palette that comes closest to a greyscale, slightly monotonic decreasing palette is FLIR's Yellow palette.

Note how weird the Rain palette looks. The intensity rises and falls along the gradient itself. What this means is that your eye may be drawn to changes in achromatic signals in the colour palette and mistakenly consider them to be an incorrect temperature change. The Rain palette is an example of one of those favoured by people who initially play with thermal cameras. The images look striking, but my pet peeve about it is that it creates unnatural contrasts in colours that do not correspond to the actual temperature gradient. It also does not help that the beak and the back feathers look 'warm' because I am accustomed to yellow colours being warmer than red colours.

To drive home this point more clearly, I have converted every single image above to a greyscale image in Photoshop using the default greyscale convert tool:

Thermal Image Comparison Greyscale

For most of the palettes chosen (the first 4), the conversion to greyscale does not really obscure the image too much, but it still transforms the images. In other orders, darker greys clearly correspond to cooler colours, lighter greys to warmer colours. The exception is the Rain palette. When converted to greyscale it appears saturated in some places, the bird's image is nicely delineated (due to the steep contrast in intensity in places), but certain greys are repeatedly used that correspond to different temperatures. In other words, it is difficult to tell for certain what colour corresponds to what temperature.

So, the morale of the story? This may not be a problem if you have a colour printer or access to a computer screen to view your colour images, but not all journals will publish in colour, and not all people will view the work in colour (e.g. referees of your papers like myself who are given black and white versions of your manuscript and are left scratching their heads wondering what the images mean!), so I think it pays to consider the effect of palette choice on how others may interpret (or get confused by) your thermal images.

Personally, I usually use the Iron palette and it turns out to have a non-monotonic change in intensity along the gradient of temperatures, which means that there may be some error in a greyscale conversion from this particular choice. I guess I could choose a more forgiving palette, but I still like the colour option for presentations myself.

You could always opt for greyscale straight from the thermal imaging device itself, and then generate boring looking images! To each their own.

3 comments:

  1. Hey! very nice post. I was read your post and I found it interesting. I was in a search for more information for
    thermal imaging, and I realize your blog actually hepful. Thank you for your Efforts. keep going.

    ReplyDelete
  2. Thanks Shawn. Just submitted a review paper that I hope will be published this year (2016). I'll post links in the comment section.

    ReplyDelete

  3. Wow.. Its really very good information. I hope you will update more soon. Thanks a lot..

    HP Thermal Camera

    ReplyDelete