thermal image processing, the maximum temperature area isolation

조회 수: 7 (최근 30일)
Dovile
Dovile 2014년 5월 6일
답변: Dovile 2014년 5월 8일
Hello, I have problem with matlab code. I have JPG image file and I need that image will be convert to mat file. The second step is the temperature value research. In the face area i need to found the temperature which is bigger than indicates significance ( for ex. 30 C) and market that area in the picture. I try to write some code but I have only that:
clear all; close all; clc;
addpath(genpath(pwd));
Thermo = 'C:\Users\Dovile\Desktop\bakalauras\MatLab\';
if ~isdir(Thermo)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', Thermo);
uiwait(warndlg(errorMessage));
return;
end
filePattern = fullfile(Thermo, '*.jpg');
jpegFiles = dir(filePattern);
result = cell(1,100);
for k = 1:length(jpegFiles)
maxvalue = 0;
maxvalue_g = 255;
maxmalue_b = 255;
max_x = 0;
max_y = 0;
baseFileName = jpegFiles(k).name;
fullFileName = fullfile(Thermo, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
imageArray= imread(fullFileName);
[x,y,z]=size(imageArray);
I1=rgb2gray(imageArray);
[x,y,z]=size(I1);
for j = 1:x
for i = 1:y
if I1(j,i) > maxvalue
maxvalue = I1(j,i);
max_x = j;
max_y = i;
end
if imageArray(j,i,1) > 150
imageArray(j,i,:) = [255,0,0];
end
end
end
imageArray(max_x,max_y,:) = [0,0,0];
%I1=rgb2gray(imageArray); figure,imshow(I1); title('gray converted Image')
colormap('default'); % set colormap
result{k} = imageArray;
figure,imagesc(result{k}); % draw image and scale colormap to values range
hold on;
plot(max_x,max_y,'g.','MarkerSize',20)
title(fullFileName)
colorbar;
end
save kita.mat result;
load kita.mat
%image(k)

답변 (2개)

Dovile
Dovile 2014년 5월 6일
Can anyone help me?

Dovile
Dovile 2014년 5월 8일
Anyone?

Community Treasure Hunt

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

Start Hunting!

Translated by