genrandomrects.m
来自「SparseLab is a Matlab software package d」· M 代码 · 共 22 行
M
22 行
function I = GenRandomRects(n,k);
% This function generates an nxn image of k random rectangles
I = zeros(n);
for j = 1:k
x1 = floor(rand * n);
x2 = floor(x1 + rand * (n - x1));
y1 = floor(rand * n);
y2 = floor(y1 + rand * (n - y1));
I(y1:y2,x1:x2) = I(y1:y2,x1:x2) + rand * ones(y2-y1+1, x2-x1+1);
end
%% Part of SparseLab Version:100% Created Tuesday March 28, 2006% This is Copyrighted Material% For Copying permissions see COPYING.m% Comments? e-mail sparselab@stanford.edu%
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?