⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 locate.asv

📁 eye detection sample in matlab. Eyetrackers can analyze a driver’s level of attentiveness while driv
💻 ASV
字号:
function [y,x,val] = locate(im,facepart)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% this function locates a face part (left eye, right eye, nose, mouth) 
% in a face 
% reminder: in the eyes, noses ,mouth and nb SVM the picture should be in [0-1] scale
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% load SVM parameters
load EC;
x=[];
y=[];
if (facepart == 1)
    start = round([15 10]./[50 50].*size(im));
    stop  = round([27 35]./[50 50].*size(im));
    compw=13;comph=18;
    C=NC;
    clear NC EC NBC MC;
end;
if (facepart == 2)
    start = round([25 5]./[50 50].*size(im));
    stop  = round([37 22]./[50 50].*size(im));
    if size(im,2) < start(1,2)+27, start(1,2)=size(im,2)-27;
    end
    comph = 13;
    compw = 27;
    C=MC;
    clear NC EC NBC MC;
    
end


if (facepart == 3)
    start = [1 1];
    stop  = round([20 16]./[50 50].*size(im));
    comph=15;compw=15;
    C=EC;
    clear NC EC NBC MC;    
end

if (facepart == 4)
    start = round([0 25]./[50 50].*size(im)+[1 1]);
    stop  = round([20 35]./[50 50].*size(im));
    if size(im,2) < start(2)+15, start(2)=size(im,2)-15;
    end
    comph=15;compw=15;
    C=EC;
    clear NC EC NBC MC;    
end

if (facepart == 5)
    start = round([0 10]./[50 50].*size(im)+[1 1]);
    stop  = round([12 25]./[50 50].*size(im));
    comph=14;compw=16;
    C=NBC;
    clear NC EC NBC MC;    
end


search_im = uint8(im(start(1)+1:stop(1)+comph-2,start(2)+1:stop(2)+compw-2)*255);
search_pos = zeros(size(search_im));
search_pos(1:2:size(search_im,1),1:2:size(search_im,2))=1;
search_pos = uint8(search_pos);
[test,y,x]=comphisteq(search_im,search_pos,comph,compw);
y = double(y)+start(1)-1;
x = double(x)+start(2)-1;
test = double(test)/255;
[l,sc] = osuSVMclass(test,C.n, C.alpha, C.sv,C.b, C.params);

[val,linpos] = max(sc);
x = double(x(linpos));
y = double(y(linpos));

search_pos = zeros(size(search_im));
search_pos(y-1:1:y+1,x-1:1:x+1)=1;
    
        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -