imrect.m

来自「用人工神经网络进行人脸识别」· M 代码 · 共 18 行

M
18
字号
function M = imrect(I,ltx,lty,rbx,rby)
% This function draws rectangles on a grayscale image I
% where ltx(i), lty(i): left top point(x,y) and
% rbx(i), rby(i): right bottom point(x,y)
% and returns M, the image matrix with rectangles drawn.

len = length(ltx);
for i=1:len
   for p=ltx(i):rbx(i)
      I(lty(i),p) = 0;
      I(rby(i),p) = 0;
   end
   for p=lty(i):rby(i)
      I(p,ltx(i)) = 0;
      I(p,rbx(i)) = 0;
   end
end
M = I;

⌨️ 快捷键说明

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