-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.m
More file actions
45 lines (32 loc) · 1.17 KB
/
Copy pathmain.m
File metadata and controls
45 lines (32 loc) · 1.17 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
45
dir = "C:/Users/RV/Google Drive/ImageRecognition/Main Dataset";
% **SET WORKING DIRECTORY**
imtype = "bmp"; % **SET IMAGE FILETYPE**
cd(dir);
pkg load image;
pkg load io;
arr = cell(0,0); % initialize feature data cell array
folders = glob("*_cells"); % get folder names containing cell images
for i = 1:length(folders) % for each folder in sequence
cd(dir);
folname = folders{i}
celltype = strsplit(folname,"_"){1};
folpath = cat(2,dir,"/",folname);
cd(folpath); % open folder
pics = glob(cat(2,"*",imtype));
cd(dir);
for j = 1:length(pics) % for each image in folder
filename = pics{j};
filenum = strsplit(filename,cat(2,".",imtype)){1};
imagepath = cat(2,folpath,"/",filename);
feature_extract; % call feature extraction script
datarow = num2cell(data);
datarow = cat(2,datarow,filenum,celltype);
arr = cat(1,arr,datarow); % record feature and image id data
cd(folpath);
imwrite(multi,cat(2,filenum,"_montage",".",imtype)); % write montage image
cd(dir);
endfor
endfor
headers = cat(1,headers,"filenum","celltype");
headers = headers';
arr = cat(1,headers,arr);