📄 icircle.m
字号:
%ICIRCLE Create circular structuring element%% S = ICIRCLE(R)% S = ICIRCLE(R, W)%% Return a square matrix of zeros with a central circular region of % radius R of ones. Matrix size is (2R+1) x (2R+1) or WxW.%% If R is a 2-element vector then it returns an annulus of ones, and% the two numbers are interpretted as inner and outer radii.%%% Copyright (c) Peter Corke, 1999 Machine Vision Toolbox for Matlab% pic 3/95%function s = icircle(r, w) if ismatrix(r) rmax = max(r(:)); rmin = min(r(:)); else rmax = r; end if nargin == 1, w = 2*rmax+1; c = rmax+1; else c = ceil(w/2); end s = zeros(w,w); if ismatrix(r) s = circle(rmax,w) - circle(rmin, w); else [x,y] = find(s == 0); x = x - c; y = y - c; l = find(sqrt(x.^2+y.^2) <= r); s(l) = ones(length(l),1); end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -