Thermal Camera Image Analyzing
15 views (last 30 days)
Show older comments
Hi,I have thermal images and I need to draw weight lines for specific points:areas in the image. How to do that?
1 Comment
DGM
on 19 Jul 2024
What does "draw weight lines for specific points/areas" mean exactly? Are you trying to find temperature profiles along lines defined by points?
Having a sample image and target points would be useful for creating an example.
Accepted Answer
Rahul
on 23 Aug 2024 at 10:32
I understand that you are trying to draw weight lines for specific areas in thermal images.
One of the ways of approaching this problem can be drawing weight lines using the "contour" function. This function creates a contour plot of the thermal image. You can set threshold values for the thermal image to highlight certain areas of the image and get appropriate contours.
You can use the following code:
thresholdValue = 150; % Setting an example threshold
binaryImage = thermalImage > thresholdValue;
figure;
imshow(thermalImage);
hold on;
% Use the "contour" function to draw contours on the thermal image
contour(binaryImage, 'LineColor', 'r', 'LineWidth', 2);
title('Contours on Thermal Image');
hold off;
% In this example "thermalImage" variable is assumed to be the thermal
% image
If needed you can also look into other image processing techniques to achieve the desired result from the "Image Processing Toolbox".
You can refer to the following documentations for your reference:
"Image Processing Toolbox": https://www.mathworks.com/help/releases/R2024a/images/index.html?searchHighlight=image%20processing%20toolbox&s_tid=doc_srchtitle
Hope this helps! Thanks.
1 Comment
DGM
on 23 Aug 2024 at 20:54
Edited: DGM
on 23 Aug 2024 at 21:06
To be clear, this assumes that the input is already a 2D array of temperature data, not a pseudocolor image.
Given that, you could threshold it based on temperature ...
% a fake thermal image in floating point
S = load('Tpep.mat');
T = S.T;
% threshold based on temperature
thresh = 12.5;
mask = T > thresh;
% that works, but it's rough
imshow(mask)
... but there's no point in doing that if you're going to use contour() on the result.
% a fake thermal image in floating point
S = load('Tpep.mat');
T = S.T;
% if you're using contour(), there's no point in binarizing
templevels = [-50 -18.75 12.5 43.75 75]; % pick some temperature levels
imshow(repmat(mat2gray(T),[1 1 3])); hold on
contour(T,templevels,'linewidth',2)
colormap(parula(numel(templevels)))
As can be demonstrated easily, trying to show the source image and the contour simultaneously as in your example will not work for at least one reason. First, the temperature data is not in unit-scale, so it will be grossly truncated. If the linecolor specification were omitted, there would be other problems. Since T is 2D, both the displayed image and the contour() object would share the exact same color table which is asserted when contour() is called, making the contour effectively invisible.
% a fake thermal image in floating point
S = load('Tpep.mat');
T = S.T;
% threshold based on temperature
thresh = 12.5;
mask = T > thresh;
% this won't work
imshow(T); % this truncates the image at irrelevant levels
hold on;
contour(mask,'linewidth',2,'linecolor','r')
Even at that, it's not clear that "draw weight lines for specific points:areas" means "draw the level curves of the temperature data". OP never clearly stated what they wanted.
Also, it's not clear whether an overlaid contour in a figure is adequate, or whether the lines need to be incorporated into the image itself for some reason.
More Answers (1)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!