📄 mkline.m
字号:
%MKLINE Draw a line in a matrix%% m = MKLINE(n, theta, c)% m = MKLINE(n, theta, c, val)%% m = MKLINE(im, theta, c)% m = MKLINE(im, theta, c, val)%% First form creates an NxN matrix of zeros and draws a line % with vertical intercept C and angle THETA. With the Xaxis to the left% and Yaxis downward, the Zaxis is into the screen.% Each pixel on the line is set to VAL (default 1).%% The second form draws the line into an already existing matrix IM.%% SEE ALSO: ihough, xyhough%% Copyright (c) Peter Corke, 1999 Machine Vision Toolbox for Matlabfunction im = mkline(n, theta, c, val) if ismatrix(n), im = n; [nr,nc] = size(im); else im = zeros(n, n); nr = n; nc = n; end if nargin < 4, val = 1; end x = 1:nc; y = round(x*tan(theta) + c); s = find((y >= 1) & (y <= nr)); for k=s, im(y(k),x(k)) = val; end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -