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.


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


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.


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.


(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.


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.

(X Direction Sobel)

(Y Direction Sobel)
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 |
---|---|
Averaging + Median | 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.