
The formation of edges is due to the different materials of objects or different surface orientations, which causes changes in brightness, color, and texture at the edges of the image. Therefore, the edges can be obtained by checking the intersection of different grayscale, color and other characteristic areas in the image. The edge contour is an important factor for humans to recognize the shape of objects and is also an important processing object in image processing. Edge detection mainly uses various algorithms to discover and enhance those pixels in the image that may have edges.
Since the edge is the result of discontinuity in grayscale value, this discontinuity can often be easily detected by taking derivatives. Generally, first-order and second-order derivatives are selected to detect edges. In machine vision detection, edge detection can be completed by convolution with the help of spatial differential operators. In fact, in digital image processing, derivatives are taken by using differential approximation. Commonly used differential operators include gradient operator and Laplace operator.

1. Filtering: The edge detection algorithm is mainly based on the first and second order derivatives of the image intensity, but the calculation of the derivative is very sensitive to noise, so filters must be used to improve the performance of the edge detector related to noise.
2. Enhancement: The basis of edge enhancement is to determine the change value of the neighborhood intensity of each point in the image. The enhancement algorithm can highlight the points with significant changes in neighborhood (or local) intensity values.
3. Detection: There are many points in the image with large gradient amplitudes, but these points are not all edges in specific application fields, so some method should be used to determine which points are edge points. The gradient amplitude Ill value criterion is often used.
4. Positioning: If an application requires the determination of the edge position, the edge position can be estimated at sub-pixel resolution, and the orientation of the edge can also be estimated.

When using machine vision for dimensional measurement, these four steps are essential, especially the precise position and orientation of the edge must be pointed out. Machine vision inspection technology, with its powerful performance advantages, standardizes product quality, has fast inspection speed, reliable and stable inspection results, and can inspect for a long time, and is widely used in various fields.
