I=imread('C:\Users\wangd\Desktop\result3.png'); % m = rgb2gray(I); % r = unidrnd(255,1,100); %产生一个1*100的数组,数组中的值为1至255中的随机值 % r1 = randi([2,7],10,100); %在开区间(2,7)生成10 * 100型随机矩阵 subplot(2,2,1);imshow(I); title('原始图像'); for w=1:200 j= randi([1,350],1,1); i= randi([1,400],1,1); x= randi([200,255],1,1); I(j,i)=x; end subplot(2,2,2);imshow(I); title('图像'); imwrite(I,'C:\Users\1.png');
标签:randi,更改,像素,随机,matlab,100,255 From: https://www.cnblogs.com/bbhhh/p/17867853.html