📄 isband.m
字号:
function band = isband( phi, front, width )
% CALCBAND Determine which points are within narrow band
% CALCBAND( phi, front, width ) Based on the indices of the
% front points, determine which pixels of phi are within a
% narrow band of width 'width' of the front points. Return a
% boolean matrix the same size as phi.
% grab size of phi
[ m, n ] = size( phi );
% precompute width squared to save computations later
widthsq = width^2;
% retrieve indices of and total number of front points
n_front = size( front, 1 );
% create an boolean matrix whose value at each pixel is 0 or 1
% depending on whether that pixel is a band point or not
band = zeros( m, n );
% for each pixel in phi
for ii = 1 : m;
for jj = 1 : n;
% check if it is within 'width' of a front pixel
closest_dist = inf;
for k = 1 : n_front;
dist = sum( ( front( k, : ) - [ ii, jj ] ).^2 );
if( dist < widthsq )
band( ii, jj ) = 1;
break;
end;
end;
end;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -