-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrowth.m
More file actions
44 lines (38 loc) · 1.03 KB
/
Copy pathgrowth.m
File metadata and controls
44 lines (38 loc) · 1.03 KB
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
42
43
44
clear variables
clc
close all
vidObj = VideoReader('ecoli_growth4.avi'); % reads the video file
data = read(vidObj, Inf); % reads the last frame of video file
numFrames = vidObj.NumberOfFrames; % determines the number of frmaes in the video
area2 = zeros(numFrames,1);
for ii = 1: numFrames
image = read(vidObj, ii);
A=rgb2gray(image);
if ii == 1
imshow (A)
prompt1 = 'What is the threshold? ';
Th = input(prompt1);
A(A<Th) = 0;
figure
imshow(A)
prompt2 = 'if happy with threshold press 1 else 0';
Happy = input(prompt2);
end
if Happy == 0
disp('Run again and select the correct threshold')
break
end
if Happy == 1
A(A<Th) = 0;
B = im2bw(A);
stats = regionprops(B,'Area');
area = cat(1,stats.Area);
area2(ii) = area;
end
end
figure(3)
Time = (1:numFrames).^0.5;
plot(Time,area2,'- * k')
xlabel('Time')
ylabel('Area')
title('E. coli growth curve')