clean_model.m

来自「基于MATLAB的人脸检测程序」· M 代码 · 共 22 行

M
22
字号
% cleans the edges of the model image after it has been rotated.
function model = clean_model(model)

[m n] = size(model);

% cleans from left to right
 for i=1:m,
    nfound = 0;
    for j=1:n,
      if (model(i,j) < 95 & nfound == 0) model(i,j) = 0; end;
      if (model(i,j) >=95 & nfound == 0) nfound=1; end;
    end;
 end;
  % cleans from right to left
 for i=1:m,
   nfound = 0;
   for j=n:-1:1,
      if (model(i,j) < 80 & nfound == 0) model(i,j) = 0; end;
      if (model(i,j) >=80 & nfound == 0) nfound=1; end;
   end;
 end;

⌨️ 快捷键说明

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