Finding the average temperature of a thermal image

I am doing a project where I am analysing a thermal image captured by a thermal sensor and stored as an RBG image.
I was able to convert the RGB image to a thermal image sucessfully.
I want to calculate things like the average temperature, deviation etc of the image, however there are parts of the image that I do not want to be included in that calculation. for example a thermal image was taken of someone's hand but it also captures background temperatures. I have reduced that by cropping the image but there are still some unwanted background colors
How do I remove all the colors outside of the boundary of the hand so that I can accurately find the mean temperature(& other parameters) of the hand

 Risposta accettata

Can you save your thermal image in a .mat file and attach it with the paperclip icon. Also somehow indicate which part of the image you want to include. Can it be described by intensity thresholding? Or do you need to outline it with drawfreehand.

7 Commenti

this is a sample image from the thermal sensor. I want to include everything within the boundary of the green edge
@Image Analyst I'm glad you are looking at this. I think you will be able to the OP. @William I couldn't read the attached file, not sure what format it is in can you please try again, being sure to save it as a .mat file
@Jon it was a pseudocolored JPEG file. You can tell by editing it and seeing JFIF in the first few characters of the file. So I changed the extension to JPG and it's attached.
Unfortunately it's not a temperature image with actual floating point temperature numbers. It's a pseudocolored image. We cannot even convert the image to temperature because no colorbar was included. So I have no idea if the red parts are 20 degrees C or 500 degrees C. No idea. So we can't do anything with this image.
See attached demo for how it could be done if there was a colorbar.
William
William il 17 Mag 2022
Modificato: William il 17 Mag 2022
I'm a bit lost. Let me explain my project. I have used a temperature sensor which outputs an array of temperature values. I did some interpolation and assigned the temperature values to RGB colors and had the image saved as a bitmap pic.
I then transfered the data to MATLAB to have it analyzed. I was able to reassign temp values back from the RGB colors using MATLAB but now I want to remove the all the pixels around the edge of the green as shown in the pic.
Maybe I phrased the initial questions incorrectly, but I am not trying to convert the image to temperature values. I am just looking for a way to exclude the pixels around the borders of the hand, that is everything outside of the green pixel as shown in the image
Make a mask then apply it
mask = temperatureImage > 30; % Whatever....
% Mask image by multiplying each channel by the mask.
maskedRgbImage = rgbImage .* cast(mask, 'like', rgbImage); % R2016b or later.
% For R2016a or earlier, mask the image using bsxfun() function to multiply the mask by each channel individually. Works for gray scale as well as RGB Color images.
% maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage)); % R2016a or earlier.
I am trying to extract the information stored in impixel info, How ould I do that?
I used code you provided to generate a grayscale image that shows the temperature whenenever the mouse hovers. What I am trying to do now is whenever the mouse hovers over a location, I want to store the location of that pixel along with the temperature value
How can I extract and save that to a variable from impixelinfo
I couldnt find much info
impixelinfo does not save any values. It's just an instantaneous readout of the color or value under the cursor. Somehow you have to threshold your temperature image or draw them manually. Remember you said "I was able to reassign temp values back from the RGB colors using MATLAB". So use those temp values.
I'm attaching a variety of masking and drawing demos that can define an ROI from which you can get the mean temperature value from.

Accedi per commentare.

Più risposte (1)

If there is a sufficient difference between the background temperature and the hand temperature, then you could just set a threshold on the values to ignore. Something like this, assuming your temperature values are now in an array T
% set all values that are outside of the threshold range to NaN so they can
% be excluded from calculations
Tthresh = 25; % for example exclude anything below 25 deg C
T(T<=Tthresh) = NaN;
% compute mean
Tmean = mean(T,'omitnan'); % set flag so that NaN numbers are not included
If the background color was uniform, hand in front of blue screen or green screen, then you could omit all the values with that color before computing temperatures.
Otherwise you are going to need a more sophisticated cropping alogorithm which finds the edges of the hand in the image

1 Commento

The Mean function sounds like a good idea with the assumption that the temperature value that I am ruling out is not a temperature that possibly may be exhibited by the object that the temperaure is measuring. It is certainly a possibility that the temperature of some point on the hand could be lower.
Any ideas or pointers to where I may find a suitable algorithm, I was thinking something along the line of image segmentation. Not sure if that is the correct thing I sould be searching for

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by