📄 extendspeedband.m
字号:
function speed = extendspeedband( speed, front, band )% EXTENDSPEEDBAND Extends speed to non-front points% EXTENDSPEEDBAND( speed, front ) Extends speed function to% all pixels in a narrow band around 'front' given by the% indices in 'band'. For each band pixel, its speed is% the same as the speed of the closest front pixel.% grab the size of the speed matrix[ m, n ] = size( speed );% grab the total number of front and band pointsn_front = size( front, 1 );n_band = size( band, 1 );% for every pixel in the bandfor ii = 1 : n_band; % grab the coordinates of the band pixel i = band( ii, 1 ); j = band( ii, 2 ); % find the front pixel it is closest to closest_dist = inf; closest_pt = front( 1, : ); for kk = 1 : n_front; dist = sum( ( front( kk, : ) - [ i, j ] ).^2 ); if( dist < closest_dist ) closest_dist = dist; closest_pt = front( kk, : ); end; end; % and copy its speed speed( i, j ) = speed( closest_pt( 1 ), closest_pt( 2 ) );end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -