📄 isfront.m
字号:
function front = isfront( phi )% ISFRONT Determine whether a pixel is a front point% ISFRONT( phi ) return binary matrix whose value at each pixel% represents whether the corresponding pixel in phi is a front% point or not.% grab the size of phi[ n, m ] = size( phi );% create an boolean matrix whose value at each pixel is 0 or 1% depending on whether that pixel is a front point or notfront = zeros( size( phi ) );% A piecewise linear approximation to the front is contructed by% checking each pixels neighbour. Do not check pixels on border.for i = 2 : n - 1; for j = 2 : m - 1; % if there is a sign change then we have a front point maxVal = max( max( phi( i:i+1, j:j+1 ) ) ); minVal = min( min( phi( i:i+1, j:j+1 ) ) ); front( i, j ) = ( ( maxVal > 0 ) & ( minVal < 0 ) ) | phi( i, j ) == 0; endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -