1.Basics of Appearance Inspection

1.1 Principles behind the stain inspection tool

The vision system detects changes in intensity data from a CCD image sensor as stains or edges. However, it takes an enormous amount of time to process every pixel, and noise may affect inspection results. Therefore, the vision system uses the average intensity of a small area consisting of several pixels. In the CV-X Series, this small area is called a “segment”, and the average intensity of these segments is compared to detect stains. Algorithm of the stain inspection tool (Comparison and calculation methods of segments)
This section explains the algorithm of the stain inspection tool equipped on the CV-X Series. Detection principle (When the detection direction is specified as X) 1.The stain inspection tool measures the average intensity of specified areas (segments) and shifts them by 1/4 the area of a segment size. 2.It determines the difference between maximum and minimum intensities of 4 segments, including a standard segment (① 95 in the figure below). The difference is considered the stain level of a standard segment. 3.When the stain level exceeds the present threshold, the standard segment is counted as a stain. The number of times the preset threshold is exceeded in a measured area is called the “Stain Area”. The process repeats to constantly shift the standard segment within the measured area. In the subsequent processes, steps (1) to (3) are repeated while the target segment is shifted by the travel range within the area. Summary of principle behind the stain inspection tool The stain inspection tool is a tool that detects change points of density as scratches and dirt compared to the surrounding every small unit of several pixels called "segment". By processing for each segment, it is possible to realize high speed while reducing the influence of noise, and by comparing with surrounding segments from multiple candidates, "small scratches" and "thin stains" etc. which were difficult to detect conventionally It can now be detected.

1.2 Optimal settings for the stain inspection tool

Optimal segment size
This section explains how to set the stain inspection tool appropriately. It is possible to optimize the detection sensitivity and processing time by adjusting the segment size. The graph on the right shows changes in the stain level and processing time according to the segment size (with KEYENCE’s CV-X Series). When the segment size is almost the same as the target size, the stain level is at maximum. This means that the detection sensitivity and processing time can be optimized by adjusting the segment size to the actual target size. Optimal segment size = Stain size (mm) × No. of pixels in the Y direction / Field of view in the Y direction (mm) Ex.) When the stain size is 2 mm2 and field of view is 120 mm2, and a 240,000-pixel camera is used (480 pixels in the Y direction), 2 × 480 ÷ 120 = Segment size 8 Segment shift / Gap adjustment according to the image
The stain inspection tool parameters, Segment shift and Gap adjustment, determine the amount of segment shift for intensity comparison. Small flaws and subtle stains, which have different features, can be detected by adjusting these parameters. In order to detect small flaws, it is necessary to finely compare segment intensities by setting both Segment shift and Gap adjustment to small values. On the other hand, in order to detect subtle stains, it is necessary to broadly compare segment intensities by setting both parameters to large values. In this way, the appropriate settings, which correspond to the type of flaw or stain, lead to stable detection. Summary of optimum setting for Stain mode Adjustment of the optimum segment size and travel range/comparison interval setting allows optimum inspection of targets. You can ensure optimum settings by adjusting the segment size to be the same as the size of the stains/flaws; and determine the travel range and comparison interval based on the size and shade level of the stains/flaws.

1.3 Stain Inspection on Circular Workpieces

Many kinds of circular workpieces, such as PET bottles, bearings or O-rings require a circular area for visual inspection. When the CV-X Series is searching a circular area, the program is performing polar coordinate conversion(极坐标转换 ). In order to detect stains, it converts a circular window (inspection segments) into rectangles and compares the segments’ intensities in both circular and radial directions.

1.4 Useful pre-processing filters for the stain inspection tool

Subtraction filter: When printing should be ignored to detect only a stain
If only intensity changes are measured without any reference, it is impossible to distinguish between stains and proper printing. Printing with more contrast than a stain is subsequently detected as a flaw. In pre-processing, a proper image is registered and then compared with the current image with the subtraction filter. Then, the average intensity of the filtered image is compared in 256 levels. This enables stain inspection of workpieces with complicated printing. Real-time subtraction filter
The real-time subtraction filter extracts only small defects by differentiating the original image from an image using the Expansion and Shrink filters. With this filter, you neither have to specify the inspection area nor adjust for the displacement of the target (good for complicated shapes). You can inspect targets with complicated shapes by adding one simple setting adjustment. Principle of the real-time subtraction filter

1.5 Summary of Visual/Stain Inspection

Note the following 3 points for optimal use of the stain inspection tool: Adjust the segment size to the stain size Set segment shift / gap adjustment according to the stain size or intensity Use pre-processing filters according to the workpiece conditions However, clear images are definitely important to take full advantage of the vision system features. In order to capture clear images, review Machine Vision Academy Vol. 1 to 4.

2.Basics of Dimension Inspection

Dimension measurement using edge detection is a recent trend of image sensor applications. In dimension inspection using image sensor, position, width, angle can be measured by capturing the object in two dimensions and detecting the edge. Here, the principle of edge detection is explained according to the processing process. Understanding the principle makes it possible to set the detection to the optimum state. In addition, we introduce representative inspection examples using edges and explain how to select preprocessing filters for detection stabilization.

2.1 Principle of Edge Detection

An edge is a border that separates a bright area from a dark area within an image. To detect an edge this border of different shades must be processed. Edges can be obtained through the following four process steps. (1)Perform projection processing
Projection processing scans the image vertically to obtain the average intensity of each projection line. The average intensity waveform of each line is called the projected waveform. (2)Perform Differential Processing
Larger deviation values are obtained when the difference in shades are more distinct. What is the differential processing? Differential processing eliminates the influence caused by changes in absolute intensity values within the measurement area. (Example) The absolute intensity value is "0" if there are no changes in shade. If color changes from white (255) to black (0), the variation is -255. (3)Maximum Deviation Value Always Needs to be 100%
To stabilize the edge in actual production scenarios, internal compensation is performed so that the maximum deviation value is always maintained at 100%. Then, the edge position is determined from the peak point of the differential waveform where it exceeds the preset edge sensitivity (%). This method of edge normalization ensures that the edge's peak point is always detected, stabilizing image inspections that are prone to frequent changes in illumination. (4)Perform Sub-Pixel Processing
Focus on the adjacent three pixels of the maximum differential waveform and perform interpolation calculations. Measure the edge position in units down to 1/100 of a pixel (sub-pixel processing).

2.2 Examples of inspection using edge detection

Edge detection includes many of the tools shown below. This section introduces some examples of frequently used tools. PROFILE POSITION TOOL
The profile position tool combines a group of narrow edge windows to detect the edge position of each point. Since all of the data is collected within one inspection tool, it becomes easy to detect minute fluctuations by calculating minimum, maximum, and average values over the entire part. Detection principle By moving the narrow area segments in small pitches, the edge width and edge position of each point is detected.
  • If highly accurate position detection is required, Reduce the segment size.
  • If highly accurate position detection is required, Reduce the shift width of the segment.
  • If highly accurate position detection is required, The direction towards which the segment is moved.

2.3 Pre-processing filter to further stabilize edge detection

In edge detection, it is very important to suppress the variations of edges. "Median" and "average" filters are effective at stabilizing edge detections. This section explains the characteristics of these pre-processing filters and effective selection method. How to optimize the pre-processing filter Though “median” and “averaging” generally lead to the stabilization of edges, it is difficult to know which is effective for the target object. This section introduces a method of statistically evaluating the variations of measurements when these filters are used. The CV-X series (CV2000 or later) is equipped with a statistical analysis function. This function records the measured data internally and performs statistical analysis simultaneously. By repetitively measuring the static target with “no filter,” “median,” “averaging,” “median + averaging,” and “averaging + medial” the optimum filter can be selected.