How do I map grayscale values to get temperature?

9 views (last 30 days)
In the attached file I have shown the thermal image clicked during live preview from my camera.
I am able to fetch the Minimum, Maximum, and Mean Grayscale Level values along with GL value at Center (Blue Circle) at backend continuously in live video.
I want to know if I can use these GL values to get corresponding temperature with any equation or any function.
Also can you suggest anything else that I can use for this purpose?

Answers (2)

Walter Roberson
Walter Roberson on 20 May 2022
"I want to know if i can use these GL values to get corresponding temperature with any equation or any function."
No, there is way to do that based on the grayscale level. That colormap is not linear in grayscale brightness.
  6 Comments
PRAVEEN KUMAR
PRAVEEN KUMAR on 22 May 2022
Thank you for your response @Walter Roberson & @Image Analyst
Here is the piece of code i am running.
clear cam;
cam= webcam('PureThermal (fw:v1.3.0)');
preview(cam);
global take_photo;
take_photo=1;
while(take_photo == 1)
data = snapshot(cam);
gray=rgb2gray(data);
minGL=min(gray(:));
maxGL=max(gray(:));
meanGL=mean2(gray(:));
minGLValue=int2str(minGL);
maxGLValue=int2str(maxGL);
meanGLValue=int2str(meanGL);
app.MinGLEditField.Value= minGLValue;
app.MaxGLEditField.Value= maxGLValue;
app.MeanEditField.Value=meanGLValue;
x= str2double(minGLValue);
y= str2double(maxGLValue);
c=x*2.083;
d=y*0.1286;
a=app.ToneImageSlider.Value;
bw=gray>a;
imshow(data)
%imshow(data,'parent',app.UIAxes);
title('Structural Fault Detection',"FontSize",14);
colorbar;
caxis([x y]);
axis on;
colormap("jet");
[L n]=bwlabel(bw);
stats = regionprops(L, 'BoundingBox','Centroid');
row=80;
column=60;
center=[row column];
Inttensity=gray(column,row);
intt=int2str(Inttensity);
app.CenterEditField.Value= intt;
viscircles(center,5,'color','b');
hold on
for object = 1:length(stats)
bb = stats(object).BoundingBox;
bc = stats(object).Centroid;
rectangle('Position',bb,'EdgeColor','r','Linewidth',2)
plot(bc(1),bc(2), '-m+');
if length(stats) <=5
a=text(bc(1)+15,bc(2),strcat('X: ', num2str(round(bc(1))),' Y: ',num2str(round(bc(2)))));
end
end
hold off
end
Please see and suggest me what to do next.
Walter Roberson
Walter Roberson on 22 May 2022
PureThermal is a FLIR camera.
There is no possibility that converting a color FLIR image to grayscale will work properly for your purposes. FLIR does not use a linear colormap.
If I understand correctly, PureThermal (without the 2 of PureThermal2) is a board with a sensor and a FLIR Lepton socket. In particular, as far as I can see, it is not one of FLIR's cameras that has WiFi.
If my understanding is correct, then you have three choices:
  1. calibrate your equipment in order to determine the color to temperature mapping. I am not confident this will work: based on my past reading about FLIR, the lower-end devices appear to automatically determine temperature range to use. However, you might succeed in determining the colormap, and then for any given image if you have two calibrated spots you could determine the rest of the temperatures; OR
  2. You can purchase the FLIR research software;
  3. You might be able to take the sensor and Lepton module and put it into a development board that provides better software
If using the FLIR research software is not an option, then adding another development board is probably not an option; then your only option might be calibration overall, together with having two points of known temperature in each image.
FLIR sells at different price-points, and it is deliberate that their less-expensive equipment makes it difficult to get actual temperature data out.

Sign in to comment.


Image Analyst
Image Analyst on 22 May 2022
See attached demo and adapt as needed.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!