lutspur.m
来自「有关matlab的电子书籍有一定的帮助希望有用」· M 代码 · 共 87 行
M
87 行
function lut = lutspur
%LUTSPUR End-point detection lookup tables for bwmorph(BW,'spur').
% LUT = LUTSPUR returns a 512-by-1 matrix containing a lookup
% table. The lookup table is designed to find end-points in a
% complemented image; that is, an image where 0 represents a
% foreground pixel and 1 represents a background pixel.
%
% See also BWMORPH.
% Steven L. Eddins, January 1997
% Copyright 1993-1998 The MathWorks, Inc. All Rights Reserved.
% $Revision: 1.5 $ $Date: 1997/11/24 15:56:37 $
% Here's the test for each neighborhood:
% isEastEndPoint = (x(2,1)==0) & (x(2,2)==0) & (x(1,2)==1) & ...
% (x(1,3)==1) & (x(2,3)==1) & (x(3,2)==1) & (x(3,3)==1);
%
% isSouthEndPoint = (x(1,2)==0) & (x(2,2)==0) & (x(2,1)==1) & ...
% (x(2,3)==1) & (x(3,1)==1) & (x(3,2)==1) & (x(3,3)==1);
%
% isWestEndPoint = (x(2,2)==0) & (x(2,3)==0) & (x(1,1)==1) & ...
% (x(1,2)==1) & (x(2,1)==1) & (x(3,1)==1) & (x(3,2)==1);
%
% isNorthEndPoint = (x(2,2)==0) & (x(3,2)==0) & (x(1,1)==1) & ...
% (x(1,2)==1) & (x(1,3)==1) & (x(2,1)==1) & (x(2,3)==1);
%
% isSoutheastEndPoint = (x(2,2)==0) & (x(1,1)==0) & (sum(x(:))==7);
%
% isSouthwestEndPoint = (x(2,2)==0) & (x(1,3)==0) & (sum(x(:))==7);
%
% isNorthwestEndPoint = (x(2,2)==0) & (x(3,3)==0) & (sum(x(:))==7);
%
% isNortheastEndPoint = (x(2,2)==0) & (x(3,1)==0) & (sum(x(:))==7);
%
% isEndPoint = isEastEndPoint | isSouthEndPoint | isWestEndPoint | ...
% isNorthEndPoint | isSoutheastEndPoint | isSouthwestEndPoint | ...
% isNorthwestEndPoint | isNortheastEndPoint;
lut = [ ...
0 0 0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0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 0 ...
0 0 0 0 0 0 1 1 1 1 0 1 ...
1 1 1 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0];
lut = lut(:);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?