mksq.m

来自「这是一个基于MATLAB的机器视觉工具箱,里面用很多非常有价值的的程序」· M 代码 · 共 26 行

M
26
字号
%MKSQ	Make a test pattern comprising squares%%	im = MKSQ(w, numsq)%%	Create a square output image (W x W) with NUMSQ filled squares along %	the diagonal.  Pixels in the squares are set to one, all others to zero.%% SEE ALSO:	mkline, ihough, xyhough%%	Copyright (c) Peter Corke, 1999  Machine Vision Toolbox for Matlab% 1997 Peter Corkefunction im = mksq(w, nsq)	im = zeros(w,w);	% make the image	k = 2^(nsq+1);		% a useful quantity	ws = w / k;		% each square is 2ws x 2ws	for j=1:4:k,		% for each square		l = j*ws;		% left coord		r = (j+2)*ws-1;		% right coord		im(l:r,l:r) = ones(2*ws,2*ws);	% then fill it	end		

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?