Defect Detection for Forged Metal Parts by Image Processing

Forging is the process of forming and shaping metals by making use of hammering or pressing. Forging is one of the main processes in metal production. Keeping quality of forged parts high is very important from the viewpoint of performance or safety of the products. Since forged part quality is checked by visual inspection whether there is any defect, it imposes a lot of loads to the workers. Although the defect detection is expected to be substituted by laser measurement or image processing instead of human eyes, comparison of both methods has hardly been carried out. In this paper, experimental results to detect defects by both methods are described for one forged part. Especially, comparison between frequency analysis by Fourier or wavelet transform and image processing is reported.


I. INTRODUCTION
Forging is a manufacturing process to shape metal by using compressive forces. Advantages of forging include significant savings in materials, higher production rate, and better grain structure [1]. To keep product quality high, inspection of surface defects is a necessary process. The surface defects include cracks, smearing, corrosion, dents, flaking and so on [2]. The human visual cortex is a vastly advanced [3], so that human defect detection speed and accuracy defy the imagination. Problems are, however, mental stress applied to the human and inevitable human errors after inspection for a long time. Since processes that previously had to be done manually can now be automated using computers [3], one solution against these problems is applications of computer vision systems.
El-Agamy et al. [2] have developed an automated system for detection and classification of surface defects in metal parts. The system consists of two main modules: image enhancement module and defect detection module. It can detect and classify common surface defects including cracks, dents, fretting, flaking, fatigue and smearing. It, however, simply uses a pattern matching technique with stored defects templates in the program database. On the other hand, Lundh [3] used a magnetic particle testing method in combination with an image analysis tool. The results showed great promise for the detection of cracks in forged metal parts. But the magnetic particle testing is a kind of special methods that uses properties of magnetic fields. Maillard et al. [4] applied active thermography for defect inspection and found that active thermography using laser-Manuscript received October 19, 2019; revised February 22, 2020. The authors are with Niigata University, Niigata, Japan (e-mail: yamazaki@ie.niigata-u.ac.jp, f17c033e@mail.cc.niigata-u.ac.jp). flash or induction excitation worked effectively under certain conditions. Also, an ultrasonic crack detection method is used to explore the depth of cracks as a potentiometric method [1].
In this study, we compare two computer vision techniques of laser and visual-spectrum images to detect defect in forged metal parts. Recently, a laser can be used as excitation source and photothermal hardness profiles could be estimated [5]. It is assumed that the cracks might be detected as its variation difference from the normal patterns even though the profile was observed as one-dimension because of the line laser. The laser is generally expensive. On the other hand, image analysis techniques can be applied to the 2-dimensional images captured by CCD (Charge-Coupled Device) cameras, which are more easily available.
The rest of the paper is organized as follows. In Section II, a defect detection algorithm is introduced for onedimensional laser measurement data, where Fourier transform is used as frequency analysis. Section III describes another algorithm for the laser measurement data in which Fourier transform is just replaced by wavelet transform. In Section IV, we provide a series of image processing algorithm for a CCD camera image to detect defects. Section V describes the conclusions.

II. DEFECT DETECTION FROM LASER MEASUREMENT DATA
BY FOURIER TRANSFORM The shape of forged metal surface is measured by a line laser. Although the measured data are acquired in onedimensional, they can be treated as pixel values in an image. Assuming that an image from a defect-free metal surface, which is called a master image, is available, a combination of several image processing techniques is applied to detect defects. The series of processing are shown in Fig. 1.
As the pre-processing in Fig. 1, edges are extended for both an inspected and the master images. Edge extension is to extend the edge position horizontally by using the same value as the edge points presented as in Fig. 2. Edge extension is the original technique in this study, and it is necessary to remove the subtle difference of the edge position between the inspected and the master images. Then the images are compared, and the differential image is obtained by subtraction of the edge images. An example of the differential image is shown in Fig. 3. The residuals of the subtraction may be defects. However, the low and high frequency elements hinder detection of the defects, so that 2-dimentional Fourier transform is used to extract frequency elements from the subtracted image and the low and high frequency elements are removed by using a band-pass filter. Finally, the output image from the band-pass filter is converted again by inverse Fourier transform, then a threshold processing is needed to suppress some noise. The band-pass filter is designed heuristically in this study.     Fig. 5. In Fig. 5, the white dots represent the defects detected by this method and the positions of the real defects are shown by the squares with red edges. The red and blue dots are also added so that it would be easy to understand resultant consistency. The red dots mean that the real defects could be detected by this method, while blue dots mean that this method defected false defects in the place where the real defects do not exist. The false detection comes from the laser measurement data difference between the inspected and master images.

III. DEFECT DETECTION FROM LASER MEASUREMENT DATA
BY WAVELET TRANSFORM In general, since Fourier transform is only localized in frequency, it has difficulty to grab local variation in an image. On the other hand, wavelets are localized in both frequency and position in the image. To apply the wavelet analysis, only thing to do is replacing Fourier transform with wavelet transform. In this study, multi-scale wavelet transform is applied to the differential image in which wavelet transform is applied 6 times. Finally, inverse wavelet transform is applied to obtain the resultant image. Fig. 6 and Fig. 7 present the image obtained by the inverse wavelet transform processing and the final result. The colours in Fig. 7 have the same meaning as in Fig. 5. Compared with Fig. 5, fewer real defects are detected as well as the fake detection located in the edges is suppressed in Fig. 7.

IV. DEFECT DETECTION BY IMAGE PROCESSING
In this section, a less expensive CCD camera is used instead of an expensive laser. In addition, we propose a International Journal of Future Computer and Communication, Vol. 9, No. 1, March 2020 series of image processing without using any master image to detect defects. The image processing algorithms can be applied more easily, since a CCD camera image is obtained in two-dimensional.   The series of image processing steps are shown in Fig. 8. As the pre-processing in Fig. 8, the histogram equalization is applied to the CCD camera image. As the histogram equalization has a role of extending difference in brightness in the image, defect features are emphasized. Subsequently, Gaussian filtering is applied to blur the edge features and to depress textural noise. The parameters of Gaussian filtering are determined heuristically. Thereafter, Canny edge detector, that is one of the common edge detection methods, is utilized to detect large differences among adjacent pixels. However, not only the edges by defects but also the original metal shape edges and the boundary edges of the metal may be detected by this method. The latter edges are relatively longer than the former, namely the edges by defects, because they come from the geometrical shape of the metal. Therefore, longer straight lines are removed by Hough transform detection to acquire the final result. The original CCD camera image, the resultant image after Canny edge detector, the straight lines detected by Hough transform, and the final result are shown in Fig. 9, Fig. 10, Fig. 11, and Fig.  12, respectively. The colours in Fig. 12 have the same meaning as in Fig. 5.

V. CONCLUSIONS
In this paper, defect detection methods for forged metal parts are reported. Development of these methods is useful to alleviate human inspection stress and fatigue. For the sensing part if defects, one-dimensional laser and a CCD camera are used; the former is more expensive than the latter.
For the laser measurement data, we proposed a defect detection method based on frequency analysis: Fourier or wavelet transform. On the other hand, for the CCD camera images, we proposed a series of image processing to detect defects. The results obtained by these methods were comparable. But the master image was needed for the case of laser data processing, while it was not necessary for the case of CCD image processing. As the result of comparison between Fourier and wavelet transform, real defects are detected better for Fourier transform, while fake detection located in the edges is suppressed for wavelet transform in our experiments.