-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPreProcessTrees.m
More file actions
38 lines (26 loc) · 846 Bytes
/
Copy pathPreProcessTrees.m
File metadata and controls
38 lines (26 loc) · 846 Bytes
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
clear all;
inputPath = '';
thumbnails = 'C:\Users\User\Google Drive\Greenstand\Thumbnails';
defective = 'C:\Users\User\Google Drive\Greenstand\Defective';
ds = imageDataStore(inputPath,'Type','image','FileExtensions',{'.jpg','.tif','.png'});
[dsRows,dsCols] = size(ds.Files);
for i = 1:dsRows
try
waitbar(i/dsRows);
filePath = ds.Files(i);
k = strfind(filePath,'thumb');
if ~isempty(k{1})
movefile(filePath{1,1},thumbnails);
continue;
end
data = readimage(ds,i);
grayImage = rgb2gray(data);
grayImage = single(grayImage);
[~,~,~,~,meas] = brenners(grayImage);
if (meas < 200)
movefile(filePath{1,1},defective);
end
catch ME
continue;
end
end