📄 filter_bwmorph.m
字号:
function varargout = filter_bwmorph(varargin)
if nargin == 0
p1 = struct( ...
'Name', 'Operation', ...
'Style', 'popup', ...
'DefaultValue', 1, ...
'Items', {{ ...
'Bottom hat', ...
'Bridge unconnected pixels.', ...
'Clean isolated pixels', ...
'Close', ...
'Diagonal fill', ...
'Dilaton', ...
'Erosion', ...
'Fills isolated interior pixels', ...
'Removes H-connected pixels', ...
'Majority', ...
'Open', ...
'Remove interior pixels', ...
'Shrinks objects to points', ...
'Skeleton', ...
'Remove spur pixels', ...
'Thicken', ...
'Thin', ...
'Top hat' ...
}} );
p2 = struct( ...
'Name', 'Repeat times (0 as Inf)', ...
'Style', 'integer', ...
'DefaultValue', 1, ...
'Max', 16, ...
'Min', 0, ...
'LargeStep', 2, ...
'SmallStep', 1);
P = struct( ...
'FilterName', 'Morphological operations', ...
'AvailableImageType', [0 1 0 0 0], ...
'Class', 'morphological', ...
'ParameterNumber', 2, ...
'Parameters', { {p1, p2} });
varargout{1} = P;
else
CX = varargin{1};
oper = {'bothat','erode','shrink','bridge','fill','skel','clean',...
'hbreak','spur','close','majority','thicken','diag','open','thin', ...
'dilate','remove','tophat'};
FUNPARA = varargin{2};
if FUNPARA{2} == 0
if FUNPARA{1}==13|FUNPARA{1}==14|FUNPARA{1}==16|FUNPARA{1}==17
rt = inf;
else
rt = 1;
end
else
rt = FUNPARA{2};
end
varargout{1} = bwmorph(CX, oper{FUNPARA{1}}, rt);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -