facelocation.m

来自「eye detection sample in matlab. Eyetrack」· M 代码 · 共 21 行

M
21
字号
function [pos,s] = facelocation(p,s)
    s=s(:,find(p(:,3)>0.2));
    p=p(find(p(:,3)>0.2),:);
    p=[p s'];% attaching samples to every face positive-p 
    p=sortrows(p,3);
    p=p(size(p,1):-1:1,:);
    
    %optional: if there are other "facelike" in the area of the face -> delete them
    for i=1:size(p,1)-1
        oldsize=size(p,1);
        tmp=p(1,:);
        p=[tmp;p(find((abs(p(:,1)-tmp(1,1))>10)|abs((p(:,2)-tmp(1,2)))>10),:)];
        if (size(p,1) == oldsize)
            break
        end
    end
    
    pos=p(:,1:2);%pos=[posy,posx]
    s=p(:,4:size(p,2));
    s=s';
    

⌨️ 快捷键说明

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