How to add Rician noise to an image?

20 vues (au cours des 30 derniers jours)
JayD
JayD le 3 Déc 2015
Modifié(e) : DGM le 9 Avr 2023
Hi, I am simulating some MR images for my project. I am not sure about adding image to each real and imaginary channel. OR should it be the projection of image to each channel? Can anyone please verify or give a proper method? So far I did this,
N = 10; % changing N can control SNR
Ii = randn(256)*N + img; % imaginary channel
Ir = randn(256)*N + img; % real channel
noisyimage = sqrt(Ii.^2 + Ir.^2);

Réponses (3)

JayD
JayD le 14 Déc 2015
I figured out how to add rician noise to an image and share it with those who are interested. Let image be 256x256 matrix, the image we want to add rician noise.
realchannel = normrnd(0,N,256,256) + image; % N is the gaussian noise level
imaginarychannel = normrnd(0,N,256,256);
noisyimage = sqrt(realchannel.^2 + imaginarychannel.^2); % now the image has Rician distributed noise.
  1 commentaire
Image Analyst
Image Analyst le 14 Déc 2015
Why are you calling them real and imaginary? There are no imaginary or complex variables there. All your variables are real. Simply calling it imaginarychannel does not make it imaginary, obviously.

Connectez-vous pour commenter.


Mehri Mehrnia
Mehri Mehrnia le 8 Avr 2023
Déplacé(e) : DGM le 8 Avr 2023
what you have done looks wrong for me. if you ignore imaginary part of image then noisy image is same as original one.

DGM
DGM le 8 Avr 2023
Modifié(e) : DGM le 9 Avr 2023
I don't have a reference to test against, but just looking around it seems right. I'm assuming that the goal is to literally treat it as additive noise as one would do with Gaussian noise. I'm not familiar with the application, so this is my assumption.
% parameters (assuming image data is unit-scale)
v = 0.1;
sg = 0.1;
% get an image
inpict = imread('cameraman.tif');
% generate the noise
sz = size(inpict);
noise = v/sqrt(2) + sg*randn([prod(sz) 2]); % bivariate normal RN
noise = sqrt(sum(noise.^2,2)); % magnitude
noise = reshape(noise,sz); % reshape to match the image
% add noise to image
outpict = im2double(inpict) + noise;
imshow(outpict)
EDIT: It does seem to check fine against randraw('rice',...), so I'm going to assume it's correct.
EDIT AGAIN: According to this, I'm wrong. The noise isn't additive. The signal is the distance vector V. So then we have this:
% parameters (assuming image data is unit-scale)
sg = 0.05;
% get an image
inpict = imread('cameraman.tif');
% generate the noise
sz = size(inpict);
noise = sg*randn([prod(sz) 2]); % bivariate zero-mean normal RN
noise(:,1) = noise(:,1) + im2double(inpict(:)); % signal is distance vector
noise = sqrt(sum(noise.^2,2)); % magnitude
% reshape to match the input
outpict = reshape(noise,sz);
imshow(outpict)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by