1

I am writing a code to augment the image by injecting noise in it. I got the code for Gaussian, Speckle, Salt and Pepper, etc but I could not find how to add Poisson noise? Some people use is at image + mask but the thing is that I don't think it is additive in nature just like Gaussian noise. I think doing the thing below won't make any sense:

noise_mask = numpy.random.poisson(img)
noisy_img = img + noise_mask

But I can do the same for Gaussian Noise where I can control the amount of noise by changing the Standard Deviation (Can I change Mean too?):

def gauss(img): # img is numpy array image
    gauss = np.random.normal(0,1,img.size) # mean=0, std=1
    gauss = gauss.reshape(img.shape[0],img.shape[1],img.shape[2])
    return img + gauss

So I found a code for Poisson which does this:

def poisson(img):
    vals = len(np.unique(img))
    vals = 2 ** np.ceil(np.log2(vals))
    return np.random.poisson(img * vals) / float(vals)
  1. Is this the right approach?
  2. How can I control the amount of Noise here?
Deshwal
  • 3,436
  • 4
  • 35
  • 94
  • You change the mean of the Gaussian using the `loc` parameter, [numpy.random.normal](https://numpy.org/doc/stable/reference/random/generated/numpy.random.normal.html), which by default is at `0.0` – DrBwts Apr 04 '21 at 10:53
  • Yeah Gauss I know but `Poiss`? – Deshwal Apr 04 '21 at 10:56
  • In my previous project [such approach](https://stackoverflow.com/a/36331042/6818619) of creating Poisson noise was enough. – ans Apr 05 '21 at 11:56

0 Answers0