简体   繁体   English

如何为图像添加高斯噪声?

[英]How to add Gaussian noise to an image?

How to add a certain amount of Gaussian noise to the image in python? 如何在python中为图像添加一定量的高斯噪声? Do I need to convert somehow the values of the image to double type or something else? 我是否需要以某种方式将图像的值转换为double类型或其他类型?

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. 一个根据dB(分贝)添加它,而其他人考虑方差。 How it is related and how should I measure the noise level? 它是如何相关的,我该如何测量噪音水平?

You can use the random_noise function in scikit-image. 您可以在scikit-image中使用random_noise函数。 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 你可以在这里阅读更多相关信息: 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. Pillow(Python Image Library fork)支持许多图像处理方法,包括高斯模糊。 The ImageFilter module in particular implements this. ImageFilter模块特别实现了这一点。

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). dB通常与高斯滤波器相关(至少在可以作用于输入信号的“高斯”事物的主题上),如在数字信号处理(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. 在谈论DSP中的信号时,谈论滤波器响应的dB以及通常只是比较信号更为自然。 I'm assuming this is not what you're talking about. 我假设这不是你所说的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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