필터 지우기
필터 지우기

Thermal Image analysis on legs

조회 수: 2 (최근 30일)
Tasneem
Tasneem 2023년 6월 2일
댓글: Image Analyst 2023년 6월 6일
I am trying to edit the below code so that it gives me an image of the area selected that is above the average temperature of the lower limb.
I would be grateful for any tips
clc;
close all;
clear;
workspace;
format long g;
format compact;
% Read the thermal image
thermalImage = imread('thermal_image_side_leg_2 .jpeg'); % Replace 'thermal_image.jpg' with the filename of your thermal image
% Display the thermal image
figure;
imshow(thermalImage);
title('Original Thermal Image');
% Convert the thermal image to grayscale
thermalImageGray = rgb2gray(thermalImage);
% Display the grayscale thermal image
figure;
imshow(thermalImageGray);
title('Grayscale Thermal Image');
% Select the area of interest using the imfreehand function
figure;
imshow(thermalImageGray);
title('Select Area of Interest');
roi = imfreehand; % This allows you to draw a freehand region of interest (ROI) on the grayscale thermal image
binaryMask = createMask(roi);
% Apply the binary mask to the grayscale image
maskedGrayImage = thermalImageGray .* uint8(binaryMask);
% Display the masked grayscale image
figure;
imshow(maskedGrayImage);
title('Masked Grayscale Image');
% Define the temperature scale using the color bar
colorBarImage = imread('Color_bar_side_leg_2.png'); % Replace 'colorbar_image.jpg' with the filename of your color bar image
temperatureRange = [26, 38]; % Replace with the temperature range provided by the color bar
% Calibrate the masked grayscale image using the temperature range
calibratedImage = (double(maskedGrayImage) - double(min(thermalImageGray(:)))) * (temperatureRange(2) - temperatureRange(1)) / (double(max(thermalImageGray(:))) - double(min(thermalImageGray(:)))) + temperatureRange(1);
% Display the calibrated image
figure;
imshow(calibratedImage);
title('Calibrated Image');
% Calculate the average temperature of the ROI
averageTemperature = mean(calibratedImage(binaryMask));
% Display the average temperature
disp(['The average temperature of the selected area is: ', num2str(averageTemperature), ' °C']);
>> % Calculate the average temperature of the ROI
averageTemperature = mean(calibratedImage(binaryMask));
% Display the average temperature
disp(['The average temperature of the selected area is: ', num2str(averageTemperature), ' °C']);
% Threshold the calibrated image to create a binary mask for temperatures above the average
binaryAboveAverage = calibratedImage > averageTemperature;
% Display the binary mask
figure;
imshow(binaryAboveAverage);
title('Areas above Average Temperature');
% Apply the binary mask to the original image
thresholdedImage = thermalImage;
thresholdedImage(repmat(~binaryAboveAverage, [1, 1, 3])) = 0;
% Display the thresholded image
figure;
imshow(thresholdedImage);
title('Thresholded Image');
  댓글 수: 2
Pratham Shah
Pratham Shah 2023년 6월 6일
Hi!
Please provide the image which you are using. Also mention the problem that you are facing.
Image Analyst
Image Analyst 2023년 6월 6일
If you have any more questions, then attach your data ('thermal_image_side_leg_2 .jpeg') and code to read it in with the paperclip icon after you read this:
Also see my demo that converts a pseudocolored image into a temperature image:

댓글을 달려면 로그인하십시오.

답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by