Edge Detection Convolution Kernel Matrix

Edge Detection Convolution Kernel Matrix

Sobel 算子:
Sobel operator is a commonly used edge detection operator, and its convolution kernel matrix is ​​as follows:
Copy code

Gx =  | -1 0 1 |     Gy =  | -1 -2 -1 |
      | -2 0 2 |            |  0  0  0 |
      | -1 0 1 |            |  1  2  1 |

Among them, Gx represents the convolution kernel in the horizontal direction, and Gy represents the convolution kernel in the vertical direction. The Sobel operator can detect edges in both horizontal and vertical directions.

Scharr 算子:
The Scharr operator is similar to the Sobel operator, but its convolution kernel matrix is ​​better, as follows:
Copy code

Gx =  | -3 0 3 |     Gy =  | -3 -10 -3 |
      | -10 0 10 |           |  0   0   0 |
      | -3 0 3 |            |  3  10  3 |

Among them, Gx represents the convolution kernel in the horizontal direction, and Gy represents the convolution kernel in the vertical direction. The Scharr operator can detect edges better.

Laplacian 算子:
The Laplacian operator is a second-order differential operator, and its convolution kernel matrix is ​​as follows:
Copy code

| 0  1  0 |
| 1 -4  1 |
| 0  1  0 |

The Laplacian operator can detect high-frequency change regions in the image.

Canny 边缘检测算法:
Canny operator is a classic edge detection algorithm, and its main steps include Gaussian filtering, calculating gradient magnitude and direction, non-maximum suppression, double threshold processing and edge connection.
The convolution kernel matrix of the Canny operator is generally not defined directly, but is calculated by the parameters of the Gaussian function.
Canny algorithm is a very popular edge detection algorithm, which has the characteristics of high efficiency, accuracy and stability, and is widely used in the field of computer vision. The algorithm is divided into the following steps:

噪声滤波:使用高斯滤波器对图像进行平滑处理,减少噪声的干扰。
计算梯度和方向:使用 Sobel 算子计算图像中每个像素点的梯度和方向。
非极大值抑制:对于梯度方向上的每个像素点,只保留梯度值最大的点,其他点抑制掉。
双阈值检测:根据设置的高低阈值,将像素点分为强边缘、弱边缘和非边缘三类,强边缘即梯度值大于高阈值的像素点,弱边缘即梯度值大于低阈值但小于高阈值的像素点,非边缘即梯度值小于低阈值的像素点。
边缘跟踪:将强边缘像素点作为起点,沿着梯度方向追踪其它强边缘像素点,将中间的弱边缘像素点也标记为边缘点。
Canny 算法的卷积核矩阵不是固定的,而是根据高斯分布函数生成的,通常使用 5x5 的卷积核。

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-PowuHqWh-1686917770152)(_v_images/20230408212821092_21094.png =701x)]

Roberts 算子:
The Roberts operator is a simple edge detection operator, and its convolution kernel matrix is ​​as follows:
Copy code

Gx = | 1  0 |     Gy = | 0  -1 |
     | 0 -1 |           | 1   0 |

Among them, Gx represents the convolution kernel in the horizontal direction, and Gy represents the convolution kernel in the vertical direction. The Roberts operator can only detect edges in the 45-degree direction, and is more sensitive to noise.

Prewitt 算子:
The Prewitt operator is a commonly used edge detection operator, and its convolution kernel matrix is ​​as follows:
Copy code

Gx =  | -1 0 1 |     Gy =  | -1 -1 -1 |
      | -1 0 1 |            |  0  0  0 |
      | -1 0 1 |            |  1  1  1 |

Among them, Gx represents the convolution kernel in the horizontal direction, and Gy represents the convolution kernel in the vertical direction. Prewitt operator can detect horizontal and vertical edges.

LoG 算子:
The LoG operator is an edge detection algorithm based on Gaussian filter and Laplacian operator. Its convolution kernel matrix is ​​as follows:
Copy code

| 0  0 -1  0  0 |
| 0 -1 -2 -1  0 |
|-1 -2 16 -2 -1 |
| 0 -1 -2 -1  0 |
| 0  0 -1  0  0 |

The LoG operator can detect wider edges, but is more sensitive to noise.

DoG 算子:
The DoG operator is an edge detection algorithm based on Gaussian filtering, and its convolution kernel matrix is ​​obtained by subtracting two Gaussian functions of different scales.

Roberts 算子:
The Roberts operator is a simple edge detection operator, and its convolution kernel matrix is ​​as follows:
Copy code

Gx = |  0  1 |
     | -1  0 |

Gy = | 1  0 |
     | 0 -1 |

Among them, Gx represents the convolution kernel in the horizontal direction, and Gy represents the convolution kernel in the vertical direction. The Roberts operator is sensitive to image noise and is generally not used alone, but in combination with other operators.

Kirsch 算子:
The Kirsch operator is a gradient-based edge detection operator, and its convolution kernel matrix is ​​as follows:
Copy code

G1 = |-3 -3  5 |
     |-3  0  5 |
     |-3 -3  5 |

G2 = |-3  5  5 |
     |-3  0  5 |
     |-3 -3 -3 |

G3 = | 5  5  5 |
     |-3  0 -3 |
     |-3 -3 -3 |

G4 = | 5  5 -3 |
     | 5  0 -3 |
     |-3 -3 -3 |

G5 = | 5 -3 -3 |
     | 5  0 -3 |
     | 5 -3 -3 |

G6 = |-3 -3 -3 |
     | 5  0 -3 |
     | 5  5 -3 |

G7 = |-3 -3 -3 |
     |-3  0 -3 |
     | 5  5  5 |

G8 = |-3 -3 -3 |
     |-3  0  5 |
     |-3  5  5 |

The Kirsch operator can detect edges in 8 directions.

The above are some common edge detection operators and algorithms. Of course, there are other operators and methods, which can be selected and tried according to specific situations.
When using it, it needs to be considered comprehensively in combination with the characteristics of the image, the processing effect, and the time efficiency.

在边缘检测过程中,一般需要先对图像进行预处理,例如去除噪声、调整图像亮度和对比度等操作,
以提高算法的稳定性和准确性。边缘检测结果可以用二值图像或者灰度图像来表示,
其中二值图像中白色表示边缘,黑色表示非边缘;而灰度图像中则使用不同的灰度值来表示边缘的强度或者梯度大小,灰度值越大表示边缘越强。

The above are several commonly used edge detection operators and their convolution kernel matrices. Among them, Sobel, Scharr and Prewitt operators are operators based on difference,
Laplacian operator is an operator based on second order differentiation, and Canny operator is a comprehensive edge detection algorithm.
In practical applications, it is necessary to select appropriate operators and parameters for edge detection according to specific situations.
In conclusion, different edge detection operators are suitable for different scenarios and purposes. When using it, it is necessary to select the appropriate operator and parameters according to the specific situation, and perform subsequent processing and optimization on the results.

The acian operator is an operator based on the second order differential, and the Canny operator is a comprehensive edge detection algorithm.
In practical applications, it is necessary to select appropriate operators and parameters for edge detection according to specific situations.
In conclusion, different edge detection operators are suitable for different scenarios and purposes. When using it, it is necessary to select the appropriate operator and parameters according to the specific situation, and perform subsequent processing and optimization on the results.

Guess you like

Origin blog.csdn.net/weixin_43763292/article/details/131256610