Dimension measurement / edge detection

Dimensional inspection using edge inspection is the latest application trend of image sensors. The image sensor can show the inspected object on the plane, and measure the position, width, angle, etc. through edge detection.

Next, the principle of edge inspection will be introduced according to the processing process. Understanding the principles helps optimize inspection settings. In addition, some representative examples of edge inspection and the selection method of pretreatment filter that can stabilize the inspection effect will also be introduced.

Principle of edge detection

The so-called edge refers to the edge of the bright part and the dark part of the image. Edge detection is to detect the edge of this change through the visual system.

The edge can be obtained through the following four processes.

(1) Projection processing

The image in the measurement area is projected. Projection processing is to scan vertically relative to the inspection direction, and then calculate the average concentration of each projection line. The projection line average concentration waveform is called the projection waveform.


What is projection processing?


Calculate the average concentration in the projection direction.

It can reduce the inspection errors caused by noise in the area.

(2) Differential processing

Differential processing is carried out according to the projection waveform. The differential value of parts that may become edges and have large changes in intensity is also large.


What is differential processing?

The process of calculating the variation of intensity (grade).

It can eliminate the influence caused by the change of absolute value of concentration in the region.

Example: the differential value of the part without change in intensity is 0.

The value when white (255) → black (0) is -255.

(3) The maximum differential value is 100% through correction

In the actual production line, in order to make the edge reach a stable state, appropriate adjustments are usually made to make the absolute value of the differential reach 100%.

Take the peak value of the differential waveform that exceeds the preset “edge sensitivity (%)” as the edge position. According to the detection principle of the peak value of intensity change, the edge can also be detected stably on the production line where the illumination often changes.


(4) Sub pixel processing

For the three pixels near the center of the largest part of the differential waveform, the correction algorithm is performed according to the waveform formed by these three pixels. Measure the boundary position in 1/100 pixel (sub-pixel processing).

pYYBAGKdr6-AYD7GAAB_ TkjKa_ w917.png

Representative application of edge detection

Edge check has the following derived modes. Its representative applications will be introduced below.


< example 1 > various examinations using the edge position

Set the edge position mode in multiple parts to measure the X coordinate or Y coordinate of the detection object.


< example 2 > various inspections using edge width

Use the “external dimension” mode of edge width to detect the width of the metal plate and the aperture in X direction /y direction of the hole.


< example 3 > various inspections using the peripheral area of the edge position

Take the circumference as the detection area to detect the angle (phase) of the cut-out part.

pYYBAGKdr_ eAWkgGAAEBmpqmDXg392.png

< example 4 > various inspections using trend edge width

Use the “trend edge width” mode in the “circumference” area to scan the inner diameter of the annular workpiece and evaluate the flatness.


Trend edge mode

The trend edge position (width) mode refers to detecting the edge position while scanning the narrow edge window in the inspection area. Using this inspection mode, the edge position (width) of multiple points in a window can be checked, so it can ensure to capture small changes in the workpiece.


Detection principle

Make the segmentation in a small range move with small spacing, and check the edge width or edge position of each point.

Methods to improve the accuracy of position detection:

Reduce split size

Ways to shorten processing time:

Reduce the division shift amplitude (movement amount).

Trend direction:

Split the direction of movement.


Pretreatment filter to improve the effect of edge inspection

The key of edge inspection is how to minimize the unevenness of edges. The pretreatment filter has the function of “median” or “averaging”, so it helps to maintain a stable inspection effect. The characteristics and selection methods of pretreatment filter are introduced below.

Original image




three × 3 pixel average filter. It can effectively reduce the influence of noise factors.



three × Median filter of 3 pixels. It can effectively reduce the influence of noise factors while keeping the image clear.

How to optimize the pretreatment filter?

Generally speaking, through “median” or “averaging”, we can get a stable edge inspection effect. However, for a specific workpiece, which filter should be selected to get the best effect? The statistical method for evaluating the deviation of the measured value of each filter will be introduced below.


CV series (above cv2000) has the function of statistical analysis, which can save and statistically analyze the measured data.

Using this function, the best filter setting can be obtained by repeating the measurement under the static state with “no filter”, “median”, “average”, “median + average” and “average + median” respectively, and confirming the statistical results of each data.

Key points of image sensor edge inspection mode:

Make effective adjustment on the basis of understanding the principle of edge inspection.

Understand various derivative models and significantly improve the possibility of inspection.

Reference to representative inspection cases is helpful for the work.

Select the best pretreatment filter through experiments to improve the inspection speed and inspection effect.

Leave a Reply

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