M. Nieniewski, L. Chmielewski, A. J騧wik, M. Sk這dowski, Morphological detection and feature-based classification of cracked regions in ferrites, Proc. Euromech Colloquium 406: Image Processing Methods in Applied Mechanics IPMAM'99, pages 151-154, May 6-8, 1999, Warsaw, Poland. T.A. Kowalewski, W. Kosi雟ki, J. Kompenhans (Eds.), IFTR Reports 4/1999, Institute of Fundamental Technological Research, PAS, 1999.
MORPHOLOGICAL DETECTION AND FEATURE-BASED CLASSIFICATION
OF CRACKED REGIONS IN FERRITES
Mariusz Nieniewski*,****, Leszek Chmielewski**,****, Adam J騧wik*** and Marek Sk這dowski**,****
*
Department of Fundamental Research in Electrical Engineering, PAS http://www.iel.waw.pl/nbp
Summary Automatic quality inspection of ferrite products is difficult as their surfaces are dark and in many cases covered with traces of grinding. A two-stage vision system for detection and measurement of crack regions was devised. In the first stage the regions with strong evidence for cracks are found using a morphological detector of irregular brightness changes and a morphological reconstruction. In the second stage the feature-based K-nearest neighbor classifier analyzes the pixels indicated in the first stage. The classifier is optimized by using procedures of reclassification and replacement made on the reference pattern set of pixels to achieve low error rate and a maximum speed of computation. The whole system is at a final stage of development and gives acceptable results within a reasonable time.
INTRODUCTION
Automatic quality inspection of ferrite products is a challenging task. The main difficulties in defect detection stem from the fact that the surface of ferrite cores is relatively dark, and in many cases it is covered by a pattern of traces of the grinding, called grooves. A two-stage vision system for detection and measurement of crack regions was devised. In the first, detection stage the regions with strong evidence for cracks are detected. The main tool used are morphological operations detecting irregular changes of brightness in the image. Subsequently, a morphological reconstruction of cracks is carried out. By changing the threshold for the binarization of the gray level map of defects one obtains both the marker and the mask necessary for the reconstruction. The resulting reconstucted binary map usually contains most of the cracks together with the undesired information on the grooves. The second stage of the vision system includes a feature-based parallel K-nearest neighbor classifier which analyzes only the pixels detected in the first stage. The detector is fast, but it assigns too many pixels to cracks. The classifier, which is slower, corrects the result. The detector is indispensable for reduction of data for the classifier. Experimental results obtained at the present stage of system development are presented in the end of the paper.
DETECTION OF CRACKS
An example of grooves resulting from the grinding is shown in Fig. 1a. They form a pattern of more or less parallel dark and bright lines, which complicates the detection of cracks. To carry out the morphological operations for crack detection the structuring element should be rotated relative to the image. However, rotation of small structuring elements by an arbitrary angle can only be made in a very rough manner, and it is more practical to rotate the image so that the grooves are parallel to the vertical or horizontal line, with the allowable deviation of 10 to 20o. Fig. 1a shows the rotated image.
Morphological detection of various kinds of defects, such as pull-outs, chips etc. has already been described [1,2]; in particular, the detection of cracks on the surface void of grooves [2]. In Table 1 the sequences of operations for detecting the cracks are shown. The first five lines of these sequences, used for detection of defects brighter than the surroundings, are described by the equation [1,2]
where is the input image, the output image and is the structuring element. The symbols and denote the operations of closing and opening, respectively. The structuring element in the form of a line segment of length of five pixels was selected experimentally. For detecting (parts of) horizontal cracks the vertical element 1x5s is used, and for vertical cracks the horizontal element 5x1s is used (see Table 1).
a b c d
Figure 1. Detection of cracks. a) original; b) result for vertical structuring element; c) result for horizontal structuring element; d) summation of maps of b and c.
The described crack detection results in gray level maps of cracks denoted by d.tif. By thresholding the complemented maps (d.tif) one can obtain the gray level maps indicating the position of cracks. However, using Eq. (1) results in detection of irregular changes of brightness rather than brighter spots in the image, so the exact shape of cracks remains unknown. As shown in Fig. 1, it is quite hard to distinguish between cracks and brighter grooves resulting form grinding. Thresholding the gray level maps of cracks gives gives binary maps containing the masks of both the cracks and the bright grooves resulting from the grinding. In order to improve the maps the following approach is used. The gray level maps are thresholded twice: with a low threshold equal equal to 5, and with a higher one equal to 15. The idea is the following. In the binary map dt15.tif the information about the cracks is prevalent since cracks are usually to some degree brighter than the grooves obtained from grinding. However, quite often the difference is not pronounced. By using a relatively high threshold one obtains information on the cracks, but the masks of cracks are relatively incomplete. In order to restore the exact shape of the cracks and only the cracks, the binary reconstruction [2,3] is carried out as shown in the second line from bottom in Table 1. The map dt5.tif is used as a mask, and the map dt15.tif is used as a marker. The result is the map rec5.tif, shown in complemented form rec5i.tif in Figs. 1b, c.
The map in Fig. 1b is in principle satisfactory. The map in Fig. 1c contains the masks of cracks together with the masks of bright grooves resulting from grinding. The classification procedure for removing the masks of the bright grooves is discussed in the next section.
Sequence of operations for detecting vertical cracks |
|
CLOSING input.tif a.tif 1x5s OPENING a.tif b.tif 1x5s MINIMUM input.tif b.tif c.tif SUBTRACTION input.tif c.tif d.tif COMPLEMENT d.tif di.tif THRESHOLD d.tif dt5.tif 5 THRESHOLD d.tif dt15.tif 15 RECGRAY dt5.tif dt15.tif rec5.tif COMPLEMENT rec5.tif rec5i.tif |
CLOSING input.tif a.tif 5x1s OPENING a.tif b.tif 5x1s MINIMUM input.tif b.tif c.tif SUBTRACTION input.tif c.tif d.tif COMPLEMENT d.tif di.tif THRESHOLD d.tif dt5.tif 5 THRESHOLD d.tif dt15.tif 15 RECGRAY dt5.tif dt15.tif rec5.tif COMPLEMENT rec5.tif rec5i.tif |
CLASSIFICATION
The second stage of the system system is a nearest neighbors classifier [4,5,6]. Feature selection and reduction of the reference set is used. Such reduction is made primarily to increase the speed, however it can also increase the classification accuracy. Here, the parallel net of binary decision k-NN classifiers is used, one for each pair of classes. The final result is obtained by voting carried out between the component classifiers. Each of these classifiers is approximated by a fast 1-NN classifier with the reduced reference set. Classification speed is about 180 pix/s (Pentium 200).
For feature selection and selection of optimum k, the leave-one-out method is used. The condition of minimum class overlap rate is used rather than the most frequently used condition of minimum classification error. Then, an approximation of a k-NN classifier by a 1-NN one is obtained by reclassfication of the obtained reference set with the (k+1)-NN rule. Finally, the reference set is reduced with the modified [7,8] Hart algorithm [9]. The details will be available in another paper [6].
Each pixel is treated as a pattern. For calculating its features, square and linear neighborhoods in the image domain are used, each rotated around its central pixel to make the edges normal to the locally dominating direction of texture [10]. 64 features were experimentally selected from a large set of statistical and textural measures [8,11] (see [7,8,12]). All the details can be found in technical reports [8,11].
The training set had 1821 pixels (patterns) obtained by manually pointing the pixels in training images. Names of some of the used 15 classes are self-explaining, like good surface and background. Others correspond to such typical defects of ferrites as chip, pull-out, and the vital class in the described application: crack. The groove is another class. Our extensive practice indicated that the classes should be very specific, therefore, some were divided, as e.g. bright crack and dark crack, so the total number of classes is large, although actually we need only two general classes: crack and no-crack, into which the specific classes are merged after classification. The necessity of such specificity of classes results directly from that a parallel net of classifiers for pairs of classes as a rule performs better than a single classifier for all the classes. Suppose we have three classes, A, B and C. The choice of optimum parameters can be performed for a classifier for classes A and B. There is no reason why the patterns from class C should influence this choice.
EXAMPLE OF RESULTS AND CONCLUSION
An example of results received for a fragment of image of Fig. 1 has been shown in Fig. 2. It can be noticed that while a large number of false positive errors made by the morphological detector has been successfully removed by the classifier, some of them still remained. Note that some of the classified pixels shown in Fig. 2b and c belonged to the training set (Fig. 2d). Only the class crack was represented. However, most of the classified pixels were not used for training.
In conclusion, it can be said that encouraging results have been received at the present stage of research. A larger set of about 4000 training patterns is currently at the preparatory stage. It is expected that with this new set the accuracy of the results will reach the level required by the industry.
a b c d
Figure 2. Example of results. a) input image with the crack outlined; b) output from the morphological method; c) fragments of image b rejected by the classifier are indicated by dark gray; d) training pixels present in this fragment, all of class crack.
REFERENCES
Nieniewski M.: Morphological method of detection of defects on the surface of ferrite cores, Proc. 10th Scandinavian Conf. Image Analysis, Lappeenranta, Finland, Jun 9-11, 1997, pp 323-330.M. Nieniewski, L. Chmielewski, A. J騧wik, M. Sk這dowski, Morphological detection and feature-based classification of cracked regions in ferrites, Proc. Euromech Colloquium 406: Image Processing Methods in Applied Mechanics IPMAM'99, pages 151-154, May 6-8, 1999, Warsaw, Poland. T.A. Kowalewski, W. Kosi雟ki, J. Kompenhans (Eds.), IFTR Reports 4/1999, Institute of Fundamental Technological Research, PAS, 1999.