Summary of Image Edge detection

Source: Internet
Author: User

The edge is the area boundary where the grayscale in the image changes dramatically. The change of image gray scale can be expressed by the gradient of gray distribution of image, and the derivative in digital image is made by differential approximate differential, in fact, the common domain differential operator is accomplished by convolution.

First Order derivative operator

1) Roberts operator

Roberts operator is a gradient calculation method of oblique deviation, the size of the gradient represents the strength of the edge, and the direction of the gradient is perpendicular to the edge. The Roberts operation is in fact a rotation of 45 degrees in two directions of the differential value and. The Roberts operator has high positioning accuracy, good effect in horizontal and vertical direction, but is sensitive to noise. Two convolution cores GX,Gy respectively:


The magnitude of the gradient measured by the 1 norm is:

2) Sobel operator

The Sobel operator is a set of directional operators that detect edges from different directions. The Sobel operator is not simply the average re-differential, but the weighted value of the pixels in the upper and lower 4 directions of the center pixel is strengthened, and the result is a pair of edge graphs. Sobel operators usually have better image processing with grayscale gradients and noisy noises. Two convolution cores Gx,Gy respectively:

The magnitude of the gradient is measured by the norm:

3) Prewitt operator

The Prewitt operator is a kind of edge template operator, which uses the gray difference between the left and right neighboring points of pixel points to reach the edge of edge detection at the edges, and has a smooth effect on noise. Because the gray value of the edge pixel is significantly different from the gray value of its neighbor point, the edge of the image is usually detected by differential operator and template matching method in practical application. The Prewitt operator can not only detect the edge point, but also suppress the influence of noise, so it is better to process the image with more gray and noise. Two convolution cores Gx,Gy respectively:


The magnitude of the gradient is measured by the norm:




The second derivative operator can also detect the edge, and the second derivative operator to detect the stepped edge requires the detection operator and the image convolution and determine over 0 points.

1) Laplacian operator

The Laplace operator is a common second-order derivative operator. In practice, the position of the edge can be determined according to the properties of the second derivative operator over 0 points. For a continuous function f (x, y), its Laplace value in position (x, y) is defined as follows:

In the image, the Laplace value of the computed function can also be implemented with various templates. The basic requirement for a template here is that the coefficients of the corresponding center pixels should be positive, while the coefficients corresponding to the pixels adjacent to the center pixels should be negative, and their sum should be zero. Laplace operator detection method often produces two-pixel boundary, and this detection method is very sensitive to the noise in the image, can not detect the direction of the edge, so rarely directly using the Laplace operator for edge detection. The two common types of templates are:


2) MAL operator

The MAL operator is implemented on the basis of the Laplacian operator. Laplacian operator is sensitive to noise, and in order to reduce the influence of noise, the image can be smoothed before the Laplacian operator is applied. Since imaging, the light intensity contribution of a given pixel point around the spot is Gaussian, so the smoothed function can use the Gaussian weighted smoothing function.

The Laplace operator, combined with Gaussian filtering, forms the log operator and is also a Laplace-Gaussian (Laplacian-gauss) operator. The log operator is an improvement to the Laplacian operator, and he needs to consider the processing of the 5*5 neighborhood to obtain better detection results.

The calculation of the MAL operator is as follows:

1. Using a 2-d Gaussian smoothing template with original image convolution

2. Calculate the convolution after the Laplace value.

3. Detect over 0 points of the Laplace image as edge points.

3) Canny operator

The canny operator considers the problem of edge detection as the maximum value of the unit function. Using the Gaussian model, he points out that a good edge detection operator should have 3 indicators, using the concept of image filtering:

1. The low rate of failure, both the real edge of major general to discard, but also to major General non-marginal award for the Edge;

2. High position accuracy, the detected edges should be on the true boundary;

3. A single pixel edge, that is, a unique response to each edge, resulting in a single pixel width of the boundary.

Considering the above three conditions, canny proposes 3 criteria for judging the edge detection operator: signal-to-noise ratio criterion, positioning accuracy criterion and single-edge response criterion.

1. Signal-to-noise ratio criteria

The higher the signal-to-noise ratio, the higher the quality of edge extraction. SNR is defined as:


where G (x) represents the Edge function, h (x) represents the impulse response of a filter with a width of W.

2. Positioning accuracy Criteria

The precision L for edge positioning is defined as follows:


where G ' (x) and H ' (x) are the derivatives of g (x) and H (x), respectively. L Larger indicates higher positioning accuracy.

3. Single-Edge response criteria

To guarantee only one response for a single edge. The average distance D (f ') of the 0 intersection point of the impulse response derivative of the detection operator should meet

Operators that satisfy the above three conditions are called canny operators. The steps for the canny edge detection algorithm are as follows:

(1) Smoothing the image with a Gaussian filter;

(2) The amplitude and direction of the gradient are calculated by using the finite difference of first order bias.

(3) The non-maximal value of the gradient amplitude is suppressed;

(4) Detect and link edges with a double threshold algorithm.


OPENCV Edge detection functions are available-Canny(),Sobel(),Lapacian(),ScHARR().

Matlab The edge detection function is simple and can be done with just one edge () function, for example:

Clear Allclcclose all%% i=imread (' rice.tif '); J1=edge (I, ' Roberts '); J2=edge (I, ' Sobel '); J3=edge (I, ' Prewitt '); J4=edge (I, ' log '); J5=edge (i, ' canny '); subplot (231), imshow (i); Title (' src '), subplot (232), Imshow (J1), title (' Roberts '), subplot (233), Imshow (J2), title (' Sobel '), subplot (234), Imshow (J3); title (' Preitt '); subplot (235), imshow (J4); title (' Log '); subplot (236), imshow (J5); title (' Canny ');


Summary of Image Edge detection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.