Clear Filters
Clear Filters

Conversion of a greyscale thermal image to pseudo colour thermal image

8 views (last 30 days)
How can a grayscale thermal image be converted to a pseudo colour thermal image as per standard colour coding conventions that are used for representing thermal images? Matlab code for achieving this task would be highly appreciated.

Accepted Answer

Image Analyst
Image Analyst on 5 Nov 2016
There is no standard coloring convention. Thermal camera software will give you the ability to choose from several colormaps. You can turn your grayscale thermal image into an RGB pseudocolored image with the function ind2rgb(). For example
myColorMap = summer(256); % Whatever you want.
rgbImage = ind2rgb(thermalImage, myColorMap);
  2 Comments
shazia sk
shazia sk on 5 Nov 2016
Thank you for the answer. I would like to more specifically question again that if we need to create a pseudo colour thermal image from obtained temperature values, how to calculate the rgb value for a particular temperature point or how to calculate rgb value for every temperature value obtained. Is there any algorithm or formula? I am particularly interested in using the rainbow palette which is one of the palettes used by most commercial thermal cameras like FLIR.
Image Analyst
Image Analyst on 5 Nov 2016
If you have their colormap, which assigns an RGB color to a thermal temperature value, then you can just do
theRGBColor = theirColorMap(yourTemperatureValue, :);
If all you have is an RGB image then you need to get that colormap that they used or else you're out of luck. I can get a rainbowy image from looking at a frosty arctic scene, or down the caldera of a volcano with boiling lava, which of course have very different temperatures. So there is no going backwards - RGB-to-Temperature - unless you have the colormap.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 5 Nov 2016
Edited: Walter Roberson on 5 Nov 2016
The mapping of intensity reading to temperature may depend upon how the camera was calibrated when the thermal photo was taken.
Intensity does not necessarily correspond to increased temperature: it can correspond to increased reflectance in the measuring band. See http://www.mathworks.com/matlabcentral/answers/86854-how-to-convert-a-gray-scale-image-to-color-image-using-matlab#comment_396218
The coloring to use for any particular temperature profile may depend upon the aspects of interest. Sometimes one is looking for the hot spots, and sometimes one is looking for more subtle information. For example if you were trying to follow the path of wires in a wall, then the heat difference might be only a degree (for example), which might be small compared to the temperature difference between the wall and the doorway.
For any one particular use with one particular calibration with one particular measurement band, it is possible that a convention has grown up about how to convert intensity information to color, but there might or might not be a "formula" for it, and if there is a formula then it might be based upon some choices that were relatively arbitrary "because they worked".
Your camera vendor might have provided you with some sample colormaps, or might have provided you with calibration curve information.
The calibration curve is not necessarily going to be the same between different models of the same manufacturer, let alone the same manufacturer. Different technologies might have been used, or slightly different materials might have been used, leading to different attenuation curves.
For comparison, think how much controversy audiophiles engage in with regards to speaker characteristics and amplifier characteristics: the same inputs can give notably different results with different equipment.
  1 Comment
mike brandt
mike brandt on 24 Jun 2020
Edited: Image Analyst on 24 Jun 2020
Temperature scales in thermal imaging take a range defined by the user and uses a standard color spread that is then stretched to that range.
The rainbow color needs to be defined over an arbitrary range. I am using a range of 0 to 1, which is then stretched to fit a temperature range, say from 18.2 to 25.6 deg Celsius.
A scale is generated that shows the correlation of color to temperature value.
The color scheme that is used is up to the operator.
In the flire program that I use there are at least 10 preset color schemes that can be used at the operator's discretion.
Color scales take large amounts of data and turn it into an object that can be interpreted by an operator based on previous experience.
For true thermal analysis you have to look at the raw data with a program that can reinterpret the information in to relevant results (e.g. in MATLAB).

Sign in to comment.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!