Machine Vision-Edge Detection and Image Segmentation Principles

edge detection

  • For two-dimensional images, the edge is generally where the absolute value of the first-order differential is the largest, or where the second-order differential is 0, that is:

∇ 2 f ( x , y ) = ∂ 2 f ∂ x 2 + ∂ 2 f ∂ y 2 = 0 {\nabla}^2f(x,y)={ { {\partial}^2f}\over{\partial {x}^2}}+{ { {\partial}^2f}\over{\partial {y}^2}}=0 2f(x,y)=x22 f+y22 f=0

Edges occur where there is a sudden change in color and thus where the absolute value of the color gradient is greatest.
insert image description here

  • The two-dimensional image stored in the computer is essentially a two-dimensional matrix (for color pictures, three two-dimensional matrices of RGB), which can be calculated by convolution operator and edge detection is performed.

The idea of ​​​​constructing an edge detection operator: Let the sum of all values ​​​​in the operator be 0. In this way, it can be basically 0 after convolution with the edge operator at the non-edge (the area where the pixel value does not change much); after convolution with the edge detection operator at the edge (the area where the pixel value changes greatly) A value with a larger absolute value.

  • Common edge detection operator
    ①Robert operator
    { − 1 1 } \left\{ \begin{matrix} -1 & \\ & 1 \\ \end{matrix} \right\}{ 11}

    { − 1 1 } \left\{ \begin{matrix} & -1 \\ 1 & \\ \end{matrix} \right\} { 11}

2Prewitt function
{ − 1 − 1 − 1 0 0 0 1 1 1 } \left\{ \begin{matrix} -1&-1 & -1 \\ 0 & 0&0\\ 1 & 1&1 \\ end{matrix} \right\} 101101101

{ − 1 0 1 − 1 0 1 − 1 0 1 } \left\{ \begin{matrix} -1&0 & 1 \\ -1 & 0&1\\ -1 & 0&1 \\end{matrix} \right\ } } 111000111

3Sobel function
{ − 1 − 2 − 1 0 0 0 1 2 1 } \left\{ \begin{matrix} -1&-2 & -1 \\ 0 & 0&0\\ 1 &2&1 \\ \end{matrix}\ right\} 101202101

{ − 1 0 1 − 2 0 2 − 1 0 1 } \left\{ \begin{matrix} -1&0 & 1 \\ -2 & 0&2\\ -1 & 0&1 \\end{matrix} \right\ } } 121000121

4The placeholders
{ 1 1 − 4 1 1 } \left\{ \begin{matrix} &1 & \\ 1 & -4&1\\ & 1&\\ \end{matrix}\right\} 11411

Image segmentation

Threshold-Based Segmentation Methods

By setting different feature thresholds, the image pixels are divided into images occupying different gray scale ranges. The key point of this method is to determine the feature threshold in advance.

Region-Based Segmentation Methods

There are two methods: one is region growing, starting from a single pixel, and gradually merging to form the required segmentation region; the other is region splitting and merging, starting from the global, and gradually cutting to the required segmentation region.

Segmentation method based on edge detection

Edges are identified for segmentation using the above edge detection operator. There are two problems: 1. The continuity and closure of edges cannot be guaranteed; 2. There are a large number of fragmented edges in high-detail areas.

Guess you like

Origin blog.csdn.net/m0_49963403/article/details/129018244