-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_isophote_eye_detector.m
63 lines (55 loc) · 2.09 KB
/
run_isophote_eye_detector.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function [ecx,ecy,k,c,D,acc,sacc,ind,Lx,Ly,Lxx,Lxy,Lyy]=run_isophote_eye_detector(img,gsigma)
% RUN_ISOPHOTE_EYE_DETECTOR determines the most likely eye-center
% location in the image.
%
% @author Boris Schauerte
% @email [email protected]
% @date 2011
%
% Copyright (C) 2011 Boris Schauerte
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
if nargin < 2
gsigma = 1;
end
% pre-processing
if ~isfloat(img)
img=im2double(img);
img = (img - min(img(:))) / (max(img(:)) - min(img(:)));
end
% run isophote eye detector
[k,c,D,acc,ind,Lx,Ly,Lxx,Lxy,Lyy]=isophote_eye_center_detector3(img,gsigma);
%if isempty(which('spectral_saliency')), addpath(genpath('../saliency/')); end
%acc=acc+imresize(spectral_saliency(imresize(img,[NaN 32])),size(img));
%acc=acc+spectral_saliency(img);
%k=0; c=0; D=0;
% post-process
h = fspecial('gaussian',11,3);
%h = fspecial('gaussian',9,9);
%h = fspecial('average',9);
%h = fspecial('gaussian',3,3);
sacc = conv2(acc,h,'same');
%sacc = conv2pad(acc,h);
% select MIC (Maximum Isocenter)
[tmp,i] = max(sacc);
[~,j] = max(tmp);
ymic = i(j);
xmic = j;
% cluster -> gradient ascend to other true center (e.g. use mean shift)
% ...
% verify eye center location (e.g. with SIFT)
% ...
% set output eye center x and y coordinates
ecx = xmic;
ecy = ymic;