%%
clear;
clc;
lennaIm = imread("lenna.tif");
noiseIm = unifrnd(0,64,size(lennaIm));
lennaNoised = uint8(lennaIm + uint8(noiseIm));%% 0-64之間的均勻分佈。
figure
imshow(lennaNoised);
noiseIm = gamrnd(64,1,size(lennaIm)); %64有點類似於高斯分佈的mu,1是控制機率密度有點像高斯分佈。
%%
clear;
clc;
lennaIm = imread("lenna.tif");
noiseIm = unifrnd(0,64,size(lennaIm));
lennaNoised = uint8(lennaIm + uint8(noiseIm));%% 0-64之間的均勻分佈。
figure
imshow(lennaNoised);
%%
clear;
clc;
lennaIm = imread("lenna.tif");
noiseIm = gamrnd(64,1,size(lennaIm)); %64有點類似於高斯分佈的mu,1是控制機率密度有點像高斯分佈。
lennaNoised = uint8(lennaIm + uint8(noiseIm));%% 0-64之間的均勻分佈。
figure
imshow(lennaNoised);