How to add Gaussian noise to an image?

拥有回忆 提交于 2019-12-06 08:04:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!