immove.m
来自「image thresholding otsu method」· M 代码 · 共 37 行
M
37 行
function im2 = immove(im, xdir, ydir)
%
% Warning: xdir and ydir are reversed
% (they refer to the rows and columns respectively)
%
xs = size(im,1);
ys = size(im,2);
zs = size(im,3);
im2 = zeros(xs, ys, zs);
x = xs - abs(xdir) -1;
y = ys - abs(ydir) -1;
if (xdir <= 0)
stx = 1;
stx2 = -xdir+1;
else
stx = xdir+1;
stx2 = 1;
end
if (ydir <= 0)
sty = 1;
sty2 = -ydir+1;
else
sty = ydir+1;
sty2 = 1;
end
im2(stx:stx+x,sty:sty+y,:) = im(stx2:stx2+x,sty2:sty2+y,:);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?