Eroding an image by a structuring element results in an image that gives all locations where the structuring element is contained in the image. If the SE represents the tolerance for deviation from the artwork, then the resulting image shows the differences that are considered as functional. Selection of a SE is a key point in classification of a difference pattern. A proper SE determines what is considered as defect and what is not. Any difference between the artwork and the test image can not be classified as a defect solely based on the size or the shape of the pattern.
Functional defects are context-dependent.
A difference pattern of a particular shape and size may constitute a visual defect for one type of generic pattern while it may be considered as a functional defect for another one. Thus a single SE can not be used for filtering and classification of difference patterns. Depending on the trace pattern to be inspected, different SEs must be selected in an adaptive fashion. Structuring element selection Difference patterns that indicate functional defects vary for different underlying trace patterns. The structuring element must be selected in consideration with shape and size of the enclosed pattern and allowed tolerances.