# An Image-Processing Method for Extracting Kinematic Characteristics of Droplets during Pulsed GMAW
## 3 Extraction of Droplet Region by Image Processing
### The Period with an Undetached Droplet
#### 3.1.1 Image Enhancement  
The image color does not affect the droplet position information. To simplify the process, the first step was to convert the color image into a grayscale image. Taking Figure 3 as an example, Figure 4 displays the grayscale of the original image after conversion. Additionally, the image around the droplet in Figure 4 was selected as the region of interest (ROI) to highlight the key points and further simplify the process (see Figure 5). The method of thresholding is a widely used method in image segmentation, which sets the gray value \"\(f(x)\)\" of pixel \"\(x\)\" to the minimum or the maximum by comparing it with the threshold \"\(T\)\" (see Equation (1)). The purpose here is to distinguish the wire and droplet from the background in Figure 5. Therefore, the intermediate gray value of the wire and background was selected as the threshold, and the effect of image segmentation is shown in Figure 6a. It can be found that only the wire and the part of the droplet without the arc can be separated from the background. However, the part of the droplet with arc is lost in the background, because of the interference of the bright arc. In addition, the method of Otsu's adjustable thresholding [21] was also applied to Figure 5, and the effect is displayed in Figure 6b. The result shows that the wire cannot be separated from the background by using the method of adjustable thresholding. Figure 4: Grayscale of an original image in the period with an undetached droplet. Figure 5: Region of interest (ROI) of a grayscale image in the period with an undetached droplet. Figure 3: A typical image in the period with an undetached droplet. It is not possible to remove the interference of the arc and obtain a high-quality image of the segmentation effect using only the threshold method. To solve this problem, an algorithm based on the histogram image balance method is proposed. \[f(x)=\left\{ \begin{array}{cc}0&(x<T)\\ 255&(x>T)\end{array} \right.. \tag{1}\]  
Next, different edge operators were applied in the ROI region (Figure 5) in order to try to extract the droplet edge, and the processing results are shown in Figure 7. The edge of the gray image is often the place where the gray value of the pixel changes suddenly. The typical operators of edge recognition mainly include first-order differential edge operators (like the [PERSON] operator [22], [PERSON] operator [23], [PERSON] operator [24]) and second-order differential edge operators (like the Laplacian of Gaussian (LoG) operator [25], [PERSON] operator [26]). It can be seen that, due to the interference of the arc, the [PERSON] operator, [PERSON] operator, and [PERSON] operator only extracted the upper half of the droplet, and the information of the lower half was lost, which is obviously not applicable. The LoG operator and Canny operator basically recognized the whole picture of the droplet, but a small part of the area on the left side of the droplet was still missing, leading to an incomplete outline. Therefore, before using the LoG operator and Canny operator to extract the droplet edge, a suitable image enhancement method should be applied to get a more continuous and complete edge. Edge recognition of the lower part of droplet failed due to the high brightness of the arc, as shown in Figure 7. By observing the gray histogram of the ROI in Figure 8, lots of detail in the image was lost, because the high-brightness part (grayscale near 250) and the low-brightness part (grayscale near 120) were both excessively centralized. For the sake of magnifying detail and contrast, the method of adaptive histogram equalization was utilized in the ROI, followed by gamma transformation to compress the lower gray level and stretch the higher gray level [27] (see Figures 9 and 10). Figure 6: Effect of image segmentation using (**a**) the method of thresholding with the intermediate gray value of the wire and background; (**b**) the method of adaptive thresholding.