Thermal camera image processing

I'm working on thermal camera image processing and I would like to create an equation to show what every pixel means in temperature. How can I create such equation and how can I put it in the code so it can give me temperatures for certain colors?

5 Comments

where u able to find a code for this or some linear equation for calculating the temperature of each pixel
if anybody else also has a suggestion please notify
You need to scroll down. If you do, you'll find this answer.
tanq i found what i want but if i want to use it in fpga i need to use hdl coder for that i have to create two file one in which i have to make a function call and the other one in which i have to use test cases.
in this code where can i make a function call
can u pls help me
Please see mlhdlc_heq.m and mlhdlc_heq_tb.m demo files on how to do this. Thanks.
thanks i will try and tell u if i have any problem

Sign in to comment.

 Accepted Answer

Image Analyst
Image Analyst on 24 Feb 2018
Edited: Image Analyst on 4 Aug 2022
OK, try this demo I made up specially for your attached image.
[EDIT 8-4-2022, see improved, updated demos attached where you can drag boxes over the image and colorbar in your specific image]
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
%===============================================================================
% Get the name of the image the user wants to use.
baseFileName = '11.png'; % Assign the one on the button that they clicked on.
% Get the full filename, with path prepended.
folder = pwd
fullFileName = fullfile(folder, baseFileName);
%===============================================================================
% Read in a demo image.
originalRGBImage = imread(fullFileName);
% Display the image.
subplot(2, 3, 1);
imshow(originalRGBImage, []);
axis on;
caption = sprintf('Original Pseudocolor Image, %s', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
grayImage = min(originalRGBImage, [], 3); % Useful for finding image and color map regions of image.
% Get the dimensions of the image. numberOfColorChannels should be = 3.
[rows, columns, numberOfColorChannels] = size(originalRGBImage);
% Crop off the surrounding clutter to get the colorbar.
colorBarImage = imcrop(originalRGBImage, [1, 20, 17, rows]);
b = colorBarImage(:,:,3);
% Crop off the surrounding clutter to get the RGB image.
rgbImage = imcrop(originalRGBImage, [81, 1, columns-20, rows]);
% Get the dimensions of the image.
% numberOfColorBands should be = 3.
[rows, columns, numberOfColorChannels] = size(rgbImage);
% Display the image.
subplot(2, 3, 2);
imshow(rgbImage, []);
axis on;
caption = sprintf('Cropped Pseudocolor Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
hp = impixelinfo();
% Display the colorbar image.
subplot(2, 3, 3);
imshow(colorBarImage, []);
axis on;
caption = sprintf('Cropped Colorbar Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0.05 1 0.95]);
% Get rid of tool bar and pulldown menus that are along top of figure.
% set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
% Get the color map.
storedColorMap = colorBarImage(:,1,:);
% Need to call squeeze to get it from a 3D matrix to a 2-D matrix.
% Also need to divide by 255 since colormap values must be between 0 and 1.
storedColorMap = double(squeeze(storedColorMap)) / 255
% Need to flip up/down because the low rows are the high temperatures, not the low temperatures.
storedColorMap = flipud(storedColorMap);
% Convert from an RGB image to a grayscale, indexed, thermal image.
indexedImage = rgb2ind(rgbImage, storedColorMap);
% Display the thermal image.
subplot(2, 3, 4);
imshow(indexedImage, []);
axis on;
caption = sprintf('Indexed Image (Gray Scale Image)');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% Define the temperature at the top end of the scale
% This will probably be the high temperature.
highTemp = 28.9;
% Define the temperature at the dark end of the scale
% This will probably be the low temperature.
lowTemp = 0.9;
% Scale the image so that it's actual temperatures
thermalImage = lowTemp + (highTemp - lowTemp) * mat2gray(indexedImage);
subplot(2, 3, 5);
imshow(thermalImage, []);
axis on;
colorbar;
title('Floating Point Thermal (Temperature) Image', 'FontSize', fontSize, 'Interpreter', 'None');
hp = impixelinfo(); % Let user mouse around and see temperatures.
hp.Units = 'normalized';
hp.Position = [0.45, 0.03, 0.25, 0.05];
% Get the histogram of the indexed image
subplot(2, 3, 6);
histogram(thermalImage, 'Normalization', 'probability');
axis on;
grid on;
caption = sprintf('Histogram of Thermal Temperature Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Temperature', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Frequency', 'FontSize', fontSize, 'Interpreter', 'None');

42 Comments

I really don't get what you've done. Can I create an array where I see a temperature value for each pixel and when the user clicks on a certain pixel it will output temperature based on the RGB values of the pixel?
To make things more clear. I don't need the values to be true. I can assume them. for example between (10-100)C I need a way to assign this to RGB values like BLue(0-255)=(10-20)C Green(0-255)=(20-40)C Red(0-255)=(40-100)C
I want to base it on an equation
And what do you think that gray scale image is I created? It's an image of the temperature. At every location in the image is the temperature. I created it by using the colorbar to convert RGB colors into temperatures.
Ciao Having some issues reproducing it with my image. The indexed image is all black (see Results.gif). I believe the issue is with "storedColorMap = colorBarImage(:,1,:)": not sure to understand the purpose... Would you please suggest me how to modify your code to get Image.png correctly translated in a colorcode proportional to temperature? Does not really matter which scale, I just need to have red as high (or low) number, and blue vice-versa
Thanks in advance Alex
Try the jet colormap. It won't be accurate, but only non-linearly relative. The image won't have units of temperature - they're just arbitrary but that's about all you can do if you don't have a known scale.
Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
%===============================================================================
% Get the name of the image the user wants to use.
baseFileName = 'image.png'; % Base file name with no folder prepended (yet).
% Get the full filename, with path prepended.
folder = pwd; % Change to whatever folder the image lives in.
fullFileName = fullfile(folder, baseFileName); % Append base filename to folder to get the full file name.
fprintf('Transforming image "%s" to a thermal image.\n', fullFileName);
%===============================================================================
% Read in a demo image.
rgbImage = imread(fullFileName);
% Display the pseudocolored RGB image.
subplot(2, 2, 1);
imshow(rgbImage, []);
axis on;
caption = sprintf('Original Pseudocolor Image, %s', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
hp = impixelinfo();
drawnow;
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0.04, 1, 0.96]);
% Get rid of tool bar and pulldown menus that are along top of figure.
% set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
%=========================================================================================================
% Get the color map
storedColorMap = jet(256);
% Convert the subject/sample from a pseudocolored RGB image to a grayscale, indexed image.
indexedImage = rgb2ind(rgbImage, storedColorMap);
% Display the indexed image.
subplot(2, 2, 2);
imshow(indexedImage, []);
axis on;
caption = sprintf('Indexed Image (Gray Scale Thermal Image)');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
%=========================================================================================================
% Now we need to define the temperatures at the end of the colored temperature scale.
% You can read these off of the image, since we can't figure them out without doing OCR on the image.
% Define the temperature at the top end of the scale.
% This will probably be the high temperature.
highTemp = 31.6;
% Define the temperature at the dark end of the scale
% This will probably be the low temperature.
lowTemp = 20.6;
% Scale the indexed gray scale image so that it's actual temperatures in degrees C instead of in gray scale indexes.
thermalImage = lowTemp + (highTemp - lowTemp) * mat2gray(indexedImage);
% Display the thermal image.
subplot(2, 2, 3);
imshow(thermalImage, []);
axis on;
colorbar;
title('Floating Point Thermal (Temperature) Image', 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
% Let user mouse around and see temperatures on the GUI under the temperature image.
hp = impixelinfo();
hp.Units = 'normalized';
hp.Position = [0.45, 0.03, 0.25, 0.05];
%=========================================================================================================
% Get and display the histogram of the thermal image.
subplot(2, 2, 4);
histogram(thermalImage, 'Normalization', 'probability');
axis on;
grid on;
caption = sprintf('Histogram of Thermal Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Temperature', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Frequency', 'FontSize', fontSize, 'Interpreter', 'None');
fprintf('Done! Thanks Image Analyst!\n');
excuse me sir. can you help me ? I'm working on thermal image processing How can i find the highest temperature in infrared image?? please!!!
Yes. Just do maxTemp = max(temperatureImage(:)). If not, the create your own NEW question (not here).
@Image Analyst, how to do it without using Image Processing toolbox? I can't use imcrop and other commands. But I have to do the similar thing for stress based image.
Instead of mat2gray(), you can use rescale(grayImage, 0, 1). Instead of imcrop(), use rbbox(). Don't use impixelinfo at all. You'll have to write your own version of rgb2ind().
Thank you. I just checked in my Matlab version, I have mat2gray() and rgb2ind() functions available. I'll try to implement it.
Actually I have posted similar issue here:
If possible, can you please check it once and tell whether I can use the above code to solve my issue?
Thanks again.
@image Analyst, how can you use matlab to determine thermal conductivity from IR image?
Does the image represent thermal conductivity? As far as I know, thermal images just represent temperature at an assumed emissivity, not conductivity.
If you were somehow able to derive a conductivity image from the IR camera's image, then you could use MATLAB to report that images conductivity value at any pixel or region(s) of pixels.
Thanks for the clarification. I agree that thermal images represent temperature but I was wondering if that the temperature profile of a sample, once heated at a point can help determine the thermal conductivity may be via a data fit.
You can't get conductivity from a single image since two materials, say wood and copper, could both be at the same temperature yet have vastly different thermal conductivity. So temperature and conductivity are independent things. It's like hair color and eye color in people. Just because you know the eye color of a person does not mean you can determine the hair color. Perhaps if you had different time points to see how fast or slow they heated up you might be able to do it.
Hi sir, may I know what Algorithm is the coding based on?
Hello sir ,
plz how can i import the image in MAtlab ,
I copy the code but i must also copy the path of the thermal image ,because i work from MATLAB ONLINE .So i don't know how can i use your code .
Cordiley .
@Zawir Jasmin, not sure how to answer. The coding is based on my 40+ years of expertise in image processing.
@Israe Abdelbar, have you tried imread()? I don't use MATLAB online and don't know what format your thermal image is in, so I can't really answer. Start your own question and attach your image if you still have questions, or call tech support.
Thank you very much sir, no I wanted to work with your own code, but importing the image you worked with it does'nt t work on MATLAB Online. I must with MATLAB App.
@Israe Abdelbar, what image did I work with that you tried? '11.png'? 'Image.png'?
I tested with the 2 images, but my problem is that I was unable to copy the path of the images to import them, so I cannot view the results.
thank you very much sir !
@Israe Abdelbar, I'm not sure what to say. If you still need my help, start a new question (let's not continue to hijack @Nasser Jarrar's thread) and attach the image(s) and your code.
This is how I view it when I try your code. my color bar is showing as gray how can i make it colored?
Please look more carefully at your colorbar. You have bright green in the middle, which is your brightest color. The eye is most sensitive to green, so over 70% of brightness derives from bright green. The middle red is providing at most 20% of the brightness. So you have dark at the bottom edge, increasing to bright in the middle, and decreasing in brightness towards the red at the top.
Therefore if that colorbar is an accurate relationship to temperature, then you cannot determine temperature by converting the image to grayscale.
FLIR does not use linear-brightness colormaps on their low-end equipment. Some of the higher end equipment permits you to choose between a few colormaps, if I recall correctly.
I have been telling you want needs to be done: you need to get the FLIR research software, or you need to migrate to a development board the provides better software, or you need to calibrate the FLIR colormap and do color matching.
@Özgür Uzunkaya by looking at the upper 2 images on your screenshot it's obvious that you made no attempt to change the cropping indexes to get the proper location of the image and the colorbar from the original image. Why not? I do not find those automatically - you have to find the starting and ending rows and columns to crop the image and colorbar out of the original screenshot image.
I don't fully understand if the values ​​in this color bar are in degrees Celsius, is it 50 degrees Celsius red, 200 degrees Celsius dark blue?
You are cropping on the wrong side. The temperature is on the right side of the the color bar, 0.9C for blue up to 28.9C at the top.
The 50 and 200 are row numbers for the image, not temperature.
@Özgür Uzunkaya and @Israe Abdelbar rather than keep bugging @Nasser Jarrar with activity on his question (that is actually about your question, not his), why don't you start a new question and attach your image and your code?
In the meantime, @Özgür Uzunkaya it looks like you're still cropping out some white background. Get just the color bar alone, and read the temperatures off the right side of that colorbar, not the left side.
yes i trimmed the wrong place :( what do the numbers from 50 to 200 next to the degrees in the other color bar mean?
@Image Analyst What does the color bar that says clipped colorbar image mean? rows and columns?
Yes, it says Rows and Columns. Those refer to the image as a whole, not to the colorbar. Row 200 of the image for example.
I could just do it all for you in seconds if you'd do what I asked in my last comment:
"why don't you start a new question and attach your image and your code?"
rather than going back and forth here for hours and days, and sending @Nasser Jarrar emails for every time we comment on your issue.
@Image Analyst @Walter Roberson What does the 5 in the column mean?
According to this official, Celsius values ​​are given as ready, we do not find the temperature values ​​​​with the code. this is what i have to do.How can I do that?
Walter Roberson
Walter Roberson on 14 Jun 2022
Edited: Image Analyst on 14 Jun 2022
The 5 under your image of your cropped-out colorbar is marking column 5 of the image. It's an axis tick label, just like the ones vertically alongside your colorbar.
Özgür Uzunkaya, like I've said several times before start your own question. Post your image and I'll help you there. The code DOES give temperatures. Somehow you adapted my code incorrectly. I'll be able to fix in in your new question if you post your image there.
The only thing you should post here again is possibly a link to your own question.
I am getting messed up graphs like this. I have only changed the "11.png" with the name of "Phase1.png"
Please link to the place that has the code that you used, and please attach your Phase1.png file so we can test.
I have used the same code as above and here is the image
@Ali Raza I don't see any colorbar in that image, so what did you do about that? My program expects to extract the colorbar from the image.
I'm attaching the latest version and this one lets you draw a box over the thermal image and over the colorbar. Both are needed to convert a pseudocolored image into temperature. Otherwise how would I know that yellow in your image is 40 degrees or 300 degrees? There would be no way to tell.
Can I know how to draw a box over the thermal image to crop it ? I am not getting any option available to do that.

Sign in to comment.

More Answers (6)

Image Analyst
Image Analyst on 24 Feb 2018

10 Comments

Nasser Jarrar
Nasser Jarrar on 24 Feb 2018
Edited: Image Analyst on 25 Feb 2018
I need an equation to get the hot spot. To assign a temperature for each pixel. To calculate the temperature of the hot spot based on the RGB pixel values. How to connect it with this code?
You forgot to attach '11.png'. And it had better have a colorbar in there or there is no way to tell what color corresponds to what temperature, unless you have some kind of array from some other source that tells you that.
I have it with a colorbar. How can I use the bar to know every pixel corresponding temperature? And how can I create my own array based on a linear equation to represent pixel in temperature and connect it with the image so I can get temperature of each pixel based on RGB values. I need to be able to get temperature in number like in the image for each chosen location on the image.
You just simply need to modify the low and high temperature, and adjust the row and column where the image and colorbar are taken from.
See my second answer. I did it for you.
I am facing some error in running this code
@Naseer have you got the solution of your problem?
@RICHA SINGH, yes he did get the solution to his problem. He kindly accepted my answer. It's the one with the green line and check mark above it and says "Accepted Answer".
Sir I am attaching a code and its output , the 5th figure (floating point temperature)in the output the color scale on the right side shows the opposite result as where the temperature should be low it represents high and vice versa.
@RICHA SINGH, look at your color bar! You did not modify the code to crop YOUR color bar out. You simply used the code I gave, which was for a different image, so your color bar is not the full, actual color bar used in your image. Make that adjustment and it should work.
ok sir thank you

Sign in to comment.

mr.hien tran
mr.hien tran on 5 Oct 2018
excuse me sir. can you help me ? I'm working on thermal image processing How can i find the highest temperature in infrared image?? please!!!
monika  SINGH
monika SINGH on 16 May 2019
Edited: Image Analyst on 8 Apr 2022
Image Analyst, with your code below:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
%===============================================================================
% Get the name of the image the user wants to use.
baseFileName = '11.png'; % Assign the one on the button that they clicked on.
% Get the full filename, with path prepended.
folder = pwd
fullFileName = fullfile(folder, baseFileName);
%===============================================================================
% Read in a demo image.
originalRGBImage = imread(fullFileName);
% Display the image.
subplot(2, 3, 1);
imshow(originalRGBImage, []);
axis on;
caption = sprintf('Original Pseudocolor Image, %s', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
grayImage = min(originalRGBImage, [], 3); % Useful for finding image and color map regions of image.
% Get the dimensions of the image. numberOfColorChannels should be = 3.
[rows, columns, numberOfColorChannels] = size(originalRGBImage);
% Crop off the surrounding clutter to get the colorbar.
colorBarImage = imcrop(originalRGBImage, [1, 20, 17, rows]);
b = colorBarImage(:,:,3);
% Crop off the surrounding clutter to get the RGB image.
rgbImage = imcrop(originalRGBImage, [81, 1, columns-20, rows]);
% Get the dimensions of the image.
% numberOfColorBands should be = 3.
[rows, columns, numberOfColorChannels] = size(rgbImage);
% Display the image.
subplot(2, 3, 2);
imshow(rgbImage, []);
axis on;
caption = sprintf('Cropped Pseudocolor Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
hp = impixelinfo();
% Display the colorbar image.
subplot(2, 3, 3);
imshow(colorBarImage, []);
axis on;
caption = sprintf('Cropped Colorbar Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0.05 1 0.95]);
% Get rid of tool bar and pulldown menus that are along top of figure.
% set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
% Get the color map.
storedColorMap = colorBarImage(:,1,:);
% Need to call squeeze to get it from a 3D matrix to a 2-D matrix.
% Also need to divide by 255 since colormap values must be between 0 and 1.
storedColorMap = double(squeeze(storedColorMap)) / 255
% Need to flip up/down because the low rows are the high temperatures, not the low temperatures.
storedColorMap = flipud(storedColorMap);
% Convert from an RGB image to a grayscale, indexed, thermal image.
indexedImage = rgb2ind(rgbImage, storedColorMap);
% Display the thermal image.
subplot(2, 3, 4);
imshow(indexedImage, []);
axis on;
caption = sprintf('Indexed Image (Gray Scale Image)');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% Define the temperature at the top end of the scale
% This will probably be the high temperature.
highTemp = 28.9;
% Define the temperature at the dark end of the scale
% This will probably be the low temperature.
lowTemp = 0.9;
% Scale the image so that it's actual temperatures
thermalImage = lowTemp + (highTemp - lowTemp) * mat2gray(indexedImage);
subplot(2, 3, 5);
imshow(thermalImage, []);
axis on;
colorbar;
title('Floating Point Thermal (Temperature) Image', 'FontSize', fontSize, 'Interpreter', 'None');
hp = impixelinfo(); % Let user mouse around and see temperatures.
hp.Units = 'normalized';
hp.Position = [0.45, 0.03, 0.25, 0.05];
% Get the histogram of the indexed image
subplot(2, 3, 6);
histogram(thermalImage, 'Normalization', 'probability');
axis on;
grid on;
caption = sprintf('Histogram of Thermal Temperature Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Temperature', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Frequency', 'FontSize', fontSize, 'Interpreter', 'None');
IN THE ABOVE CODE, ARE YOU SURE IT GIVES ACCURATE TEMPERATURE W.R.T TEMPERATURE??
AND WHAT IS SIGNIFICANCE OF COLORBAR

4 Comments

@Image Analyst, Hello Sir, My Thermal Image is in the format .IS2. How can I read it in MATLAB.
@Apra Gupta, I have no idea how to read .IS2 format images. Ask your camera manufacturer for code to read it in, preferably in MATLAB. Otherwise translate it into MATLAB.
Ok Sir, Right now I m converting my images to JPEG and then working on it, bt in its JPEG format the information related to temperature gets lost.
Image Analyst
Image Analyst on 8 Apr 2022
Edited: Image Analyst on 8 Apr 2022
@monika SINGH, with my code above that you posted, it's as accurate as your color bar is. I'm sure it's not as accurate as if you could just get the temperature image directly from your camera but as far as how many degrees off it is, I can't say. It depends on the range of temperatures in the colorbar and how bad the JPG artifacts in the image are, and how accurately you specify the color bar coordinates.
The colorbar tells you how to convert an RGB value into a temperature.

Sign in to comment.

Andrew Oliver
Andrew Oliver on 8 Apr 2022
@Image Analyst I would like to use and reference your code in an undergrad project that I am currently doing which deals with a basic thermal imaging analysis system using MATLAB, would you be able to share with me the appropriate way to cite this? Many thanks
Hello, my apologies to ask another question. I am fairly new to matlab and am have a similar problem.
I used a similar code for my image which I attached. I understand that my issue is because I did not properly crop the colorbar, however I am not completely aware on how to do that. Would you please offer me your assistance in this matter? Thank you.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
%===============================================================================
% Get the name of the image the user wants to use.
baseFileName = '11.png'; % Assign the one on the button that they clicked on.
% Get the full filename, with path prepended.
folder = pwd
fullFileName = fullfile(folder, baseFileName);
%===============================================================================
% Read in a demo image.
originalRGBImage = imread(fullFileName);
% Display the image.
subplot(2, 3, 1);
imshow(originalRGBImage, []);
axis on;
caption = sprintf('Original Pseudocolor Image, %s', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
grayImage = min(originalRGBImage, [], 3); % Useful for finding image and color map regions of image.
% Get the dimensions of the image. numberOfColorChannels should be = 3.
[rows, columns, numberOfColorChannels] = size(originalRGBImage);
% Crop off the surrounding clutter to get the colorbar.
colorBarImage = imcrop(originalRGBImage, [1, 20, 17, rows]);
b = colorBarImage(:,:,3);
% Crop off the surrounding clutter to get the RGB image.
rgbImage = imcrop(originalRGBImage, [81, 1, columns-20, rows]);
% Get the dimensions of the image.
% numberOfColorBands should be = 3.
[rows, columns, numberOfColorChannels] = size(rgbImage);
% Display the image.
subplot(2, 3, 2);
imshow(rgbImage, []);
axis on;
caption = sprintf('Cropped Pseudocolor Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
hp = impixelinfo();
% Display the colorbar image.
subplot(2, 3, 3);
imshow(colorBarImage, []);
axis on;
caption = sprintf('Cropped Colorbar Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0.05 1 0.95]);
% Get rid of tool bar and pulldown menus that are along top of figure.
% set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
% Get the color map.
storedColorMap = colorBarImage(:,1,:);
% Need to call squeeze to get it from a 3D matrix to a 2-D matrix.
% Also need to divide by 255 since colormap values must be between 0 and 1.
storedColorMap = double(squeeze(storedColorMap)) / 255
% Need to flip up/down because the low rows are the high temperatures, not the low temperatures.
storedColorMap = flipud(storedColorMap);
% Convert from an RGB image to a grayscale, indexed, thermal image.
indexedImage = rgb2ind(rgbImage, storedColorMap);
% Display the thermal image.
subplot(2, 3, 4);
imshow(indexedImage, []);
axis on;
caption = sprintf('Indexed Image (Gray Scale Image)');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% Define the temperature at the top end of the scale
% This will probably be the high temperature.
highTemp = 28.9;
% Define the temperature at the dark end of the scale
% This will probably be the low temperature.
lowTemp = 0.9;
% Scale the image so that it's actual temperatures
thermalImage = lowTemp + (highTemp - lowTemp) * mat2gray(indexedImage);
subplot(2, 3, 5);
imshow(thermalImage, []);
axis on;
colorbar;
title('Floating Point Thermal (Temperature) Image', 'FontSize', fontSize, 'Interpreter', 'None');
hp = impixelinfo(); % Let user mouse around and see temperatures.
hp.Units = 'normalized';
hp.Position = [0.45, 0.03, 0.25, 0.05];
% Get the histogram of the indexed image
subplot(2, 3, 6);
histogram(thermalImage, 'Normalization', 'probability');
axis on;
grid on;
caption = sprintf('Histogram of Thermal Temperature Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Temperature', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Frequency', 'FontSize', fontSize, 'Interpreter', 'None');

5 Comments

% Take a thermal RGB image from the FLIR One camera and uses the embedded color bar to determine temperatures from the colors and make a temperature image.
% Input is a thermal RGB image from a thermal camera, such as the FLIR One camera,
% that has a pseudocolored image and a colorbar all in the same image.
% User is asked to draw a rectangle around the thermal image part of the image,
% and the colorbar part of the image. User is asked for the min and max temperatures
% at the end of the colorbar. It then the embedded color bar to create a mapping of
% RGB color into temperatures in degrees F or F. It then determines temperatures from
% the colors for every pixel in the image and make a temperature image.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
%===============================================================================
% Get the name of the image the user wants to use.
baseFileName = 'thermal_image.png';
% Get the full filename, with path prepended.
folder = pwd; % Change to whatever folder the image lives in.
fullFileName = fullfile(folder, baseFileName); % Append base filename to folder to get the full file name.
if ~isfile(fullFileName)
warningMessage = sprintf('Default image %s not found.\nPlease select one.', fullFileName);
uiwait(warndlg(warningMessage));
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(folder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName);
% errorMessage = sprintf('Error: file not found:\n%s', fullFileName)
% uiwait(errordlg(errorMessage));
return;
end
fprintf('Transforming image "%s" to a thermal image.\n', fullFileName);
%===============================================================================
% Read in a demo image.
hFig = figure;
originalRGBImage = imread(fullFileName);
[rows, columns, numberOfColorChannels] = size(originalRGBImage)
% Display the image.
imshow(originalRGBImage, []);
hFig.WindowState = 'maximized'; % Maximize the window so it's easier to draw.
axis on;
caption = sprintf('Original Pseudocolor Image, %s', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
grayImage = min(originalRGBImage, [], 3); % Useful for finding image and color map regions of image.
%=========================================================================================================
% Need to crop out the image and the color bar separately.
% First crop out the image.
roiPosition = GetRectangularROI('Drag a box out over the portion of the image you want to analyze.');
% roiPosition is [xLeft, yTop, width, height]
imageRow1 = round(roiPosition(2));
imageRow2 = round(imageRow1 + roiPosition(4));
imageCol1 = round(roiPosition(1));
imageCol2 = round(imageCol1 + roiPosition(3));
% Nominal values for the demo image:
% imageRow2 = 298;
% imageCol2 = 460;
% Validate these numbers because sometime the "2" coordinate is one past the edge of the image.
if imageRow2 > rows || imageCol2 > columns
% warningMessage = sprintf('Error: you are trying to extract the thermal scene image\nfrom an area outside the actual image.\nThe size of the full image is %d rows by %d columns.\nYou are trying to extract from row %d to %d, and from column %d to %d, which is outside the image.\nI will fix it for you.',...
% rows, columns, imageRow1, imageRow2, imageCol1, imageCol2);
% uiwait(warndlg(warningMessage));
% Clip the coordinates so they fit.
imageRow1 = min(imageRow1, rows);
imageRow2 = min(imageRow2, rows);
imageCol1 = min(imageCol1, columns);
imageCol2 = min(imageCol2, columns);
end
% Put up a rectangle over the original image showing where we cropped out of.
rectanglePosition = [imageCol1, imageRow1, imageCol2 - imageCol1, imageRow2 - imageRow1];
hold on;
rectangle('Position', rectanglePosition, 'EdgeColor', 'r', 'LineWidth', 2);
% Crop off the surrounding clutter to get the RGB image.
rgbImage = originalRGBImage(imageRow1 : imageRow2, imageCol1 : imageCol2, :);
% imcrop(originalRGBImage, [20, 40, 441, 259]);
% Next, crop out the colorbar. Define the location for this particular image.
roiPosition = GetRectangularROI('Drag a box out over the color bar only.');
% roiPosition is [xLeft, yTop, width, height]
colorBarRow1 = round(roiPosition(2));
colorBarRow2 = round(colorBarRow1 + roiPosition(4));
colorBarCol1 = round(roiPosition(1));
colorBarCol2 = round(colorBarCol1 + roiPosition(3));
% Nominal values for the demo image:
% colorBarRow1 = 45;
% colorBarRow2 = 293;
% colorBarCol1 = 533;
% colorBarCol2 = 545;
% Validate these numbers because sometime the "2" coordinate is one past the edge of the image.
if imageRow2 > rows || imageCol2 > columns
% warningMessage = sprintf('Error: you are trying to extract the thermal scene image\nfrom an area outside the actual image.\nThe size of the full image is %d rows by %d columns.\nYou are trying to extract from row %d to %d, and from column %d to %d, which is outside the image.\nI will fix it for you.',...
% rows, columns, imageRow1, imageRow2, imageCol1, imageCol2);
% uiwait(warndlg(warningMessage));
% Clip the coordinates so they fit.
colorBarRow1 = min(colorBarRow1, rows);
colorBarRow2 = min(colorBarRow2, rows);
colorBarCol1 = min(colorBarCol1, columns);
colorBarCol2 = min(colorBarCol2, columns);
end
% Crop out the color bar image by itself.
% Crop off the surrounding clutter to get the colorbar.
colorBarImage = originalRGBImage(colorBarRow1 : colorBarRow2, colorBarCol1 : colorBarCol2, :);
% Make sure they didn't mistakenly crop out some black bounding box around the colorbar.
[cbr, cbg, cbb] = imsplit(colorBarImage);
blackMask = (cbr == 0) & (cbg == 0) & (cbb == 0);
% Find rows and columns where all the pixels are pure black.
allBlackRows = all(blackMask, 2);
allBlackColumns = all(blackMask, 1);
% Delete all black columns:
colorBarImage(:, allBlackColumns, :) = [];
% Delete all black rows:
colorBarImage(allBlackRows, :, :) = [];
%=========================================================================================================
% Get the color map from the color bar image. Sometimes the images the users have are noisy JPG images
% with bad artifacts or dithering noise. Average across the colorbar to get the average colors.
[cbr, cbg, cbb] = imsplit(colorBarImage);
if size(cbr, 1) > size(cbr, 2)
% Colorbar has more rows than columns so it's vertical.
meanR = mean(cbr, 2); % Assumes vertical colorbar.
meanG = mean(cbg, 2); % Assumes vertical colorbar.
meanB = mean(cbb, 2); % Assumes vertical colorbar.
end1String = 'top'; % For the max temperature.
end2String = 'bottom'; % For the min temperature.
else
% Colorbar has more columns than rows so it's horizontal.
meanR = mean(cbr, 1); % Assumes horizontal colorbar.
meanG = mean(cbg, 1); % Assumes horizontal colorbar.
meanB = mean(cbb, 1); % Assumes horizontal colorbar.
end1String = 'right'; % For the max temperature.
end2String = 'left'; % For the min temperature.
end
% Also need to divide by 255 since colormap values must be between 0 and 1.
storedColorMap = [meanR(:), meanG(:), meanB(:)] / 255;
% Need to flip up/down because the low rows are the high temperatures, not the low temperatures.
storedColorMap = flipud(storedColorMap);
%========================================================================================================================================
% Now we need to define the temperatures at the end of the colored temperature scale.
% Ask them to do it here while the image is magnified to the full screen.
% You can read these off of the image, since we can't figure them out without doing OCR on the image.
% Define the temperature at the top end of the scale.
% This will probably be the high temperature.
highTemp = 31.6;
% Define the temperature at the dark end of the scale
% This will probably be the low temperature.
lowTemp = 20.6;
%========================================================================================================================================
% Optional : ask the user to confirm these two numbers.
% Ask user for two floating point numbers.
defaultValue = {sprintf('%.1f', highTemp), sprintf('%.1f', lowTemp)};
titleBar = 'Enter temperature range';
promptString1 = sprintf('Enter the temperature at the %s of the colorbar : ', end1String);
promptString2 = sprintf('Enter the temperature at the %s of the colorbar : ', end2String);
userPrompt = {promptString1, promptString2};
caUserInput = inputdlg(userPrompt, titleBar, 1, defaultValue);
if isempty(caUserInput),return,end % Bail out if they clicked Cancel.
% Convert to floating point from string.
highTemp = str2double(caUserInput{1});
lowTemp = str2double(caUserInput{2});
% Check highTemp for validity.
if isnan(highTemp)
% They didn't enter a number.
% They clicked Cancel, or entered a character, symbols, or something else not allowed.
% Convert the default from a string and stick that into usersValue1.
highTemp = str2double(defaultValue{1});
message = sprintf('I said it had to be a number.\nTry replacing the user.\nI will use %.2f and continue.', highTemp);
uiwait(warndlg(message));
end
% Do the same for lowTemp
% Check usersValue2 for validity.
if isnan(lowTemp)
% They didn't enter a number.
% They clicked Cancel, or entered a character, symbols, or something else not allowed.
% Convert the default from a string and stick that into usersValue2.
lowTemp = str2double(defaultValue{2});
message = sprintf('I said it had to be a number.\nTry replacing the user.\nI will use %.2f and continue.', lowTemp);
uiwait(warndlg(message));
end
% Display the original full image.
subplot(2, 3, 1);
imshow(originalRGBImage, []);
hFig.WindowState = 'maximized';
axis on;
caption = sprintf('Original Pseudocolor Image, %s', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% Put up a rectangle over the original image showing where we cropped out of.
rectanglePositionColorBar = [colorBarCol1, colorBarRow1, colorBarCol2 - colorBarCol1, colorBarRow2 - colorBarRow1];
hold on;
rectangle('Position', rectanglePosition, 'EdgeColor', 'r', 'LineWidth', 2);
rectangle('Position', rectanglePositionColorBar, 'EdgeColor', 'r', 'LineWidth', 2);
%=========================================================================================================
% Display the pseudocolored RGB image.
subplot(2, 3, 2);
imshow(rgbImage, []);
axis on;
caption = sprintf('Cropped Pseudocolor Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
hp = impixelinfo();
% Display the colorbar image.
subplot(2, 3, 3);
imshow(colorBarImage, []);
axis on;
impixelinfo;
caption = sprintf('Cropped Colorbar Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% Set up figure properties:
% Enlarge figure to full screen.
g = gcf;
g.WindowState = 'maximized';
% Get rid of tool bar and pulldown menus that are along top of figure.
% set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
g.Name = 'Demo by ImageAnalyst';
g.NumberTitle = 'Off';
%=========================================================================================================
% Convert the subject/sample from a pseudocolored RGB image to a grayscale, indexed image.
indexedImage = rgb2ind(rgbImage, storedColorMap);
% Display the indexed image.
subplot(2, 3, 4);
imshow(indexedImage, []);
impixelinfo;
axis on;
caption = sprintf('Indexed Image (Gray Scale Thermal Image)');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
%========================================================================================================================================
% Scale the indexed gray scale image so that it's actual temperatures in degrees C instead of in gray scale indexes.
thermalImage = lowTemp + (highTemp - lowTemp) * mat2gray(indexedImage);
% Display the thermal image.
subplot(2, 3, 5);
imshow(thermalImage, []);
axis on;
colorbar;
title('Floating Point Thermal (Temperature) Image', 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Column', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Row', 'FontSize', fontSize, 'Interpreter', 'None');
% Let user mouse around and see temperatures on the GUI under the temperature image.
hp = impixelinfo();
hp.Units = 'normalized';
hp.Position = [0.45, 0.03, 0.25, 0.02];
%=========================================================================================================
% Get and display the histogram of the thermal image.
subplot(2, 3, 6);
histogram(thermalImage, 'Normalization', 'probability');
axis on;
grid on;
caption = sprintf('Histogram of Temperatures in Thermal Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Temperature [Degrees]', 'FontSize', fontSize, 'Interpreter', 'None');
ylabel('Frequency [Pixel Count]', 'FontSize', fontSize, 'Interpreter', 'None');
% Get the maximum temperature.
maxTemperature = max(thermalImage(:));
fprintf('The maximum temperature in the image is %.2f\n', maxTemperature);
fprintf('Done! Thanks Image Analyst!\n');
%%%%%%%%%%%%%%%% END OF MAIN PROGRAM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%===============================================================================================================================
% Function to have the user draw a box around some part of the image.
% You pass in what part you're asking for in the userPrompt string.
function roiPosition = GetRectangularROI(userPrompt)
roiPosition = [];
hRect = [];
% Ask user to draw rectangle.
button = 'Redraw';
while contains(button, 'Redraw', 'IgnoreCase',true)
uiwait(helpdlg(userPrompt));
% User draws a box. It exits as soon as they lift the mouse.
hBox = drawrectangle('Color', 'r');
% Get the coordinates in the form [xLeft, yTop, width, height].
roiPosition = hBox.Position;
% Delete the ROI object.
delete(hBox);
% and replace it with a rectangle in the graphical overlay.
hold on;
hRect = rectangle('Position', roiPosition, 'EdgeColor', 'r', 'LineWidth', 2);
% Ask user if the rectangle is acceptable.
message = sprintf('Is this good?');
button = questdlg(message, message, 'Accept', 'Redraw', 'Reject and Quit', 'Accept');
if contains(button, 'Quit','IgnoreCase',true)
delete(hRect); % Delete the box from the overlay.
roiPosition = [];
break;
elseif contains(button, 'Redraw','IgnoreCase',true)
% OPTIONAL If you want to delete the prior one before drawing the next one.
delete(hRect);
elseif contains(button, 'Accept','IgnoreCase',true)
break;
end
end
% If you want to delete the rectangle from the overlay, do this:
% delete(hRect); % Delete the box from the overlay.
end
I have used the same code provided here but I didnt get the expected output.All I got is the input image I have given.I am fairly new to matlab and thermal image processing and not sure how to proceed with cropping color bar and image.Kindly help me with the same.
Sorry to bother you and thank you for your demo above.
I am new to Matlab and coding.
I am working on a project looking at the use of thermal imaging.
I was wondering if you could help me with how to define an area of interest in the image to calculate the mean temperature (excluding the background) and use this to define an isotherm area.
Is it then possible to subtract this to view areas above this mean temperature?
Thank you!
If there are video tutorials I could be directed to I would be very grateful
BW
@Tasneem you can define isotherms using contour or simply by testing for equality
oneTemperature = temperatureImage == desiredTemperature; % Makes a binary image.
To specify an ROI, you can do it in several ways, such as by thresholding.
hotPixels = temperatureImage > someTemperature;
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters.
If you have more questions, start a new discussion thread of your own and attach your image(s).
Dear @Image Analyst thank you !
I will have a look and try get my head around it.
I will start my own thread as well
thank you for your help and time!

Sign in to comment.

Dear @Image Analyst , I have a task which is related image processing. I need to see temperatures along a horizontal line where is center of the circles. Could you help me about this problem? How can I see temperature vs position graph? Thank you in advance.

8 Comments

The process is the same as above, just use improfile() on the thermal data. In order to do that, use an image that's not full of annotations, because you can only guess what data is obscured by annotations.
% read the image
inpict = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1403674/11.jpg');
% extract a color table from the colorbar
CT0 = imcrop(inpict,[603.5 71.5 17.9 337.9]);
CT0 = im2double(CT0); % unit scale float
CT0 = mean(CT0,2); % average rows
CT0 = flipud(permute(CT0,[1 3 2])); % reorient
% estimate data from the pseudocolor image
cblimits = [51 73]; % from the picture
thermalpict = rgb2ind(inpict,CT0); % apply the color table
thermalpict = interp1([0 size(CT0,1)],cblimits, ...
double(thermalpict),'linear'); % rescale
% show the image
imshow(thermalpict,[])
% manually select some profile
npoints = 100;
tprofile = improfile(npoints);
plot(tprofile)
Thank you so much for your help dear @DGM
I'm sory for bothering you dear @DGM and @Image Analyst, This task about my final thesis and I need to make this graph asap. Also, I have a question. Is this process could be adapted to video? If you help me, I appreciate you.
@Güney Can Gürbüz it seems to work fine. Did you try to adapt it? You would have gotten the attached.
If you check the documentation for improfile(), you should be able to get the query points from a given manual selection and apply those to other frames. Bear in mind though, if the colorbar scale changes over time, the temperature calculations will be wrong. Could you use OCR to read the colorbar limits for each frame? Maybe, but I don't have OCR tools to test that with.
Hello sir,can you help me i want to use it for my study but i need to use the Iron colourmap(pallette) for my image segmentation can you help me how to set it up
DGM
DGM on 10 Jan 2024
Edited: DGM on 10 Jan 2024
It's not clear what your task is, whether you're talking about trying to use improfile(), or what to part of the task the colormap is relevant.
There are a handful of "iron" colormaps that are all very similar but not identical, and I don't know of any which I would consider to be canonical. For example, the map used above is what many sources would refer to as "iron", even though it's significantly different to both the FLIR and Chauvin-Arnoux maps. Some of the maps you might find online that are claimed specifically to be a duplicate of the FLIR map are even less accurate. As far as I know, there are at least two distinct "iron" map variants used by FLIR.
Here is a handful of maps which are either explicitly called "iron" or are claimed specifically to be the FLIR map, or are recommended as being a substitute:
If the goal is to estimate temperature from pseudocolor images, then getting an accurate estimate of the applied colormap is essential. Given the above sample, "iron" is not specific enough to be useful.
Click the Ask button at the top of the page and write a question describing your task. If there are relevant images, include them. If it's not apparent from the images, mention the camera brand.
@NUZUL, colormaps are not used for image segmentation.
If you're talking about my thermal image demo above, it does not matter what colorbar/colormap is embedded in the thermal image. It will work with any colormap.
If you're wanting to create an "iron" colormap, then you'll have to define it because it's not one of the built-in colormaps of MATLAB.
To define your own:
>> colormapeditor

Sign in to comment.

Asked:

on 24 Feb 2018

Edited:

DGM
on 10 Jan 2024

Community Treasure Hunt

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

Start Hunting!