mkline.m
来自「来自澳大利亚Qeensland大学的计算机视觉Matlab工具箱。 This 」· M 代码 · 共 43 行
M
43 行
%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 + =
减小字号Ctrl + -
显示快捷键?