Andres
Andres

Reputation: 11

calculate the temperature in a thermal image matlab

what I am trying to do is calculate the temperature of a selected area in an image my code:

M=imread('IR003609.BMP');

a = min(M(:));      % find the minimum temperature in the image
b = max(M(:));      % find the maximum temperature in the image

imshow(M,[a b]);    
 h = roipoly();     
  maskOfROI =h;      
  selectedValues = M(maskOfROI);      

averageTemperature =mean(selectedValues)  
maxTemperature = max(selectedValues)       
minTemperature = min(selectedValues)  

my image is this with the mouth area selected enter image description here

Then the values ​​that he throws at me are these:

averageTemperature =

   64.0393


maxTemperature =

  uint8

   255


minTemperature =

  uint8

   1

Now my questions are, is the program throwing the correct temperature values ​​(comparing the values ​​seen in the image)? or what values ​​are emissivity? if they are wrong values ​​how could I solve it? please help

Upvotes: 0

Views: 836

Answers (1)

Yuval Harpaz
Yuval Harpaz

Reputation: 1426

I see that the color bar is the hue of HSV so I suggest you convert to temperature along these lines: you convert to HSV, use the first layer, then rescale to fit 31-39 deg. And the colors seem to be flipped, so flip them upside down.

M = imread('jQLo5.jpg');
Mhsv = rgb2hsv(M);
maxTemp = 39;
minTemp = 31;
Mtemp = (1-Mhsv(:,:,1))*(maxTemp-minTemp)+minTemp;

figure;
imagesc(Mtemp)
colormap(flipud(hsv))
colorbar

Upvotes: 1

Related Questions