How can I add gaussian noise to image that are of class double in the range [0, 255]?

10 vues (au cours des 30 derniers jours)
Hi all,
I have this (I) image which are of class double in the range [0, 255] : {I.mat in the attachments}
I want to add noise using gaussian methods and I can specify a different set of parameters.
List of method to add noise (based on Matlab’s imnoise function):
o params(1) represents the mean of noise for idle pixels
o params(2) represents the variance of noise for idle pixels
o params(3) represents the mean of noise for busy pixels
o params(4) represents the variance of noise for busy pixels
Note: The mean and variance parameters for 'gaussian' in Matlab’s imnoise function are always specified as if the image were of class double in the range [0, 1] – however I has [0, 255].
could you please help me??

Réponse acceptée

Sourav Bairagya
Sourav Bairagya le 17 Déc 2019
Modifié(e) : Sourav Bairagya le 17 Déc 2019
The 'imnoise' function expects input pixel values of data type 'double' and 'single' to be in the range [0, 1]. It also accepts the input of datatype 'uint8' in the range [0,255]. You can use the rescale function to adjust pixel values to the expected range. If any input pixel is of datatype 'double' or 'single' and lies outside [0,1], 'imnoise' function clips that to the expected range before adding noise.
You may convert your image to 'uint8' format and then can feed that to 'imnoise' function.
I = uint8(I);
For more information you can leverage this link:

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by