⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initdist.m

📁 这是一个利用水平集方法进行分割的方法
💻 M
字号:
function newphi = initdist( phi, front )% INITDIST Reinitialize to signed distance function%    INITDIST( phi, front ) Reinitializes all points in phi to the%    signed distance of the point to the front.% grab the size of phi[ m, n ] = size( phi );% grab the total number of front pointsn_front = size( front, 1 );% fill the new phi function with zeros to startnewphi = zeros( size( phi ) );% if there are no front points then returnif( n_front == 0 )  return;end% for every pixelfor i = 2 : m - 1;  for j = 2 : n - 1;    % find the front pixel it is closest to    closest_dist = inf;    for k = 1 : n_front;      dist = sum( ( front( k, : ) - [ i, j ] ).^2 );      if( dist < closest_dist )	closest_dist = dist;      end;    end;    % and reinitialize the distance    newphi( i, j ) = sign( phi( i, j ) ) * ceil( sqrt( closest_dist ) );  end;end;

⌨️ 快捷键说明

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