-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfind_flame.m
41 lines (28 loc) · 984 Bytes
/
find_flame.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
% Script to identify flame location
[filename, pathname] = uigetfile({'*.tif'},'Select input image',...
'D:\EJR_OneDrive\OneDrive - University Of Cambridge\Projects\2017_2B_PYROMETRY\Sample_image_data\2017_10_13_sample\' );
imDat = imread([pathname, filename]);
figure(2)
imshow(imDat)
imDatRed = imDat(:,:,1);
imDatGrn = imDat(:,:,2);
imDatBlu = imDat(:,:,3);
red_min = min(imDatRed(:));
red_max = max(imDatRed(:));
prompt = {'max_red val', 'min_red_val', 'red threshold'};
dlg_title = 'Please confirm red threshold';
num_lines = 1;
defaultans = {num2str(red_max),num2str(red_min),'60'};
answer = inputdlg(prompt,dlg_title,num_lines,defaultans);
red_threshold = str2num( answer{3} );
imThresholdedRed = imDatRed > red_threshold;
figure(3)
imagesc(imThresholdedRed)
%%%
imRatioRG = zeros(size(imDatRed));
imRatioRG = double(imDatRed)./double(imDatGrn);
imRatioRG( imThresholdedRed==0 ) = 0;
figure(4)
imagesc(imRatioRG)
colorbar
title('ratio of red:green pixel value')