高斯平滑

article/2025/11/7 14:06:46


高斯平滑

Common Names: Gaussian smoothing

简述:

高斯平滑操作是一种2-D的卷积操作,应用于模糊图像中,去除细节和噪声。从这个意思上说,它类似于均值滤波器,但是使用的是不同的内核,表示高斯驼峰形状(钟形)。这个内核具有一些特殊的性质,具体说明如下:

如何实现:

一维高斯分布形式:

Eqn:eqngaus1

Eqn:eqnsigma是分布的标准偏差,我们也可以假设分布的均值为0,(即,它的中心位于线x = 0上)。图1可以说明其分布情况。

Figure 1 1-D Gaussian distribution with mean 0 andEqn:eqnsigma=1

在二维情况下,同向高斯公式(即圆对称)为:

Eqn:eqngaus2

分布情况如图2所示:


Figure 2 2-D Gaussian distribution with mean (0,0) andEqn:eqnsigma=1

高斯平滑的思想就是使用2维分布作为点扩展函数,可以通过卷积实现。因为图像存储为离散像素的集合,因此,在执行卷积之前,需要把高斯函数进行离散近似。理论上,高斯分布在任何地方都是非零的,这需要无限大的卷积核,实际中,0值比平均的三个标准差更为有效,所以在这一点上我们可以缩短内核。图3示出了一个合适的整数值卷积核,近似于Eqn:eqnsigma=1.0 时的高斯分布。这并不能明显的表示如何挑选近似高斯分布表面值。唯一可以用到的是高斯表面中央像素值,但是,这是不精确的,因为像素值对于高斯变化是非线性的。整合所有像素上的高斯值(求和高斯在0.001增量) 。积分不是整体:重新调整数组的值,使角点的取值为1。最终,表面上所有点的像素值的和为273.

Figure 3 Discrete approximation to Gaussian function withEqn:eqnsigma=1.0

一旦计算出合适的核,高斯平滑可以利用标准的卷积方法实现。事实上,卷积可以快速的实现,2维同向高斯公式如上面显示,可以分为x和y方向上的分量。2维卷积可以首先通过x方向上求卷积,然后在y方向上求卷积执行得到。(事实上,高斯平滑就是完整的园对称操作按同样的方式进行分解。)图4示出了一维x分量内核,图可以生成如图3所示的完整的内核。


Gaussian Smoothing

Common Names: Gaussian smoothing

Brief Description

The Gaussian smoothing operator is a 2-D convolution operator that is used to `blur' images andremove detail and noise. In this sense it is similar to themean filter, but it uses a differentkernel that represents the shape of a Gaussian (`bell-shaped') hump. This kernel has some special properties which are detailed below.

How It Works

The Gaussian distribution in 1-D has the form:

Eqn:eqngaus1

where Eqn:eqnsigma is the standard deviation of the distribution. We have also assumed that the distribution has a mean of zero (i.e. it is centered on the line x=0). The distribution is illustrated in Figure 1.




Figure 1 1-D Gaussian distribution with mean 0 and Eqn:eqnsigma=1


In 2-D, an isotropic (i.e. circularly symmetric) Gaussian has the form:

Eqn:eqngaus2

This distribution is shown in Figure 2.




Figure 2 2-D Gaussian distribution with mean (0,0) and Eqn:eqnsigma=1


The idea of Gaussian smoothing is to use this 2-D distribution as a `point-spread' function, and this is achieved by convolution. Since the image is stored as a collection of discrete pixels we need to produce a discrete approximation to the Gaussian function before we can perform the convolution. In theory, the Gaussian distribution is non-zero everywhere, which would require an infinitely large convolution kernel, but in practice it is effectively zero more than about three standard deviations from the mean, and so we can truncate the kernel at this point. Figure 3 shows a suitable integer-valued convolution kernel that approximates a Gaussian with aEqn:eqnsigma of 1.0. It is not obvious how to pick the values of the mask to approximate a Gaussian. One could use the value of the Gaussian at the centre of a pixel in the mask, but this is not accurate because the value of the Gaussian varies non-linearly across the pixel. We integrated the value of the Gaussian over the whole pixel (by summing the Gaussian at 0.001 increments). The integrals are not integers: we rescaled the array so that the corners had the value 1. Finally, the 273 is the sum of all the values in the mask.




Figure 3 Discrete approximation to Gaussian function with Eqn:eqnsigma=1.0


Once a suitable kernel has been calculated, then the Gaussian smoothing can be performed using standardconvolution methods. The convolution can in fact be performed fairly quickly since the equation for the 2-D isotropic Gaussian shown above is separable intox andy components. Thus the 2-D convolution can be performed by first convolving with a 1-D Gaussian in thex direction, and then convolving with another 1-D Gaussian in they direction. (The Gaussian is in fact theonly completely circularly symmetric operator which can be decomposed in such a way.) Figure 4 shows the 1-Dx component kernel that would be used to produce the full kernel shown in Figure 3 (after scaling by 273, rounding and truncating one row of pixels around the boundary because they mostly have the value 0. This reduces the 7x7 matrix to the 5x5 shown above.). They component is exactly the same but is oriented vertically.




Figure 4 One of the pair of 1-D convolution kernels used to calculate the full kernel shown in Figure 3 more quickly.


A further way to compute a Gaussian smoothing with a large standard deviation is to convolve an image several times with a smaller Gaussian. While this is computationally complex, it can have applicability if the processing is carried out using a hardware pipeline.

The Gaussian filter not only has utility in engineering applications. It is also attracting attention from computational biologists because it has been attributed with some amount of biological plausibility,e.g. some cells in the visual pathways of the brain often have an approximately Gaussian response.

Guidelines for Use

The effect of Gaussian smoothing is to blur an image, in a similar fashion to themean filter. The degree of smoothing is determined by the standard deviation of the Gaussian. (Larger standard deviation Gaussians, of course, require larger convolution kernels in order to be accurately represented.)

The Gaussian outputs a `weighted average' of each pixel's neighborhood, with the average weighted more towards the value of the central pixels. This is in contrast to the mean filter's uniformly weighted average. Because of this, a Gaussian provides gentler smoothing and preserves edges better than a similarly sized mean filter.

One of the principle justifications for using the Gaussian as a smoothing filter is due to itsfrequency response. Most convolution-based smoothing filters act aslowpass frequency filters. This means that their effect is to remove high spatial frequency components from an image. The frequency response of a convolution filter,i.e. its effect on different spatial frequencies, can be seen by taking theFourier transform of the filter. Figure 5 shows the frequency responses of a 1-D mean filter with width 5 and also of a Gaussian filter withEqn:eqnsigma = 3.




Figure 5 Frequency responses of Box ( i.e. mean) filter (width 5 pixels) and Gaussian filter ( Eqn:eqnsigma = 3 pixels). The spatial frequency axis is marked in cycles per pixel, and hence no value above 0.5 has a real meaning.


Both filters attenuate high frequencies more than low frequencies, but the mean filter exhibits oscillations in its frequency response. The Gaussian on the other hand shows no oscillations. In fact, the shape of the frequency response curve is itself (half a) Gaussian. So by choosing an appropriately sized Gaussian filter we can be fairly confident about what range of spatial frequencies are still present in the image after filtering, which is not the case of the mean filter. This has consequences for some edge detection techniques, as mentioned in the section on zero crossings. (The Gaussian filter also turns out to be very similar to the optimal smoothing filter for edge detection under the criteria used to derive the Canny edge detector.)

We use

ben2

to illustrate the effect of smoothing with successively larger and larger Gaussian filters.

The image

ben2gau1

shows the effect of filtering with a Gaussian of Eqn:eqnsigma = 1.0 (and kernel size 5×5).

The image

ben2gau2

shows the effect of filtering with a Gaussian of Eqn:eqnsigma = 2.0 (and kernel size 9×9).

The image

ben2gau3

shows the effect of filtering with a Gaussian of Eqn:eqnsigma = 4.0 (and kernel size 15×15).

We now consider using the Gaussian filter for noise reduction. For example, consider the image

fce5noi4

which has been corrupted by Gaussian noise with a mean of zero and Eqn:eqnsigma = 8. Smoothing this with a 5×5 Gaussian yields

fce5gsm1

(Compare this result with that achieved by the mean and median filters.)

Salt and pepper noise is more challenging for a Gaussian filter. Here we will smooth the image

sta2noi2

which has been corrupted by 1% salt and pepper noise (i.e. individual bits have been flipped with probability 1%). The image

sta2gsm1

shows the result of Gaussian smoothing (using the same convolution as above). Compare this with the original

sta2

Notice that much of the noise still exists and that, although it has decreased in magnitude somewhat, it has been smeared out over a larger spatial region. Increasing the standard deviation continues to reduce/blur the intensity of the noise, but also attenuates high frequency detail (e.g. edges) significantly, as shown in

sta2gsm2

This type of noise is better reduced using median filtering, conservative smoothing or Crimmins Speckle Removal.

Interactive Experimentation

You can interactively experiment with this operator by clicking here.

Exercises

  1. Starting from the Gaussian noise (mean 0, Eqn:eqnsigma = 13) corrupted image
    fce5noi5

    compute both mean filter and Gaussian filter smoothing at various scales, and compare each in terms of noise removal vs loss of detail.

  2. At how many standard deviations from the mean does a Gaussian fall to 5% of its peak value? On the basis of this suggest a suitable square kernel size for a Gaussian filter withEqn:eqnsigma =s.

  3. Estimate the frequency response for a Gaussian filter by Gaussian smoothing an image, and taking itsFourier transform both before and afterwards. Compare this with the frequency response of amean filter.

  4. How does the time taken to smooth with a Gaussian filter compare with the time taken to smooth with amean filterfor a kernel of the same size? Notice that in both cases the convolution can be speeded up considerably by exploiting certain features of the kernel.

References

E. Davies Machine Vision: Theory, Algorithms and Practicalities, Academic Press, 1990, pp 42 - 44.

R. Gonzalez and R. Woods Digital Image Processing, Addison-Wesley Publishing Company, 1992, p 191.

R. Haralick and L. Shapiro Computer and Robot Vision, Addison-Wesley Publishing Company, 1992, Vol. 1, Chap. 7.

B. Horn Robot Vision, MIT Press, 1986, Chap. 8.

D. Vernon Machine Vision, Prentice-Hall, 1991, pp 59 - 61, 214.

Local Information

Specific information about this operator may be found here.

More general advice about the local HIPR installation is available in the Local Information introductory section.



http://chatgpt.dhexx.cn/article/qdqVQiK1.shtml

相关文章

高斯平滑 高斯模糊 高斯滤波器 ( Gaussian Smoothing, Gaussian Blur, Gaussian Filter ) C++ 实现

发展到现在这个平滑算法的时候, 我已经完全不知道如何去命名这篇文章了, 只好罗列出一些关键字来方便搜索了. 在之前我们提到过了均值滤波器, 就是说某像素的颜色, 由以其为中心的九宫格的像素平均值来决定. 在这个基础上又发展成了带权的平均滤波器, 这里的高斯平滑或者说滤波…

Gaussian Smoothing(高斯平滑)

高斯平滑操作是一个二维卷积操作,用于**“模糊”**图像,去除细节和噪音。它类似于均值滤波器(假如3X3,则全部相加取均值,即成为中间点的像素值),但它使用不同的核表示高斯驼峰的形状。 二维高斯公式 平均值(0&#xf…

高斯-赛戴尔(Gauss-Seidel)迭代法及算法实现

1、高斯-赛戴尔迭代法的定义以及表达形式 以下列方程组为例: 在雅克比迭代法中,并没有对新算出的分量进行充分利用,一般来说,这些新算出计算的结果要比上一步计算的结果精确。 对上式第二个方程组,第一行式子算出的x值…

常用技术指标之一文读懂RSI指标

什么是RSI指标? RSI (Relative Strength Index) 中文名又叫相对强弱指标,由韦尔斯.怀尔德(Welles Wilder)首创,发表在他的《技术交易系统新思路》一书中(1978年版) RSI指标基本原理: 通过测量一段时间间内…

量化投资常用技能——指标篇3:详解RSI指标,及其代码实现和绘图

量化投资常用技能 系列文章目录 我们已经介绍了三篇关于量化投资方面绘图的文章和两篇指标类的推导和介绍的文章,大家有兴趣可以了解一下 绘图篇 量化投资常用技能——绘图篇 1:绘制股票收盘价格曲线和ochl烛状图量化投资常用技能——绘图篇 2&#xf…

缠论指标(全网最精准)

支持平台 01 通达信(电脑手机) 通达信版本简介 02 01 基础版功能: 支持缠论自动分笔,自动线段,显示笔中枢(蓝色),线段中枢(橙色),支持笔段中枢混合显示…

使用bind搭建权威DNS、智能DNS

DNS的解析过程:(以www.qq.com为例说明) 1、在浏览器中输入www.qq.com域名,操作系统会先检查自己本地的hosts文件是否有这个网址映射关系,如果有,就先调用这个IP地址映射,完成域名解析。 2、如…

DNS服务器的搭建

DNS(域名系统),它用于TCP/IP网路。它提供的服务是用来将主机名和域名转换为IP地址的工作。 DNS常用术语 1. DNS服务器:提供域名解析服务的主机。 2. DNS客户机:任何联网的需要查询主机域名信息的主机。 3. 正向解析…

部署搭建DNS服务器

部署搭建DNS服务器 域名服务器DNS域名解析流程域名类型 DNS主服务器搭建正向解析配置配置正向区域数据文件DNS服务器测试 反向解析配置配置反向区域数据文件DNS服务器测试 DNS从服务器搭建正向反向解析配置DNS服务器测试 域名服务器 DNS(Domain Name Server&#x…

智能DNS服务器搭建

前期准备 查看IP [rootlocalhost ~]# ip a | grep ens 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 192.168.200.111/24 brd 192.168.200.255 scope global ens32 3: ens34: <BROADCAST,MULTICAST…

DNS:快速搭建公司内网DNS解析服务器

背景 是这样的&#xff0c;公司办公室有小机房&#xff0c;研发测试开发环境在这&#xff0c;但是CTO吧&#xff0c;觉得测试环境通过ip访问太复杂&#xff0c;难记&#xff0c;通过黄页打开觉得太low&#xff0c;虽然办公室出口也有公网ip&#xff0c;直接可以解析进来&#…

DNS搭建

环境 server1&#xff1a;bigpeng1 IP&#xff1a;172.25.1.101 GW&#xff1a;172.25.1.1 DNS&#xff1a;172.25.1.101 server2&#xff1a;bigpeng2 IP&#xff1a;172.25.1.102 GW&#xff1a;172.25.1.1 DNS&#xff1a;172.25.1.101 client&…

基于bind的DNS服务器搭建

文章目录 域名分类域名解析顺序搭建DNS服务器 域名分类 国家域名可分为顶级域名、二级域名&#xff0c;三级域名。 按管理机构的不同分为.com、.net、.org、.cc 、.tv等根域为后缀的域名 缓存域名服务器&#xff1a;通过向其他域名服务器查询获得域名解析记录&#xff0c;将查…

DNS服务器的原理及搭建

文章目录 原理搭建DNS服务器正向解析 原理 DNS&#xff08;Domain Name System&#xff09;是互联网上的一项服务&#xff0c;它作为将 域名 和 IP 地址相互映射的一个分布式数据库&#xff0c;能够使人更方便的访问互联网。 想要了解域名&#xff08;Domain Name&#xff09;…

简述DNS原理,搭建主-辅服务器,搭建智能DNS

文章目录 一、DNS是什么二、DNS的域名解析过程三、搭建主辅DNS服务器1.设置主DNS服务器2.设置辅DNS服务器 四、访问控制&#xff0c;子域授权五、使用bind搭建智能DNS 一、DNS是什么 DNS(Domain Name Service的缩写)的作用就是根据域名查出IP地址。IP地址是由32位二进制数字组…

搭建DNS服务器实现域名解析

一、DNS服务的概述 1、DNS概述 DNS&#xff08;Domain Name System&#xff09;域名系统&#xff0c;在TCP/IP 网络中有非常重要的地位&#xff0c;能够提供域名与IP地址的解析服务&#xff0c;而不用去记住能够被机器直接读取的IP数串。 通过域名&#xff0c;最终得到该域名对…

DNS智能解析的搭建与配置

分类&#xff1a; LINUX 原文地址&#xff1a;DNS智能解析的搭建与配置 作者&#xff1a;十年梦生 9月份整整忙了一个月&#xff0c;都抽不出时间来写篇文章&#xff0c;这几天趁着10.1终于有时间来写些东西了&#xff0c;将9月份所做的一些东西来做下总结。 今天先写个DNS智能…

基于bind搭建智能dns

题目要求 1.step 1 : 搭建bind服务器&#xff0c;完成对域名 bs.你的名字.org 配置 2.step 2&#xff1a;完成对出口ip的归属地查询 3.step 3&#xff1a;构建归属地acl&#xff0c;完成对不同主机匹配智能解析 4.step 4&#xff1a;利用dig&#xff08;加trace参数&#xff0…

实现智能DNS

文章目录 1 实现智能DNS1.1 GSLB1.2 CDN(Content Delivery Network)内容分发网络1.2.1 CDN工作原理1.3 智能DNS相关技术1.3.1 bind中ACL1.3.2 bind有四个内置的acl1.3.3 访问控制的指令1.3.4 view视图1.3.4.1 view&#xff1a;视图&#xff0c;将ACL和区域数据库实现对应关系&a…

bind搭建智能DNS

小生不才&#xff0c;明知文拙脑蠢&#xff0c;却喜挥笔泼墨&#xff0c;畅叙幽情。才疏学浅&#xff0c;未能熟读圣贤之书&#xff0c;以至学识浅薄&#xff0c;明然众人也&#xff0c;有何不足处望不吝赐教。 DNS域名解析服务(Domain Name System)是用于解析域名与IP地址…