-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfindBlur.m
40 lines (32 loc) · 1.18 KB
/
findBlur.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
dirIn = 'data/eyeregions_all';
dirOut = 'data/eyeregions_blur_metric';
%%
img = imread(sprintf('%s/Grp001_img000001.png', dirIn));
blurMetric(rgb2gray(img))
img = imread(sprintf('%s/Grp001_img000079.png', dirIn));
blurMetric(rgb2gray(img))
img = imread(sprintf('%s/Grp001_img000080.png', dirIn));
blurMetric(rgb2gray(img))
%% S3
img = imread(sprintf('%s/Grp001_img000001.png', dirIn));
[s_map1 s_map2 s3] = s3_map(double(rgb2gray(img)), true);
sum(s_map1(:) == 0)
img = imread(sprintf('%s/Grp001_img000079.png', dirIn));
[s_map1 s_map2 s3] = s3_map(double(rgb2gray(img)), false);
sum(s_map1(:) == 0)
img = imread(sprintf('%s/Grp001_img000080.png', dirIn));
[s_map1 s_map2 s3] = s3_map(double(rgb2gray(img)), false);
sum(s_map1(:) == 0)
%% find clear images among exported eyeregion images
fileInfo = dir([dirIn,'/*.png']);
nImgs = length(fileInfo);
blurMetricThreshold = 0.32;
for i = 1:nImgs
filename = fileInfo(i).name
img=imread([dirIn,'/', filename]);
filename = filename(1: end-4); % no extension .png
blurness = blurMetric(rgb2gray(img));
if blurness >= blurMetricThreshold
imwrite(img, sprintf('%s/%s_blur%.4d.png', dirOut, filename, blurness));
end
end