# 索贝尔算子

索贝尔算子（Sobel operator），更准确的名称是索贝尔-费尔德曼算子（Sobel-Feldman operator），是一种离散微分滤波器，用于图像处理中近似计算每个像素处图像强度的梯度，主要用于边缘检测。它对图像施加一对3×3卷积核，一个估计水平方向导数，一个估计垂直方向导数。由于计算成本低且性能合理，它至今仍是最广泛使用的一阶边缘检测器之一。<sup>[1](https://arxiv.org/abs/2305.00515)</sup><sup> • </sup><sup>[2](https://www.researchgate.net/publication/285159837_A_33_isotropic_gradient_operator_for_image_processing)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 由欧文·索贝尔（Irwin Sobel）和加里·费尔德曼（Gary Feldman）于1968年在斯坦福人工智能项目（SAIL）上提出；首次见于文献是杜达（Duda）和哈特（Hart）《模式分类与场景分析》（*Pattern Classification and Scene Analysis*，1973年）第271–2页脚注中“由I. 索贝尔建议”的致谢<sup>[2](https://www.researchgate.net/publication/285159837_A_33_isotropic_gradient_operator_for_image_processing)</sup> |
| 核 | 两个3×3掩模，例如水平方向 \(\begin{bmatrix} 1 & 0 & -1 \\ 2 & 0 & -2 \\ 1 & 0 & -1 \end{bmatrix}\) 及其垂直对应形式；每个都可分解为中心差分 \([1, 0, -1]\) 与平滑 \([1, 2, 1]\)<sup>[3](https://visionbook.mit.edu/derivatives.html)</sup> |
| 设计目标 | 紧凑且尽可能各向同性；在所比较的四种常见离散导数近似中，它给出旋转不变性最好的梯度幅值，代价是模糊<sup>[3](https://visionbook.mit.edu/derivatives.html)</sup> |
| 噪声行为 | 由于其带通频率响应，在简单导数核中噪声容限最好，但对高频噪声敏感，且限于小空间尺度<sup>[3](https://visionbook.mit.edu/derivatives.html)</sup><sup> • </sup><sup>[4](https://www.cs.columbia.edu/~jebara/htmlpapers/UTHESIS/node15.html)</sup> |
| 成本 | 大多数应用选择双方向3×3形式，因为其计算量低、结构简单<sup>[1](https://arxiv.org/abs/2305.00515)</sup> |
| 实现 | 内置于OpenCV（`cv2.Sobel`，使用扩展算子计算一阶、二阶、三阶或混合导数）、SciPy（`scipy.ndimage.sobel`）和scikit-image（`skimage.filters.sobel`）<sup>[5](https://docs.opencv.org/2.4.13.7/modules/imgproc/doc/filtering.html?highlight=sobel)</sup><sup> • </sup><sup>[6](https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.sobel.html)</sup><sup> • </sup><sup>[7](https://scikit-image.org/docs/0.25.x/api/skimage.filters.html)</sup> |

## 工作原理

该算子估计图像强度函数的空间梯度。每个输出像素是输入图像对应位置处梯度幅值的近似，通过将图像与两个核卷积计算——一个方向求导，垂直方向求平均。<sup>[8](https://www.cs.cmu.edu/~alonzo/books/perc1.pdf)</sup><sup> • </sup><sup>[9](https://www.ahay.org/RSF/book/tccs/sobel/paper_html/node2.html)</sup> 第一个滤波器在一个方向求导、在交叉方向平均；第二个反之，因此二者共同近似图像强度的平滑梯度。<sup>[9](https://www.ahay.org/RSF/book/tccs/sobel/paper_html/node2.html)</sup>

3×3掩模可分解为更小的部分。按麻省理工学院《计算机视觉基础》（*Foundations of Computer Vision*）教材的记号，水平核是中心差分滤波器 \(\begin{bmatrix} 1 & 0 & -1 \end{bmatrix}\) 与平滑滤波器 \(\begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix}\) 的外积，垂直核是对应的转置：<sup>[3](https://visionbook.mit.edu/derivatives.html)</sup>

\[ \mathrm{Sobel}_x = \begin{bmatrix} 1 & 0 & -1 \\ 2 & 0 & -2 \\ 1 & 0 & -1 \end{bmatrix}, \qquad \mathrm{Sobel}_y = \begin{bmatrix} -1 & -2 & -1 \\ 0 & 0 & 0 \\ 1 & 2 & 1 \end{bmatrix} \]

这种分解使算子实现非常高效，因为它可以写成与小型一维核的卷积，而非完整的3×3遍历。<sup>[3](https://visionbook.mit.edu/derivatives.html)</sup> scikit-image库直接打印等效掩模：其水平索贝尔变换使用的核的各行分别为 \(1, 2, 1\)；\(0, 0, 0\)；\(-1, -2, -1\)，垂直变换使用其旋转形式。<sup>[7](https://scikit-image.org/docs/0.25.x/api/skimage.filters.html)</sup>

在具体实现中，两个方向的响应分量被组合为边缘幅值。SciPy文档给出标准配方：计算水平和垂直梯度，然后形成幅值 \( \sqrt{g_h^2 + g_v^2} \)，通常归一化到图像范围。<sup>[6](https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.sobel.html)</sup> scikit-image将其幅值定义为各轴响应平方在图像维度上的均值的平方根。<sup>[7](https://scikit-image.org/docs/0.25.x/api/skimage.filters.html)</sup>

## 历史

该算子源于1968年在斯坦福人工智能项目（SAIL）上的一次演讲，由当时在该项目攻读博士学位的欧文·索贝尔与同为研究生的加里·费尔德曼共同给出，主题是一种相对各向同性的3×3梯度算子。索贝尔本人从未发表这项工作；它通过杜达和哈特1973年教材《模式分类与场景分析》中致谢该建议的脚注进入文献。在索贝尔寄给林雪平大学佩-埃里克·丹尼尔松（Per-Erik Danielsson）的历史记述中，他指出该算子更恰当的名称是索贝尔-费尔德曼算子，并纠正了复原工作中的一个细节：其中一个响应掩模的尺度因子是4，而非2。<sup>[2](https://www.researchgate.net/publication/285159837_A_33_isotropic_gradient_operator_for_image_processing)</sup>

后来的分析将该算子归入一组相关估计器。1984年的一项研究表明，对于某些掩模尺寸和点算子，最佳平面拟合梯度技术等价于罗伯茨（Roberts）、普雷维特（Prewitt）、索贝尔和赫克尔（Huckel）梯度技术。<sup>[10](https://www.sciencedirect.com/science/article/pii/016516848490015X)</sup> 关于导数算子旋转不变性的工作将索贝尔算子视为非理想但实际可实现的算子的标准范例，对其而言旋转不变性仍是自然要求。<sup>[11](https://www.sciencedirect.com/science/article/pii/0734189X9090137K)</sup>

## 性质与局限

**局部尺度。** 3×3算子局部作用，仅在小尺度上检测边缘。对于边界参差不齐的物体，它在周界的每个尖峰和转折处报告边缘，而非恢复边界的全局结构。它对高频噪声敏感，且可能对局部梯度非零的宽缓对比过渡产生响应，因为它用3×3核测量近似局部梯度幅值。<sup>[4](https://www.cs.columbia.edu/~jebara/htmlpapers/UTHESIS/node15.html)</sup><sup> • </sup><sup>[17](https://homepages.inf.ed.ac.uk/rbf/HIPR2/sobel.htm)</sup>

**频率响应。** 在常见离散导数近似中，索贝尔-费尔德曼算子由于带通性质具有最好的噪声容限，而简单的两抽头差分核给出最高的输出分辨率。索贝尔算子在所比较的四种近似中也给出旋转不变性最好的梯度幅值，但输出更模糊。<sup>[3](https://visionbook.mit.edu/derivatives.html)</sup>

**实践中噪声类型很重要。** 医学图像上的比较研究报告称，索贝尔和普雷维特算子对莱斯噪声（Rician noise）表现出更强的抵抗力，在中等复杂度图像上给出稳定结果，而坎尼（Canny）算子在含高斯和散斑噪声的图像上达到最佳边缘检测精度，尤其是在高复杂度时，罗伯茨算子在低复杂度图像上最高效。<sup>[12](https://pmc.ncbi.nlm.nih.gov/articles/PMC11722869/)</sup>

## 与其他算子的比较

索贝尔算子通常与坎尼、普雷维特、罗伯茨交叉（Roberts Cross）、沙尔（Scharr）等算子进行基准比较，排名取决于任务和指标。

在铁路轨道实例分割中，边缘增强为分割网络提供先验特征，比较了五种边缘方法。索贝尔达到Box mAP@0.5为0.91、Mask mAP@0.5为0.827，领先于普雷维特（0.903和0.818）和坎尼（0.905和0.82），但落后于沙尔算子，后者达到0.925和0.854。该研究将索贝尔和普雷维特描述为对噪声敏感、在复杂场景中边缘不精确，并将沙尔的优势归因于其使用相邻像素距离加权，从而具有更好的噪声抵抗力和边缘连续性。<sup>[13](https://pmc.ncbi.nlm.nih.gov/articles/PMC13031943/)</sup>

在从[哨兵2号](https://www.edgepedia.org/zh/sentinel-2)（Sentinel-2）卫星影像自动提取海岸线时，对98幅测试图像比较了四种算法。坎尼产生的边缘图最接近参考边缘，平均结构相似性（SSIM）约为0.8，而索贝尔的SSIM在十二个光谱波段上保持在0到0.3附近，峰值信噪比约为3到4.9 dB。索贝尔和沙尔检测到许多非海岸边缘，归因于风和涌浪造成的海洋波纹。按PSNR，普雷维特在所有波段表现最佳，坎尼紧随其后；按SSIM，坎尼在全部十二个波段最佳。<sup>[14](https://arxiv.org/abs/2405.11494)</sup>

在芽孢杆菌（*Bacillus*）显微图像的坎尼边缘检测中，索贝尔和沙尔在精确率上表现出色，索贝尔在创造纹理均匀性方面突出，沙尔在像素间相关性方面突出。<sup>[15](https://jurnal.poltekba.ac.id/index.php/jtt/article/view/2397)</sup>

## 变体与扩展

**更大和多方向核。** 尽管大多数应用使用双方向3×3算子，一些任务扩展核尺寸或方向数。一种增加了315°和360°方向的改进索贝尔算子被提出用于骨关节炎图像中的膝关节间隙边缘检测；一个八方向版本应用于脑肿瘤MRI；一个增加了67.5°和112.5°方向的版本用于工业检测中的螺纹边缘提取。这些更大的多方向算子可能更稳健，但需要更多计算时间，且计算量随图像尺寸急剧增长。<sup>[1](https://arxiv.org/abs/2305.00515)</sup> 一个基于线程束级原语和预取的四方向5×5索贝尔算子GPU核，在[Jetson AGX Xavier](https://www.edgepedia.org/zh/jetson-agx-xavier)上比OpenCV-GPU库实现6.7倍加速，在GTX 1650Ti上实现13倍加速。<sup>[1](https://arxiv.org/abs/2305.00515)</sup>

**沙尔。** 沙尔算子在OpenCV和scikit-image中与索贝尔并列提供，其核中使用权重3、10和3，在上述比较中，在铁路和显微研究中提供了更好的噪声抵抗力和更高精度。<sup>[5](https://docs.opencv.org/2.4.13.7/modules/imgproc/doc/filtering.html?highlight=sobel)</sup><sup> • </sup><sup>[7](https://scikit-image.org/docs/0.25.x/api/skimage.filters.html)</sup><sup> • </sup><sup>[13](https://pmc.ncbi.nlm.nih.gov/articles/PMC13031943/)</sup>

**在其他算法中的角色。** 索贝尔算子也是更大流程中的组件：坎尼边缘检测器通常被描述为迭代索贝尔型核以寻找梯度候选，该算子继续作为经典计算机视觉描述符的构建模块。<sup>[3](https://visionbook.mit.edu/derivatives.html)</sup>

## 应用

有文献记载的用途涵盖遥感、医学图像处理和工业检测，包括用多尺度索贝尔算法进行渤海锋面检测、脑肿瘤MRI边缘检测、使用频域索贝尔滤波器的基于阈值的分水岭分割进行血细胞检测，以及螺纹牙侧角测量。<sup>[1](https://arxiv.org/abs/2305.00515)</sup> 在更广泛的医学成像中，索贝尔型算子的边缘检测支持计算机辅助诊断系统中的结构识别，并行或多线程索贝尔实现用于减少大型数据集上的处理时间。<sup>[16](https://matjournals.net/engineering/index.php/IJIPSS/article/view/3034)</sup>

## References

1. [Qiong Chang, Xin Li, Yun Li, Jun Miyazaki (2023). Multi-directional Sobel operator kernel on GPUs. arXiv:2305.00515.](https://arxiv.org/abs/2305.00515)
2. [Irwin Sobel, Gary Feldman. A 3×3 isotropic gradient operator for image processing; with Sobel's historical account "History and Definition of the so-called 'Sobel Operator'", ResearchGate.](https://www.researchgate.net/publication/285159837_A_33_isotropic_gradient_operator_for_image_processing)
3. [Foundations of Computer Vision, Chapter 18: Image Derivatives, MIT.](https://visionbook.mit.edu/derivatives.html)
4. [The Sobel Operator, Columbia University (thesis excerpt).](https://www.cs.columbia.edu/~jebara/htmlpapers/UTHESIS/node15.html)
5. [Image Filtering, OpenCV 2.4.13.7 documentation.](https://docs.opencv.org/2.4.13.7/modules/imgproc/doc/filtering.html?highlight=sobel)
6. [scipy.ndimage.sobel, SciPy v1.18.0 Manual.](https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.sobel.html)
7. [skimage.filters, scikit-image 0.25.2 documentation.](https://scikit-image.org/docs/0.25.x/api/skimage.filters.html)
8. [Alonzo Kelly, Mobile Robotics lecture notes, Carnegie Mellon University (Section 8.1, First Derivatives in 2D).](https://www.cs.cmu.edu/~alonzo/books/perc1.pdf)
9. [Theory, Sobel chapter, Madagascar (ahay.org) TCCS book.](https://www.ahay.org/RSF/book/tccs/sobel/paper_html/node2.html)
10. [Bidyut Baran Chaudhuri, Bhabatosh Chanda (1984). The equivalence of best plane fit gradient with Robert's, Prewitt's and Sobel's gradient for edge detection. Signal Processing 6(2): 143–151.](https://www.sciencedirect.com/science/article/pii/016516848490015X)
11. [Per-Erik Danielsson, Olle Seger (1990). Rotation invariance in gradient and higher order derivative detectors. CVGIP 49(2): 198–221.](https://www.sciencedirect.com/science/article/pii/0734189X9090137K)
12. [Comparative Analysis of Edge Detection Operators Using a Threshold Estimation Approach on Medical Noisy Images with Different Complexities, PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC11722869/)
13. [Edge-guided multi-scale instance segmentation for railway track, PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC13031943/)
14. [Conor O'Sullivan, Seamus Coveney, Xavier Monteys, Soumyabrata Dev (2024). Automated Coastline Extraction Using Edge Detection Algorithms. arXiv:2405.11494.](https://arxiv.org/abs/2405.11494)
15. [Himawan Wicaksono. Comparative Analysis of Gradient Operators in Canny Edge Detection for Bacillus sp. Microscopic Imaging. Jurnal Teknologi Terpadu 13(1).](https://jurnal.poltekba.ac.id/index.php/jtt/article/view/2397)
16. [Purva Kamat Mhamai et al. Edge Detection in Image Processing using Sobel Operator. International Journal of Image Processing and Smart Sensors.](https://matjournals.net/engineering/index.php/IJIPSS/article/view/3034)
17. [Feature Detectors - Sobel Edge Detector](https://homepages.inf.ed.ac.uk/rbf/HIPR2/sobel.htm)

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

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Language and vision AI › Computer vision › Vision methods and geometry › Feature detection and description

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/sobel-operator

English original: https://www.edgepedia.org/sobel-operator
