geteyelocation.m

来自「It is for Face Recognition」· M 代码 · 共 29 行

M
29
字号
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function getEyeLocation()
%   z.li, 09-09-2004
%   get eye locations by manual labeling
% function dependency:
%   - n/a
% input:
%   img    - image
%   nFace  - how many faces
% output:
%   eyes   - nFace x 4 location data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%function [eyes]=getEyeLocation(img, nFace)
function [eyes]=getEyeLocation(img, nFace)

imshow(img, [0, 255]); hold on;
eyes = zeros(nFace, 4); 
% get eye locations
for k=1:nFace
  [lx ly]=ginput(1); 
  lx = fix(lx); ly=fix(ly); plot(lx, ly, '+r'); 
  fprintf('\n left eye at: [%d %d]', lx, ly);
  [rx ry]=ginput(1); 
  rx = fix(rx); ry = fix(ry); plot(rx, ry, '+m');
  fprintf('\n right eye at: [%d %d]', rx, ry);
  eyes(k,:)=[lx ly rx ry];
end

eyes = fix(eyes);

⌨️ 快捷键说明

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