Image Enhance Filters

Basic pretreatment filters

The purpose of understanding image processing fundamentals is to enable users to capture the most accurate images. In addition, by using pretreatment filtering image content inspections can process an optimal image (correct focus and contrast).

The potential for stable examination is increased by implementing pretreatment filters before the processing of flaw detection, dimensional measurement, and other forms of inspections occur. Selecting the optimal pretreatment filter is explained in greater detail ahead.

Basic types of pretreatment filters

Below, four types of pretreatment filters are described. Each filter uses a 3x3 principle to perform pretreatment calculations, and process the image.

Example of the original image

Expansion filter

The maximum density (brightest value) of nine pixels are inspected and the center pixel is adjusted to the largest density value.

Expansion

Shrinkage filter

The minimum density (darkest value) in nine pixels is identified and the center pixel is adjusted to that value. Dark pixels are therefore emphasized and a more stable flaw detection is performed.

Shrinkage

Averaging filter

The average density of nine pixels is calculated (2+5+9+7+3+0+1+2 / 9 =3.66, rounded to the 1/100 decimal point) and the center pixel is adjusted to the average value.

This stabilizes the image and reduces the effect of noise which may cause blurry images.

Averaging

(2 + 5 + 9 + 7 + 3 + 0 + 1 + 2)/9 = 3.66
Round down decimal values to obtain 3.

Median filter

The density of the center pixel is adjusted to the fifth element in the order of density value. This allows for a more stable removal of noise.

Median

POINT

For image processing, it is important to capture clear images to exactly reproduce the image seen by the human eye. For some inspection purposes, enhancing features (expand, shrink) or blurring them to reduce noise components (averaging, median) may yield more appropriate inspection results, instead of using precisely reproduced images.

To understand image enhancement, remember to perform these image enhancement methods for all pixels.

Edge extractions and enhancement filters

Below, pretreatment filters such as Edge Extraction and Edge Enhancement are used to emphasize the characteristics which are contrasting to the original image. Edge filters have many purposes and selecting the appropriate one for each situation should be based on the knowledge and theory of each filters correct use. The use of Sobel and Prewitt and the extraction of edges in the X and Y directions are described ahead.

Sobel and Prewitt

Sobel and Prewitt are edge extraction processes that extract edges in the X and Y direction separately and then combine the results. After multiplying by a determined coefficient the center pixel is then replaced with an appropriate added density value.

Sobel

Prewitt

Edge extraction series summary

Differential Horizontal direction Vertical direction Diagonal direction Others
Prewitt First differential
Sobel Second differential
Roberts First differential
Laplacian Second differential Doesn't depend on the direction

◎○△These symbols show the strength.
When intensity is high, changes that should be ignored as noise may also be extracted.

Direction specific edge extraction filter

Edge extraction in the X and Y direction using sobel is leveraged by the limitations of the defect length in both the vertical and horizontal directions.

Differences between the Edge Extraction filter and the Edge Enhancement filter

Edge enhancement is a process that clarifies blurred images. It is different from the Edge Extraction filter in that it emphasizes the concentration of the center pixel by adjusting the combined result of nine pixels to zero and one. As for edge extraction, if the nine pixels have the same data, the density will be 0. However, the density of the center pixel is emphasized and remains.

POINT

The Edge Extraction filter processes the concentration of the center pixel of the 3x3, top and bottom (X direction), and right and left (Y direction), and replaces them. It is necessary to select the type of noise presence and the direction to emphasize. Furthermore, please note that even though the Edge Enhancement filter is uniform, the center pixel of the noise element will increase.

Example filter technique applications

The CV-X is capable of inspecting one region with two or more pretreatment filters able to repeatedly inspect one region with two or more pretreatment filters. It is possible to process the optimal image using each filter if the theory of the filter is known.

Example1. Outline smoothing : expand(X) + shrink(Y)

The expand and shrink filters are applied at the same time and are able to remove uneven contours and burrs, thereby, maintaining an even surface for inspection.

Before

After

Example2. Emphasize microscopic flaws : Sobel + binary + expansion

Sobel + Binary + Expand (stain enhancement)
First, the sobel filter extracts the edges of the flaw. Then, using binarization to compile a black and white image and emphasizing the white pixels using the expansion filter the flaw is made to clearly stand out.

Before filtering

Sobel

Binarization + expansion

Example3. Smoothing noise components Averaging + Median

This technique is effective for stabilizing measurements in edge detections. This method uses the averaging filter to eliminate the effect of blurred images and the median filter to more accurately stabilize noise.

Before filtering

Waveform of edge intensity(Conceptual image)

After filtering

Waveform of edge intensity(Conceptual image)

Typical Repeatability of unstable edge detections

No filter 6.27 pixels 0.3 pixelsStabilized

Summary of image enhance filters (part 1)

These are the basics of image enhancement.

• First, capture a good source image (clear focus, high contrast).
If there are features that need enhancement, perform image modification (image enhance filters).
• Typical image enhancement replaces the value of the center pixel in every set of 3 x 3 pixels to a desired enhancement result obtained with various coefficients applied to the density values of the surrounding pixels.
• You can ensure stable inspection by understanding the principles of individual image enhance filters and using the image enhance filters, solely or in combination, most effective for your application.

The next topic is the image enhance filters (part 2) to modify images to obtain optimum results. In addition to the basic image enhance filters described above, there are other new, advanced image enhance filters such as the subtraction and real-time image extraction filters. Let's look at the effects of these filters in detail.

Selecting and setting image enhance filters

Subtract filter

The real time image compared to the registered image. The flaw is isolated and then extracted.

The Subtract filter is a pretreatment function that compares the input image against the registered master image and extracts the differences between them. In consideration of the minor differences between individual items for inspection, it is possible to adjust the extent to which a slight difference between objects is recognized as defective.

It calculates the difference absolute value between the registered image and the density value of the input image and outputs the difference image.

Conventionally, image sensors have focused on detecting scratches and small imperfections such as spots and dirt. However, in addition to these types of detections, the Keyence CV-X Series can be used for distinguishing profile changes - something that was difficult with normalized correlation values.

Real-Time Subtract Filter

The Real-Time Subtract filter compares the raw image with a copy of the raw image that has been processed with the Expand and Shrink filters, and extracts spots and other small faults. This filter eliminates the need for target misalignment correction and allows inspection to be conducted with a single setting.

Fault detection on the inside of a cup-normal image(Area settings are complex because they must be adjustedaccording to target shape)

Real-Time Subtract image(Allows inspection of small areas)

Principles of the Real-Time Subtract filter

The black spot disappears when Image 1 is expanded. Image 2 is shrunk and returned to the same size as the raw image. Image 3 is subtracted from Image 1 to leave only the black spot. This process is executed on every captured image, so even if the shape of the raw image changes, stable detection is still obtained.

Contrast Conversion filter

In order to increase the contrast and the stability of external inspection, the CV-3000 Series is equipped with a Contrast Conversion filter. This pretreatment filter turns the camera's span and offset functions into independent pretreatment filters, which allows them to be adjusted on a window-by-window basis. This allows the contrast of specific tones in the raw image to be emphasized.

Raw image

Improved Contrast

Image after contrast conversion

Multi-filter effects

The CV-X Series includes a variety of pretreatment filters. Several of these filters can be applied at once to the same area to create images that are suitable for external inspection. In the following example, the Real-Time Subtract filter has been combined with the Shrink, Average, and Contrast Conversion filters to produce an almost completely white image with only a black flaw remaining.

[Roles of the filters in this example]

Real-time image extraction This filter leaves only black spots on the target. This filter enlarges the remaining black spots so that they are one size larger. This filter smooths surrounding noise. This filter enhances the contrast between black spots and their surrounding areas.

Summary of image enhance filters (part 2)

Remember the following points regarding image enhance filters using image calculation and brightness correction.

• Image calculation filters extract differences between the input and source images and can be used effectively for stain/flaw inspection.
• The contrast conversion filter allows contrast adjustment based on the adjustment of the slope of shade data for each window.
• You can obtain an optimum image for inspection by combining the image enhance filters described in Part 1 and Part 2.

The next topic is practical knowledge about appearance inspection settings that can be used in the field. In addition to the knowledge of hardware and software already described, it is helpful to know some practical knowledge and techniques.