问题
How to add a certain amount of Gaussian noise to the image in python? Do I need to convert somehow the values of the image to double type or something else?
Also, I have doubts about measuring the level of noise in the image. One adds it according to the dB (decibels) while other considers the variance. How it is related and how should I measure the noise level?
回答1:
You can use the random_noise
function in scikit-image. It goes something like this:
skimage.util.random_noise(image, mode='gaussian', seed=None, clip=True, **kwargs)
You can read more about it here: http://scikit-image.org/docs/stable/api/skimage.util.html#random-noise
回答2:
I'm assuming you mean applying a Gaussian blur. Pillow (a Python Image Library fork) supports a lot of image processing methods, including Gaussian blur. The ImageFilter module in particular implements this.
As for how to measure the level of noise--that's a somewhat complicated question. The concepts of radius and variance are mostly related (this post discusses it to some degree). In practicality, for picking the right parameter here for image processing, theory is all well and good but I've found guess and try to be the best way here.
dB is generally related to Gaussian filters (at least on the topic of "Gaussian" things that can act on input signals), as in digital signal processing (DSP). Gaussian blur/filter are similar concepts as convolutions on input signals, but discussed in different domains. When talking about signals in DSP, it's a bit more natural to talk about dB for the filter response... as well as just comparing signals generally. I'm assuming this is not what you're talking about.
来源:https://stackoverflow.com/questions/33327711/how-to-add-gaussian-noise-to-an-image