plotfaces.m

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

M
49
字号
function []=plotFaces(faces, lEyes, rEyes, mouths, thresFaceProb, pcolor)

  hold on;
  nLEye = length(lEyes(1,:));
  nREye = length(rEyes(1,:));
  nMouth = length(mouths(1,:));
  nFace = length(faces(1,:));

  allx = [lEyes(3,:) rEyes(3,:) mouths(3,:)];
  ally = [lEyes(4,:) rEyes(4,:) mouths(4,:)];
  xmin = min(allx);
  xmax = max(allx);
  ymin = min(ally);
  ymax = max(ally);

  axis([xmin-5 xmax+5 ymin-5 ymax+5]);

  for j=1:nLEye
    plot(lEyes(3,j), lEyes(4,j), 'Or');
    plot(lEyes(3,j), lEyes(4,j), '+r');
  end

  for k=1:nREye
    plot(rEyes(3,k), rEyes(4,k), 'Ob');
    plot(rEyes(3,k), rEyes(4,k), '*b');
  end

  for t=1:nMouth
    plot(mouths(3,t), mouths(4,t), '^k');
  end

  styl = sprintf(':%s', pcolor);
  for i=1:nFace
    if faces(1,i) > thresFaceProb
       % plot eye pair line
       px=[faces(3,i) faces(5,i)];py=[faces(4,i) faces(6,i)];
       plot(px, py, '.', px, py, styl);
       % plot left eye-mouth line
       px=[faces(3,i) faces(7,i)];py=[faces(4,i) faces(8,i)];
       plot(px, py, '.', px, py, styl);
       % plot right eye-mouth line
       px=[faces(5,i) faces(7,i)];py=[faces(6,i) faces(8,i)];
       plot(px, py, '.', px, py, styl);    
    end
  end

  return;

⌨️ 快捷键说明

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