0
我只是想知道如何在matlab图像处理中使用randseed
而不是randn
。随机数字分布
我想稍后使用x,y的质心来映射对象随时间的位置。
此外,我可以使用什么函数让生成的值能够这样做?
clear all
% Define image size
N = 300;
%define Initial object point
X = 150;
Y = 150;
%Number of frames
duration = 10;
for T=1:duration
% Set up rand image. Process and measurement noise
Image = 0.4*rand(N); %distabunce
% Define object position & size
X = X+10*randn;
Y = Y+10*randn;
Size_radius = 5;
filter = BuildFilter(Size_radius);
for i = 1:N
for j = 1:N
if (sqrt((i-X).^2+(j-Y).^2) < Size_radius)
Image(i,j) = 1;
end
end
end
figure(1)
%subplot(2,2,1)
title('Caption1')
imagesc(Image);
colormap(gray);
axis image;
pause(0.1);
end
什么你想通过替换randn来实现吗? – Daniel
是的,所以我可以在模拟程序时使用相同的随机数字,我被告知randseed会是最好的选择 – user3473912