# Real-time Monitoring for Disk Laser Welding Based on Feature Selection and SVM
## 3 Experiment
### Feature Extraction  
Feature extraction attempts to generate informative and non-redundant derived values from the initial measured data. As this facilitates the subsequent classifier generation, and usually leads to a better understanding of the problem, it is considered to be a critical step in a pattern recognition system. In this study, fifteen features (see Table 2) are extracted from the image of plume and spatters. Their definitions are as follows [26].  
Area: The area is calculated by counting the number of white points in the binary image. The area of plume is denoted \(A_{p}\), and the sum of all areas of spatters is denoted \(A_{s}\).  
Perimeter: In the binary image, the points surrounded by difference colors are marked as boundary points, and the number of boundary points is taken as the perimeter. The perimeter of plume is denoted \(P_{p}\), and the sum of all perimeters of spatters is denoted \(P_{s}\).  
Centroid: The centroid \((i,j)\) of plume and the centroid \((i,j)\) of spatters are calculated by:  
\[i_{c}=\frac{\sum\limits_{j=1}^{n}\sum\limits_{i=1}^{m}g(i,\ j)\times i}{\sum \limits_{j=1}^{n}\sum\limits_{i=1}^{m}g(i,\ j)},\ j_{c}=\frac{\sum\limits_{j=1 }^{n}\sum\limits_{i=1}^{m}g(i,\ j)\times j}{\sum\limits_{j=1}^{n}\sum\limits_{i =1}^{m}g(i,\ j)} \tag{12}\]  
where \(g(i,j)\) is the grayscale value of the point \((i,j)\). They are denoted \(C_{p(i)}\), \(C_{p(j)}\), \(C_{s(i)}\) and \(C_{s(j)}\).  
Height: The height of plume is the vertical distance between the highest point and the lowest point, which is denoted \(H_{p}\).  
Width: The width of plume is the horizontal distance between the far-left point and the far-right point, which is denoted \(W_{p}\).  
Average Grayscale Value: The average grayscale value of plume and the average grayscale value of spatters are calculated by:  
\[\overline{g}=\frac{\sum\limits_{j=1}^{n}\sum\limits_{i=1}^{m}g(i,\ j)}{n\times m} \tag{13}\]  
where \(g(i,j)\) is the grayscale value of the point \((i,j)\). They are denoted \(G_{p}\) and \(G_{s}\).  
Quantity: The quantity of spatters is defined as the number of connected objects found in the binary image of spatters. Three different quantities are used in this work. The quantity of spatters in the whole image is first calculated and denoted as \(Q_{s(a)}\). Then the image is cut vertically into two images of the same size from the middle. Two more quantities are calculated based on these, and denoted \(Q_{s(l)}\) and \(Q_{s(r)}\).  
Figure 2: Schematic diagrams of image processing: (**a**) original image; (**b**) grayscale image; (**c**) binary image of plume; (**d**) binary image of spatters.  
Features on different scales may cause some problems while evaluating their contributions and optimizing the classifier. Consequently, all extracted features are normalized by the following formula:  
\[\overline{f}_{i}^{nof}=\frac{f_{i}^{nof}-\min(F^{nof})}{\max(F^{nof})-\min(F^{nof} )},nof=1,2,\ldots,15 \tag{14}\]  
where \(nof\) is the No. of the feature, \(\overline{f}_{i}\) is the normalized data, \(f_{i}\) is the original data, \(\min(F^{nof})\) are the minimum values of each feature, and \(\max(F^{nof})\) are the maximum values of each feature.