boundmirrorexpand.m

来自「gvf snake 范例程式,以matlab撰写」· M 代码 · 共 32 行

M
32
字号
function B = BoundMirrorExpand(A)% Expand the matrix using mirror boundary condition% % for example %% A = [%     1  2  3  11%     4  5  6  12%     7  8  9  13%     ]%% B = BoundMirrorExpand(A) will yield%%     5  4  5  6  12  6%     2  1  2  3  11  3%     5  4  5  6  12  6 %     8  7  8  9  13  9 %     5  4  5  6  12  6%% Chenyang Xu and Jerry L. Prince, 9/9/1999% http://iacl.ece.jhu.edu/projects/gvf[m,n] = size(A);yi = 2:m+1;xi = 2:n+1;B = zeros(m+2,n+2);B(yi,xi) = A;B([1 m+2],[1 n+2]) = B([3 m],[3 n]);  % mirror cornersB([1 m+2],xi) = B([3 m],xi);          % mirror left and right boundaryB(yi,[1 n+2]) = B(yi,[3 n]);          % mirror top and bottom boundary

⌨️ 快捷键说明

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