# 高斯模糊

**高斯模糊**（又称高斯平滑）是一种线性图像处理操作，它将每个像素替换为其邻域的加权平均值，权重按照高斯（钟形曲线）函数随距离衰减。中心像素获得最大的权重，邻近像素的贡献随着其与中心的空间距离增大而减小。<sup>[1](https://docs.opencv.org/4.11.0/dc/dd3/tutorial_gausian_median_blur_bilateral_filter.html)</sup><sup> • </sup><sup>[2](https://vizlearn.in/computer_vision/blur_gaussian_median_bilateral.html)</sup> 它是计算机视觉、图形学和医学成像中应用最广泛的平滑滤波器之一，也是图像尺度空间表示的标准构建模块。<sup>[3](https://www.csc.kth.se/~tony/abstracts/Lin94-SI-abstract.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 操作 | 图像与二维高斯核的卷积；一种线性、平移不变的低通滤波器<sup>[1](https://docs.opencv.org/4.11.0/dc/dd3/tutorial_gausian_median_blur_bilateral_filter.html)</sup> |
| 控制参数 | 标准差 σ（sigma）决定平滑程度；σ 越大模糊越强<sup>[4](https://www.sci.utah.edu/~cscheid/spr05/imageprocessing/project3/)</sup> |
| 可分离性 | 二维核可分解为两次一维处理，对于 N×M 图像和 n×m 核，将计算成本从 O(NMnm) 降至 O(NM(n+m))<sup>[5](https://cirl.lcsr.jhu.edu/introduction-to-computer-vision/image-processing/)</sup> |
| 理论地位 | 在一般假设下，高斯核是唯一可能的尺度空间平滑核（Koenderink 1984；Lindeberg 1994）<sup>[6](https://www.cs.toronto.edu/~fleet/courses/2503/fall11/Handouts/sift.pdf)</sup> |
| 最适合的噪声 | 加性、大致对称的噪声，例如合理光照下的传感器噪声<sup>[2](https://vizlearn.in/computer_vision/blur_gaussian_median_bilateral.html)</sup> |
| 主要缺点 | 在模糊噪声的同时也模糊边缘；无法区分边界与波动<sup>[2](https://vizlearn.in/computer_vision/blur_gaussian_median_bilateral.html)</sup> |
| 标准接口 | OpenCV `GaussianBlur()`、SVG `feGaussianBlur`，以及主要库中的 GPU 实现<sup>[7](https://docs.opencv.org/2.3/modules/gpu/doc/image_filtering.html)</sup><sup> • </sup><sup>[8](https://www.w3.org/TR/SVG11/filters.html)</sup> |

## 核

对图像进行平滑意味着用核对其进行卷积——核是一个系数窗口，在图像上滑动并在每个位置计算加权和。<sup>[1](https://docs.opencv.org/4.11.0/dc/dd3/tutorial_gausian_median_blur_bilateral_filter.html)</sup> 对于[高斯滤波器](https://www.edgepedia.org/zh/gaussian-filter)，二维核是一个采样高斯函数。OpenCV 的教程将其写为

\[ G_{0}(x, y) = A \, e^{ \frac{-(x - \mu_{x})^{2}}{2\sigma^{2}_{x}} + \frac{-(y - \mu_{y})^{2}}{2\sigma^{2}_{y}} } \]

其中 \( \mu \) 是均值（峰值），\( \sigma^{2} \) 是变量 \( x \) 和 \( y \) 各自的方差。<sup>[1](https://docs.opencv.org/4.11.0/dc/dd3/tutorial_gausian_median_blur_bilateral_filter.html)</sup> 在尺度空间工作中常用的各向同性、零均值形式中，

\[ G(x, y, \sigma) = \frac{1}{2\pi\sigma^{2}} \, e^{-(x^{2}+y^{2})/2\sigma^{2}} \]

模糊后的图像为 \( L(x, y, \sigma) = G(x, y, \sigma) * I(x, y) \)，其中 \( * \) 表示卷积。<sup>[6](https://www.cs.toronto.edu/~fleet/courses/2503/fall11/Handouts/sift.pdf)</sup>

单一参数 σ 控制着降噪与细节损失之间的权衡。由于[高斯函数](https://www.edgepedia.org/zh/gaussian-function)无限延伸，实际实现中会对其进行截断；惯常做法是在距中心约 \( 3\sigma \) 至 \( 5\sigma \) 处截断核。<sup>[9](https://staff.fnwi.uva.nl/r.vandenboomgaard/ComputerVision/LectureNotes/IP/LocalStructure/GaussianDerivatives.html)</sup> 在 OpenCV 中，传给 `GaussianBlur()` 的核尺寸在每个维度上必须为正奇数，否则将根据提供的 σ 值自动计算；同时指定核尺寸和 `sigmaX`/`sigmaY` 可完全控制结果。<sup>[7](https://docs.opencv.org/2.3/modules/gpu/doc/image_filtering.html)</sup>

## 为什么是高斯的形状

有两个性质使高斯滤波器区别于更简单的方框（平均）滤波器。第一，高斯的[傅里叶变换](https://www.edgepedia.org/zh/fourier-transform)仍然是高斯，且没有旁瓣，因此高斯核作为低通滤波器不会产生方框滤波器那样的振铃；用方框滤波器平滑会因其傅里叶变换为 sinc 函数而突出高阶频率。<sup>[5](https://cirl.lcsr.jhu.edu/introduction-to-computer-vision/image-processing/)</sup> 第二，高斯函数是光滑的（无限可微）且始终为正，因此用它平滑永远不会引入虚假的零交叉，这对于在滤波信号的零交叉处定位边界的边缘检测器来说很重要。<sup>[9](https://staff.fnwi.uva.nl/r.vandenboomgaard/ComputerVision/LectureNotes/IP/LocalStructure/GaussianDerivatives.html)</sup><sup> • </sup><sup>[10](https://courses.cs.duke.edu/fall13/cps274/notes/convolution.pdf)</sup>

更深层的依据来自尺度空间理论。[瑞典皇家理工学院](https://www.edgepedia.org/zh/kth-royal-institute-of-technology)（KTH Royal Institute of Technology）计算机科学教授 Tony Lindeberg 证明，在关于视觉处理早期阶段的相当一般的条件下，高斯核及其导数是唯一可能的平滑核：线性与平移不变性，加上粗尺度结构应当是细尺度结构的简化而非平滑本身产生的伪影这一要求，通过几组不同的公理推导出高斯。<sup>[3](https://www.csc.kth.se/~tony/abstracts/Lin94-SI-abstract.html)</sup> 物理学家 Jan Koenderink 在其 1984 年的论文《图像的结构》（“The structure of images”）中更早得出了相同结论，该文表明，如果在分辨率降低时不允许产生虚假细节，图像本质上只能以一种方式嵌入到派生图像的单参数族中。<sup>[11](https://pubmed.ncbi.nlm.nih.gov/6477978/)</sup> 麻省理工学院（MIT）高级计算机视觉课程的讲义将实践中使用的结论总结为：“唯一合理的尺度空间核是高斯核”（Koenderink, 1984; Lindeberg, 1994）。<sup>[12](https://courses.csail.mit.edu/6.869/lectnotes/lect8/lect8-slides.pdf)</sup>

## 高效实现

**可分离性。** 二维高斯核可分解为 \( G^{s}(x,y) = G^{s}(x)\,G^{s}(y) \)，因此二维卷积可以作为两次连续的一维卷积来执行，一次水平、一次垂直。<sup>[9](https://staff.fnwi.uva.nl/r.vandenboomgaard/ComputerVision/LectureNotes/IP/LocalStructure/GaussianDerivatives.html)</sup> 这将每像素的计算成本从与整个核面积成正比降低到与其边长之和成正比：对于 N×M 图像和 n×m 核，从 O(NMnm) 降至 O(NM(n+m))。<sup>[5](https://cirl.lcsr.jhu.edu/introduction-to-computer-vision/image-processing/)</sup> 一本现代教科书章节中的计算示例表明，与直接卷积相比，31×31 的可分离高斯核将计算成本降至约 1/15.5。<sup>[13](https://wanghemath.github.io/Book-MathCV/chapters/chapter-06-convolution-filtering-local-operators.html)</sup> 大多数现代图像处理库使用可分离形式。<sup>[14](https://raymondtay.github.io/gaussian_blur_comparison.html)</sup>

**半群性质。** 两个高斯卷积得到另一个高斯：\( G^{s} * G^{t} = G^{\sqrt{s^{2}+t^{2}}} \)。在实践中，这允许增量式地构建尺度空间；如果已有在尺度 \( t \) 处平滑过的图像，则更大尺度 \( s \) 处的图像只需与 \( G^{\sqrt{s^{2}-t^{2}}} \) 卷积，这比从原始图像开始所需的核更小。<sup>[9](https://staff.fnwi.uva.nl/r.vandenboomgaard/ComputerVision/LectureNotes/IP/LocalStructure/GaussianDerivatives.html)</sup>

**近似。** SVG 规范允许一种实现捷径：对于 2.0 或更大的标准差，三次连续的方框模糊可构建一个分段二次核，对高斯的近似误差约在 3% 以内，甚至单值的 `stdDeviation` 也可以实现为可分离卷积。<sup>[8](https://www.w3.org/TR/SVG11/filters.html)</sup> 在离散方面，Lindeberg 2023 年对离散化方法的研究发现，直接采样连续高斯在非常精细的尺度上表现不佳，而由修正贝塞尔函数构建的高斯核的离散对应形式在这些尺度上表现明显更好。<sup>[15](https://arxiv.org/abs/2311.11317)</sup>

## 与其他平滑滤波器的比较

高斯模糊是一小组标准平滑滤波器之一，在它们之间做选择取决于噪声类型以及边缘是否需要保留。<sup>[16](https://pmc.ncbi.nlm.nih.gov/articles/PMC3746120/)</sup>

- **方框（归一化）滤波器。** 每个邻近像素以相等权重贡献。它更简单，但其 sinc 形频率响应使其低通滤波效果不如高斯。<sup>[1](https://docs.opencv.org/4.11.0/dc/dd3/tutorial_gausian_median_blur_bilateral_filter.html)</sup><sup> • </sup><sup>[5](https://cirl.lcsr.jhu.edu/introduction-to-computer-vision/image-processing/)</sup>
- **中值滤波器。** 用邻域的中值替换每个像素。由于离群值永远不会是中间值，它能完全去除椒盐噪声而非将其扩散，并且能保留阶跃边缘。<sup>[1](https://docs.opencv.org/4.11.0/dc/dd3/tutorial_gausian_median_blur_bilateral_filter.html)</sup><sup> • </sup><sup>[2](https://vizlearn.in/computer_vision/blur_gaussian_median_bilateral.html)</sup>
- **双边滤波器。** 同时按空间距离和强度相似性对邻近像素加权，因此它在区域内部进行平均而不跨越边界，在平滑噪声的同时保留边缘。<sup>[2](https://vizlearn.in/computer_vision/blur_gaussian_median_bilateral.html)</sup><sup> • </sup><sup>[1](https://docs.opencv.org/4.11.0/dc/dd3/tutorial_gausian_median_blur_bilateral_filter.html)</sup>

一本生物医学图像处理教科书中的定量比较，使用带有实测噪声标准差、边缘梯度和病灶对比度的模拟图像，说明了这种权衡：

| 滤波器 | 实质组织中的噪声标准差 | 边缘梯度 | 病灶对比度 |
|---|---|---|---|
| 无 | 0.0421 | 0.4096 | 0.1409 |
| 高斯（σ 1.5） | 0.0132 | 0.3005 | 0.1220 |
| 中值 3×3 | 0.0199 | 0.3752 | 0.1370 |
| 双边 | 0.0194 | 0.4037 | 0.1299 |

高斯平滑在噪声抑制上胜出，在边缘上失利；中值滤波器是一种折中；双边滤波器在抑制噪声的同时保留了边界。<sup>[17](https://socr.umich.edu/BPAD1/BPAD1_notes/BPAD1_Chap07_General_Medical_Image_Processing.html)</sup> 高斯滤波器在脉冲噪声上的失效模式是结构性的：均值包含它所接收的每一个值，因此暗邻域中的单个亮离群值不会被去除，而是作为一个更大、更暗的污迹扩散到邻域中，增大半径会使污迹变大。<sup>[2](https://vizlearn.in/computer_vision/blur_gaussian_median_bilateral.html)</sup>

## 应用

**尺度空间特征检测。** SIFT（尺度不变特征变换）算法将图像的尺度空间定义为一叠在逐渐增大的 σ 处高斯模糊后的版本，然后在高斯差分函数的极值处检测关键点，该函数近似于尺度归一化的高斯拉普拉斯；模糊后的图像无论如何都需要用于特征描述，因此差分的代价仅为图像减法。<sup>[6](https://www.cs.toronto.edu/~fleet/courses/2503/fall11/Handouts/sift.pdf)</sup>

**医学成像。** 高斯平滑是分割和其他分析之前的标准预处理步骤；一篇医学图像分割的综述将初步高斯平滑描述为在高斯拉普拉斯流程中减少噪声影响同时提供良好边缘定位的方法。<sup>[18](https://pmc.ncbi.nlm.nih.gov/articles/PMC11505408/)</sup> CT 预处理的综述将高斯滤波器列为减少计算机断层扫描图像中噪声和伪影最常用的预处理技术之一。<sup>[19](https://www.sciencedirect.com/science/article/pii/S0141938224001999)</sup> 在脑成像研究中，高斯核平滑因其数值实现的简洁性而被描述为事实上的平滑技术。<sup>[20](https://arxiv.org/abs/2007.09539)</sup>

**图形与接口。** SVG 滤镜原语 `feGaussianBlur` 对输入图像执行高斯模糊，钟形曲线宽度由 x 和 y 方向的 `stdDeviation` 设定；它是在矢量图形中以及通过 CSS `filter()` 在网页元素上产生模糊效果的标准方式。<sup>[8](https://www.w3.org/TR/SVG11/filters.html)</sup><sup> • </sup><sup>[21](https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feGaussianBlur)</sup> GPU 实现为实时使用暴露相同的操作；OpenCV 的 GPU 模块提供 `gpu::GaussianBlur`，其核尺寸和 σ 语义与 CPU 函数相同。<sup>[7](https://docs.opencv.org/2.3/modules/gpu/doc/image_filtering.html)</sup>

## 局限性

核心局限在于边缘行为。边缘是相邻像素确实不同的地方，任何基于普通加权平均的滤波器都会将两侧混合在一起，因为它无法知道边缘的存在。<sup>[2](https://vizlearn.in/computer_vision/blur_gaussian_median_bilateral.html)</sup> 在上面的医学成像比较中，高斯平滑将噪声标准差降低了约三分之二，但也将边缘梯度从 0.4096 降至 0.3005，而双边滤波器将边缘梯度保持在 0.4037。<sup>[17](https://socr.umich.edu/BPAD1/BPAD1_notes/BPAD1_Chap07_General_Medical_Image_Processing.html)</sup> 第二个局限是噪声模型：高斯模糊是适用于加性、大致对称噪声的正确滤波器，在这种情况下平均会抵消正负扰动，但在椒盐噪声上它会使图像退化而非净化。<sup>[2](https://vizlearn.in/computer_vision/blur_gaussian_median_bilateral.html)</sup> 在抗锯齿和降采样中，高斯滤波器族还可能遭受谱内能量损失，模糊了采样率本应允许通过的频率，尽管在一组测试序列中这只出现在一个病态的波带片示例中。<sup>[4](https://www.sci.utah.edu/~cscheid/spr05/imageprocessing/project3/)</sup>

## References

1. [Smoothing Images, OpenCV documentation](https://docs.opencv.org/4.11.0/dc/dd3/tutorial_gausian_median_blur_bilateral_filter.html)
2. [Blur: Gaussian, Median and Bilateral, VizLearn](https://vizlearn.in/computer_vision/blur_gaussian_median_bilateral.html)
3. [Tony Lindeberg (1994). Scale-space theory: A basic tool for analysing structures at different scales. Journal of Applied Statistics.](https://www.csc.kth.se/~tony/abstracts/Lin94-SI-abstract.html)
4. [Project 3: Antialiasing, Subsampling, Supersampling and the Frequency Domain, University of Utah](https://www.sci.utah.edu/~cscheid/spr05/imageprocessing/project3/)
5. [Image Processing, CIRL, Johns Hopkins University](https://cirl.lcsr.jhu.edu/introduction-to-computer-vision/image-processing/)
6. [David G. Lowe (2004). Distinctive Image Features from Scale-Invariant Keypoints. International Journal of Computer Vision.](https://www.cs.toronto.edu/~fleet/courses/2503/fall11/Handouts/sift.pdf)
7. [Image Filtering, OpenCV GPU module documentation](https://docs.opencv.org/2.3/modules/gpu/doc/image_filtering.html)
8. [Filter Effects – SVG 1.1 (Second Edition), W3C, section 15.17 feGaussianBlur](https://www.w3.org/TR/SVG11/filters.html)
9. [Gaussian Convolutions and Derivatives, Image Processing and Computer Vision lecture notes, University of Amsterdam](https://staff.fnwi.uva.nl/r.vandenboomgaard/ComputerVision/LectureNotes/IP/LocalStructure/GaussianDerivatives.html)
10. [Convolution notes, Duke University CPS 274](https://courses.cs.duke.edu/fall13/cps274/notes/convolution.pdf)
11. [J. J. Koenderink (1984). The structure of images. Biological Cybernetics.](https://pubmed.ncbi.nlm.nih.gov/6477978/)
12. [MIT 6.869 Advances in Computer Vision, lecture 8 slides](https://courses.csail.mit.edu/6.869/lectnotes/lect8/lect8-slides.pdf)
13. [Convolution, Filtering, and Local Operators, The Mathematics of Modern Computer Vision](https://wanghemath.github.io/Book-MathCV/chapters/chapter-06-convolution-filtering-local-operators.html)
14. [Gaussian Blur: Separable Convolution vs Full 2D Convolution, Raymond Tay](https://raymondtay.github.io/gaussian_blur_comparison.html)
15. [Tony Lindeberg (2023). Discrete approximations of Gaussian smoothing and Gaussian derivatives. arXiv:2311.11317.](https://arxiv.org/abs/2311.11317)
16. [Image processing and recognition for biological images, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC3746120/)
17. [Biomedical Physics with Applications to Disease, chapter 7: General Medical Image Processing, University of Michigan](https://socr.umich.edu/BPAD1/BPAD1_notes/BPAD1_Chap07_General_Medical_Image_Processing.html)
18. [Advances in Medical Image Segmentation: A Comprehensive Review, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC11505408/)
19. [Statistical techniques for digital pre-processing of computed tomography medical images: A current review, ScienceDirect](https://www.sciencedirect.com/science/article/pii/S0141938224001999)
20. [Gaussian kernel smoothing, arXiv:2007.09539](https://arxiv.org/abs/2007.09539)
21. [<feGaussianBlur>, MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feGaussianBlur)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Language and vision AI › Computer vision › Vision methods and geometry › Low-level image analysis

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/gaussian-blur

English original: https://www.edgepedia.org/gaussian-blur
