Edge detection: Canny operator, Sobel operator, Laplace operator

1、cannyoperator

CannyThe edge detection operator was developed by John F.Canny in 1986.Multilevel edge detectionAlgorithm. More importantly, Canny created the Computational Theory of edge detection to explain how this technique works. Canny edge detection algorithm in the name of Canny.Word naming is regarded by many as the best edge detection algorithm nowadays.

Among them, Canny’s goal is to find an optimal edge detection algorithm, let’s look at the three main evaluation criteria of optimal edge detection:

1.Low error rate: Identify as many actual edges as possible and minimize noise misinformation as much as possible.

2.High localization: The edges identified should be as close as possible to the actual edges in the image.

3.Minimum response: The edges in the image can only be identified once, and the existing image noise should not be identified as edges.

Canny Steps of edge detection:

1.Elimination of noise。 In general, the Gauss smoothing filter is used to convolution denoising. The following example shows a Gauss kernel example of size = 5:

2.Calculate gradient magnitude and direction。 Here, follow the steps of the Sobel filter.

  Ⅰ.Using a pair of convolution arrays (respectively in X and Y directions):

            

  Ⅱ.The following formulas are used to calculate the magnitude and direction of the gradient.

           

The gradient direction approximates to one of the four possible angles (generally 0, 45, 90, 135).

 3.Non maximum suppression。 This step excludes non edge pixels and only preserves some fine lines (candidate edges).

 4.Lag threshold。In the last step, Canny uses the lag threshold, and the lag threshold needs two thresholds (high threshold and low threshold):

  Ⅰ.If the amplitude of a pixel exceeds the high threshold, the pixel is reserved for the edge pixels.

  Ⅱ.If the amplitude of a pixel is smaller than the low threshold, the pixel is excluded.

  Ⅲ.If the amplitude of a pixel’s position is between two thresholds, the pixel is retained only when connected to a pixel above a high threshold.

 tips:For the use of Canny functions, the recommended high and low thresholds are between 2:1 and 3:1.

 For more details, you can refer to the Wikipedia of the Canny operator.

 cannyThe principle of edge detection tells us about this blog.

 cannyChinese Wikipedia operator

 2、sobeloperator

Sobel The operator is aDiscrete differential operators are mainly used for edge detection. (discrete differentiation operator)。 Its Sobel operator combines Gaussian smoothing with differential derivation to calculate the approximate gradient of image gray function. When using this operator at any point in the image, the corresponding gradient vector or its normal vector will be generated.

 sobelWikipedia of operators

 sobelThe concept of operator can also be seen in this blog.

 sobelThe calculation process of operators:

 We assume that the image being acted is I. and then do the following operations:

 1.In two directions, X and Y respectively.

   Ⅰ.Horizontal change: I and an odd size kernel.Convolution. For example, when the kernel size is 3,The calculation results are as follows:

 

  Ⅱ.Vertical variation: I: an odd numbered kernel.Convolution. For example, when the kernel size is 3,The calculation results are as follows:

 

2.At each point of the image, the approximate gradient is obtained by combining the above two results.

 

In addition, the following simpler formulas can be used instead.

 

3、Laplaceoperator

Laplacian Operator is a second-order differential operator in n-dimensional Euclidean space, which is defined as divergence div () of gradient grad (). So if f is a two order differentiable real function, the Laplasse operator of F is defined as:

(1) fThe Laplasse operator is also the sum of all non mixed two order partial derivatives in Cartesian coordinate system Xi:

(2) As a two order differential operator, the Laplasse operator maps the C function to the C function for K equal to 2. The expression (1) (or (2)) defines an operator_: C (R) C (R), or more generally, an operator_: C (_) C (_), pairsIn any open set.

According to the principle of image processing, we know that the two derivative can be used to detect edges. Because the image is “two-dimensional”, we need to make derivative in two directions. Using Laplacian operator will simplify the derivation process.

Laplacian Definition of operator:

 

The point to crack is that since Laplacian uses an image gradient, its internal code actually calls the Sobel operator.

A small tips is added: to make an image subtract from its Laplacian can enhance contrast.

 As for the related concepts of Laplace operators, we can refer to this blog.

 LaplaceWikipedia of operators

 

Leave a Reply

Your email address will not be published. Required fields are marked *