简体   繁体   中英

How to add Gaussian noise to an image?

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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM