Mechanical System and Template-Matching-Based Position-Measuring Method for Automatic Spool Positioning and Loading in Welding Wire Winding

Welding wire is a major type of welding consumable, which needs to be winded onto spools for sale. Currently, the winding process is accomplished manually due to obstacles such as automatic spool loading and clamping. When loading the spool, the angular position of the spool is a prerequisite for matching the drive rod on the spindle and drive bore on the spool. Therefore, this paper proposes a template-matching method combined with area-based matching and feature-point detection to measure the angular position of the spool, and presents a mechanical system that can rotate the spool to match the drive rod and push the spool onto the spindle. A novel feature-point distribution density (FPDD) method was developed to accelerate the matching process and improve matching reliability by pre-locating the searching area. The robustness and accuracy of the template-matching-based measuring method were validated using a built prototype of the mechanical system. The comparison result shows that the proposed method was superior in robustness, accuracy, and speed, and it was efficient for automatic spool loading in the welding wire winding process.


Introduction
Welding is a major way to produce metal structures such as stiffened plate panels [1]. Thus, the global consumption of welding consumables is enormous, and the market was valued at USD 13.79 billion in 2018, according to market-watch research [2]. There are generally two kinds of welding consumables, categorized by shape: (1) stick, such as stick electrodes, and (2) wire, including solid wires, flux-cored wires, and submerged arc-welding (SAW) wires. Wire-shaped welding consumables such as metal-inert gas (MIG) welding wire are usually wound onto small plastic spools for sale, with final weights of about 5-30 kg [3].
However, the winding process currently relies on manual operation, as shown in Figure 1, resulting in limited capacity and high cost. Furthermore, the operation requires repetitive heavy work in a noisy workshop, which presents health risks to workers. Besides the repetitive operation of clamping-disk loading and unloading and nut tightening and loosing, there is another major obstacle for fully automatic welding wire winding, which the insertion of the main axle and drive rod on the  Therefore, this paper proposes a template-matching-based method to measure the angular position of the spool and provide the rotational angle, and presents a mechanical system that can lift the spool coaxial onto the spindle and rotate the spool to match the drive rod. Moreover, a novel feature-point distribution density (FPDD) strategy is proposed to accelerate the matching process and improve matching reliability by pre-locating the searching area. The angular-position-measuring method was validated using a built prototype of the mechanical system.
The remainder of this paper is organized into the following structure: relevant work for this study is summarized in Section 2; the designed mechanical system is presented in Section 3; the proposed method is described in Section 4; the experimental comparison results are discussed in Section 5; and conclusions are summarized in Section 6. Figure 1. Manual operation of welding wire winding. The spool is installed onto the spindle, clamped by the clamping disk, and fastened by a nut. A swing arm is applied to assist the worker to load and unload the clamping disk.

Related Works
Appl. Sci. 2020, 10, x FOR PEER REVIEW 2 of 14 clamping-disk loading and unloading and nut tightening and loosing, there is another major obstacle for fully automatic welding wire winding, which the insertion of the main axle and drive rod on the spindle, as shown in Figure 2a, precisely into the main bore and drive bore of the spool, as shown in Figure 2b. Only after this operation is completed is the spool ready to be driven, rotating together with the spindle. This operation requires high speed, and accurate and robust measurement of the spool's angular position.  Therefore, this paper proposes a template-matching-based method to measure the angular position of the spool and provide the rotational angle, and presents a mechanical system that can lift the spool coaxial onto the spindle and rotate the spool to match the drive rod. Moreover, a novel feature-point distribution density (FPDD) strategy is proposed to accelerate the matching process and improve matching reliability by pre-locating the searching area. The angular-position-measuring method was validated using a built prototype of the mechanical system.
The remainder of this paper is organized into the following structure: relevant work for this study is summarized in Section 2; the designed mechanical system is presented in Section 3; the proposed method is described in Section 4; the experimental comparison results are discussed in Section 5; and conclusions are summarized in Section 6. Therefore, this paper proposes a template-matching-based method to measure the angular position of the spool and provide the rotational angle, and presents a mechanical system that can lift the spool coaxial onto the spindle and rotate the spool to match the drive rod. Moreover, a novel feature-point distribution density (FPDD) strategy is proposed to accelerate the matching process and improve matching reliability by pre-locating the searching area. The angular-position-measuring method was validated using a built prototype of the mechanical system.

Related Works
The remainder of this paper is organized into the following structure: relevant work for this study is summarized in Section 2; the designed mechanical system is presented in Section 3; the proposed method is described in Section 4; the experimental comparison results are discussed in Section 5; and conclusions are summarized in Section 6.

Related Works
The method proposed in this research for measuring the spool's angular position is a typical application of vision-based measurement (VBM), which is a rapidly developing technology due to the increasing affordability and capability of cameras and computing hardware/software [4]. A VBM system may apply machine learning [5], pattern recognition [6], template matching [7], or other algorithms to identify and obtain measurement results from a captured image or a video stream.
Area-based matching methods, sometimes called correlation-like methods, match the template and source image by moving the template image one pixel per step in an exhaustive way, calculating a metric of the similarity between the template and the particular area of the source image after each move, and selecting the template location which has the maximum metric value. The metric is based on a correlation criteria, which generally contains (1) a cross-correlation (CC), such as CC, normalized cross-correlation (NCC) [21], or zero-normalized cross-correlation (ZNCC) [22]; (2) the sum of absolute differences (SAD) and its variants, like zero mean sum of absolute differences (ZSAD) or optimized sum of absolute difference (OSAD) [23]; and (3) the sum of squared differences (SSD) [24], normalized sum of squared differences (NSSD), or zero-normalized sum of squared differences (ZNSSD) [25].
Basic area-based matching methods are computationally time consuming; thus, multiple accelerating strategies have been developed. Wei and Lai [26] proposed a fast pattern-matching algorithm based on the NCC criterion by combining an adaptive multilevel partition with the winner-update scheme, and achieved efficient template searching. Fouda [27] presented a dimensionreducing algorithm to accelerate computation by calculating the SSD in horizontal and vertical directions separately. Lai et al. [28] proposed a method named A-MNS, based on majority neighbor similarity (MNS) and the annulus projection transformation (APT). These methods were found to be effective for color-rich or strongly contrasting images, which are quite different from those in the present study.
Feature-point matching is another template-matching algorithm with high efficiency and both geometric (rotation and scale) and photometric (brightness and exposure) invariance [29]. Instead of metric calculation for all the possible locations, feature points matching detects "special" points in the template and source, and then finds point correspondences based on their local appearance. Many kinds of features have been proposed in previous works, such as Harris, FAST (features from accelerated segment test), Hessian, SIFT (scale-invariant feature transform), SURF (speeded-up robust features), BRIEF (binary robust independent elementary features), and BRISK (binary robust invariant scalable keypoints) [30]. Furthermore, Alcantarilla et al. put forward the KAZE algorithm, which exploits non-linear scale space through non-linear diffusion filtering [31]. They also presented Accelerated-KAZE (AKAZE) which improves the KAZE by constructing the non-linear scale spaces using a computationally efficient framework called fast explicit diffusion (FED) [32]. However, it was found to be unreliable to measure spool angular position directly using a template-feature-point-matching method due to the multiple similar structures and shapes on the spool that can easily cause mismatching in this case. The FPDD strategy proposed in this paper combines area-based matching and feature-point detection. It is critical to select appropriate feature-detection algorithms with high speed and robustness for machine vision systems in industrial applications. Many works have compared the performance of different features in different applications [33][34][35], and showed that result comparison was the most effective way. To this end, different features are compared in Section 5.

Mechanical System
The designed mechanical system is shown in Figure 3. In contains three main units: the spindle box, the tailstock, and the lifting device, mounted on the worktable. There is a clamping disk fixed on the spindle to clamp the spool together with the rotatable pushing disk on the tail stock. A drive rod with a tapered tip is installed on the disk plate to insert into the drive bore and drive the spool to wind. The rotatable pushing disk on the tailstock can be moved forward and backward by a pneumatic cylinder to load and unload the spool. The lifting device shown in the upright of Figure 3 comprises a cylinder-driven vertical slide and the angular measuring and adjusting device mounted on the slide. The angular measuring and adjusting device includes a lifting base, two V-shaped supports, two adjusting rollers driven by a step motor, and a camera.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 4 of 14 The designed mechanical system is shown in Figure 3. In contains three main units: the spindle box, the tailstock, and the lifting device, mounted on the worktable. There is a clamping disk fixed on the spindle to clamp the spool together with the rotatable pushing disk on the tail stock. A drive rod with a tapered tip is installed on the disk plate to insert into the drive bore and drive the spool to wind. The rotatable pushing disk on the tailstock can be moved forward and backward by a pneumatic cylinder to load and unload the spool. The lifting device shown in the upright of Figure 3 comprises a cylinder-driven vertical slide and the angular measuring and adjusting device mounted on the slide. The angular measuring and adjusting device includes a lifting base, two V-shaped supports, two adjusting rollers driven by a step motor, and a camera.   Initially, the spool is put on the two adjusting rollers at a random angular position. The spindle is turned to the zero position where the drive rod is exactly below the spindle main axle. In addition, the lifting device is at the low position, as shown in Figure 4a. An image of the spool is taken and the template-matching-based angular position measurement is conducted. The step motor then drives the two adjusting rollers to rotate the spool to the desired position. After that, the lifting cylinder pushes up the spool on the angular measuring and adjusting device to make sure the spool is coaxial to the spindle, as shown in Figure 4b. The pushing disk on the tailstock is then moved forward to load the spool onto the spindle and clamp it. Finally, the lifting device descends to the lowest position and the spool is ready for winding.  Initially, the spool is put on the two adjusting rollers at a random angular position. The spindle is turned to the zero position where the drive rod is exactly below the spindle main axle. In addition, the lifting device is at the low position, as shown in Figure 4a. An image of the spool is taken and the template-matching-based angular position measurement is conducted. The step motor then drives

The Proposed Measuring Method
There are six to eight rib plates connecting the main bore and the wire container, as shown in Figure 2b, according to the welding wire capacity. Generally, more ribs cause more variety in light and shadow, generating more measuring complexity; therefore, in this paper, a spool with eight rib plates was assumed. The areas near the rib plates are different to other areas in brightness and contrast, and the drive bore is located at one of the rib plates which actually indicates the spool's angular position. Thus, locating the drive bore is the most direct way to measure the spool's angular position. However, due to the low diversity of color and brightness of the captured spool image, it was found to be unreliable to locate the drive bore through circle-detecting methods like the Hough transform.
As mentioned above, template matching presents good performance in similar applications, but normal area-based template matching is computationally time-consuming and less robust to image rotation. In this case, the drive rod bore may be in any angular position, resulting in different brightness and shadow shape; multiple templates were therefore necessary to improve the accuracy, as discussed in Section 5. Moreover, due to the limited illumination and monotone color of the spool, it was found that matching credibility was not high enough.
To solve these problems, an FPDD strategy was proposed to initially locate the potential matching zone, and then the corresponding template was selected to conduct accurate template matching. The workflow of the proposed spool-angular-position-measuring method is shown in Figure 5, and the method is detailed in the following.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 5 of 14 the two adjusting rollers to rotate the spool to the desired position. After that, the lifting cylinder pushes up the spool on the angular measuring and adjusting device to make sure the spool is coaxial to the spindle, as shown in Figure 4b. The pushing disk on the tailstock is then moved forward to load the spool onto the spindle and clamp it. Finally, the lifting device descends to the lowest position and the spool is ready for winding.

The Proposed Measuring Method
There are six to eight rib plates connecting the main bore and the wire container, as shown in Figure 2b, according to the welding wire capacity. Generally, more ribs cause more variety in light and shadow, generating more measuring complexity; therefore, in this paper, a spool with eight rib plates was assumed. The areas near the rib plates are different to other areas in brightness and contrast, and the drive bore is located at one of the rib plates which actually indicates the spool's angular position. Thus, locating the drive bore is the most direct way to measure the spool's angular position. However, due to the low diversity of color and brightness of the captured spool image, it was found to be unreliable to locate the drive bore through circle-detecting methods like the Hough transform.
As mentioned above, template matching presents good performance in similar applications, but normal area-based template matching is computationally time-consuming and less robust to image rotation. In this case, the drive rod bore may be in any angular position, resulting in different brightness and shadow shape; multiple templates were therefore necessary to improve the accuracy, as discussed in Section 5. Moreover, due to the limited illumination and monotone color of the spool, it was found that matching credibility was not high enough.
To solve these problems, an FPDD strategy was proposed to initially locate the potential matching zone, and then the corresponding template was selected to conduct accurate template matching. The workflow of the proposed spool-angular-position-measuring method is shown in Figure 5, and the method is detailed in the following.

Image Pre-Processing
Initially, the captured RGB mode image was converted to grayscale using the following equation.

Image Pre-Processing
Initially, the captured RGB mode image was converted to grayscale using the following equation.
where R(i, j), G(i, j), and B(i, j) are intensity values of the R, G, and B components of point (i, j).
A grayscale image of a spool with eight rib plates is shown in Figure 6a.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 6 of 14 where (x,y) is the position of the point in the new coordinate corresponding to (u,v) in the original coordinate. Equation (2) is usually abbreviated as X RX, where R is a homogeneous matrix calculated from given transform parameters.
The ideal ROI (region of interest) is an annulus area concentric with the center bore. To simplify the computation, a minimum enclosing rectangle range was intercepted as the real ROI, as shown in Figure 6c.

FPDD Strategy
Boundary-sensitive features such as SIFT, SURF, ORB (Oriented FAST and Rotated BRIEF), and AKAZE [37] were potential indicators of the rib plates and the drive bore. In addition, AKAZE [38] and MinEigen [39] algorithms have been to be found superior in feature-point density for remote sensing. AKAZE was finally adopted, and it is compared to other features in Section 5.
As shown in Figure 6c, the AKAZE algorithm was applied to detect feature points in the ideal ROI. It was found that the distribution densities of feature points near the rib plate were very high and few feature points could be found in the rib plate area. DBSCAN [40] (Density-Based Spatial Clustering of Applications with Noise) is a popular density-based clustering algorithm which has been successfully used in many real-world applications [41]. It was applied in this paper to cluster feature points into several groups corresponding to rib plates and drive bores, as shown in Figure 6c, where feature points in different clusters are marked in different colors. Some feature points away from the rib plate areas were eliminated as outliers.
Coordinate transformation was then conducted to convert feature points into polar coordinates ( and ρ), and the origin of the polar coordinates coincided with the center of the main bore. To keep pace with the drive bore position ( ), the zero degree line was downward from the center of the main View transfer was then applied to reconstruct the front view image of the spool by perspectivetransform principle using Equations (2) and (3) [36]. The process is shown in Figure 6b.
where (x,y) is the position of the point in the new coordinate corresponding to (u,v) in the original coordinate. Equation (2) is usually abbreviated as X = RX, where R is a homogeneous matrix calculated from given transform parameters. The ideal ROI (region of interest) is an annulus area concentric with the center bore. To simplify the computation, a minimum enclosing rectangle range was intercepted as the real ROI, as shown in Figure 6c.

FPDD Strategy
Boundary-sensitive features such as SIFT, SURF, ORB (Oriented FAST and Rotated BRIEF), and AKAZE [37] were potential indicators of the rib plates and the drive bore. In addition, AKAZE [38] and MinEigen [39] algorithms have been to be found superior in feature-point density for remote sensing. AKAZE was finally adopted, and it is compared to other features in Section 5.
As shown in Figure 6c, the AKAZE algorithm was applied to detect feature points in the ideal ROI. It was found that the distribution densities of feature points near the rib plate were very high and few feature points could be found in the rib plate area. DBSCAN [40] (Density-Based Spatial Clustering of Applications with Noise) is a popular density-based clustering algorithm which has been successfully used in many real-world applications [41]. It was applied in this paper to cluster feature points into several groups corresponding to rib plates and drive bores, as shown in Figure 6c, where feature points in different clusters are marked in different colors. Some feature points away from the rib plate areas were eliminated as outliers.
Coordinate transformation was then conducted to convert feature points into polar coordinates (θ and ρ), and the origin of the polar coordinates coincided with the center of the main bore. To keep pace with the drive bore position (α), the zero degree line was downward from the center of the main bore and the clockwise direction was defined as the positive direction. The FPDD was defined as the standard deviation of angular position of feature points distributed in each cluster. The FPDD is defined in Equation (3).
where k is the k-th cluster (Cluster k ) of feature points, N is the total number of clusters, f p is a feature point, θ f p is the angular position of the feature point, and function STD represents the calculation of standard deviation. The FPDDs calculated for the eight clusters when the drive bore was at zero position (α = 0 • ) are shown in Figure 7, in which the horizontal axis represents the mean angular position of feature points in each cluster. The horizontal axis value of the cluster with the highest FPDD (ϕ FPDD max ) was regarded as the angular position of the drive bore.
where k is the k-th cluster (Cluster k ) of feature points, N is the total number of clusters, fp is a feature point, is the angular position of the feature point, and function STD represents the calculation of standard deviation.
The FPDDs calculated for the eight clusters when the drive bore was at zero position ( 0°) are shown in Figure 7, in which the horizontal axis represents the mean angular position of feature points in each cluster. The horizontal axis value of the cluster with the highest FPDD (φ FPDD max ) was regarded as the angular position of the drive bore. We then defined ∆ as the error between actual spool angular position and the pre-located position φ FPDD max in Equation (5).
To check the robustness of the FPDD strategy, we calculated ∆ for α = 0°, 1°, …, 360°. The result is shown in Figure 8. We found that all ∆ values were in the range 6°, 4° , presenting acceptable robustness. We then defined ∆ ϕ as the error between actual spool angular position and the pre-located position ϕ FPDD max in Equation (5).
To check the robustness of the FPDD strategy, we calculated ∆ for α = 0°, 1°, …, 360°. The result is shown in Figure 8. We found that all ∆ values were in the range 6°, 4° , presenting acceptable robustness.

Accurate Matching
Since ∆ ϕ was in the range [−6 • , +4 • ], accurate matching was conducted in the range [ϕ FPDD max − 10 • , ϕ FPDD max + 10]. The template was pre-intercepted from different angular spool positions at each degree from 0 to 360. Thus, there were 360 templates in total. The exact template used for accurate matching was that closest to ϕ FPDD max . The position where the matching metric reached the highest value was considered to be the drive bore location. The accurately matched spool angular position ϕ match was then calculated by transforming the matched location to spool angular coordinate using Equation (6). The process is shown in Figure 9.

Accurate Matching
Since ∆ was in the range 6°, 4° , accurate matching was conducted in the range 10°, 10° . The template was pre-intercepted from different angular spool positions at each degree from 0° to 360°. Thus, there were 360 templates in total. The exact template used for accurate matching was that closest to . The position where the matching metric reached the highest value was considered to be the drive bore location. The accurately matched spool angular position was then calculated by transforming the matched location to spool angular coordinate using Equation (6). The process is shown in Figure 9.

Experiments and Discussion
A prototype of the designed structure was built and tested. A servomotor is applied to drive the spindle, and a photoelectric sensor was used to indicate the initial position. A six-axis motion controller (Model SMC-48, ADHON Tech Co., Ltd., Ningbo, Zhejiang, China) was applied to provide pulse signals to drive the spindle and the adjusting roller, and to actuate the electromagnetic valves.

Experiments and Discussion
A prototype of the designed structure was built and tested. A servomotor is applied to drive the spindle, and a photoelectric sensor was used to indicate the initial position. A six-axis motion controller (Model SMC-48, ADHON Tech Co., Ltd., Ningbo, Zhejiang, China) was applied to provide pulse signals to drive the spindle and the adjusting roller, and to actuate the electromagnetic valves. The initial position was adjusted using a cross-line laser level meter. The spools used for experiments were white spools with 20 kg wire-containing capacity, eight rib plates, and 300 mm outer diameter. The mechanical system was tested for its capability to adjust the spool position, and to load and clamp the spool. The camera employed was a common commercial camera with 1280 × 720 resolution. Illumination was obtained using an LED lamp fixed on top of the spindle box. The machine-vision-based method was validated on a computer with an Intel(R) Core (TM) i7-8700 CPU @ 3.20GHz (Intel Corporation, Santa Clara, CA, USA), 16GB RAM and Windows 10 64-bit OS (Version 1909, Microsoft Corporation, Redmond, WA, USA). Algorithms were coded and run on Matlab 2019a (Version 9.6, The MathWorks, Inc., Natick, MA, USA).

Comparison of Feature-Detecting Algorithms
Different algorithms including SIFT, SURF, ORB, and MinEigen were selected and compared with AKAZE. The FPDD results where the spool was at zero position (α = 0 • ) are shown in Figure 10. It was found that SURF detected the fewest feature points, ORB detected more but was still insufficient for FPDD, SIFT performed better in number of feature points but the distribution location was away from the rib plates, and the MinEigen shows great feature-point density and good matching of the rib plates.

Comparison of Feature-Detecting Algorithms
Different algorithms including SIFT, SURF, ORB, and MinEigen were selected and compared with AKAZE. The FPDD results where the spool was at zero position (α = 0°) are shown in Figure 10. It was found that SURF detected the fewest feature points, ORB detected more but was still insufficient for FPDD, SIFT performed better in number of feature points but the distribution location was away from the rib plates, and the MinEigen shows great feature-point density and good matching of the rib plates. However, as shown in Figure 10f, when the actual drive rod position was α = 7°, the MinEigen feature points distributed in two major groups, which were opposite to each other on the bore. Therefore, two clusters were generated and the pre-located position was far from the actual position. When taking a closer look at the feature points, it was found that there were far fewer MinEigen feature points compared to AKAZE in the designated area, where the arc-shaped edge generated by the contrast between the bore and shadow was found, as shown in Figure 10e. The reason for fewer However, as shown in Figure 10f, when the actual drive rod position was α = 7 • , the MinEigen feature points distributed in two major groups, which were opposite to each other on the bore. Therefore, two clusters were generated and the pre-located position was far from the actual position. When taking a closer look at the feature points, it was found that there were far fewer MinEigen feature points compared to AKAZE in the designated area, where the arc-shaped edge generated by the contrast between the bore and shadow was found, as shown in Figure 10e. The reason for fewer MinEigen feature points is that, similarly to Harris [42] using Equation (7), MinEigen [43] detects corner features using Equation (8), which eliminates edge features that show a big difference between λ 1 and λ 2 .
where λ 1 and λ 2 are two Eigenvalues of matrix M in the intensity change Equation (9).
where E(x, y) is the change of intensity when the corner of the detector window shifts with increment (x, y). Both KAZE and AKAZE showed blurring in images at multiple scale levels while retaining the boundaries of regions by non-linear diffusion filtering. The KAZE detector applies a standard nonlinear diffusion formula, as shown in Equation (10), and AKAZE adopts a computationally efficient framework called fast explicit diffusion (FED).
where div and ∇ are, respectively, the divergence and gradient operators, and c is a conductivity function to make the diffusion adaptive to the local image structure.

Comparison of FPDD and Direct Template Matching
The proposed machine-vision-based method was validated when α = 1 • , 2 • , . . . , 360 • , and the result is shown in Figure 11. The displayed values are the errors between the measured values and actual values. We found that the measuring errors were in the range of [−1 • , 0.5 • ], which was good enough to insert the drive rod into the drive bore. Moreover, the average time for each measurement was 0.868 s. where , is the change of intensity when the corner of the detector window shifts with increment , .
Both KAZE and AKAZE showed blurring in images at multiple scale levels while retaining the boundaries of regions by non-linear diffusion filtering. The KAZE detector applies a standard nonlinear diffusion formula, as shown in Equation (10), and AKAZE adopts a computationally efficient framework called fast explicit diffusion (FED).
where div and are, respectively, the divergence and gradient operators, and c is a conductivity function to make the diffusion adaptive to the local image structure.

Comparison of FPDD and Direct Template Matching
The proposed machine-vision-based method was validated when α = 1°, 2°, …, 360°, and the result is shown in Figure 11. The displayed values are the errors between the measured values and actual values. We found that the measuring errors were in the range of [−1°, 0.5°], which was good enough to insert the drive rod into the drive bore. Moreover, the average time for each measurement was 0.868 s. If we were to directly conduct template matching (cross-correlation criterion) using a single template, the drive bore at zero position (α = 0°) for instance, a lot of mismatching would be found. Even if we use eight templates, as shown in Figure 12, and select the matching with the highest correlation, there are still some mismatching results, as shown in Figure 13. Moreover, the average If we were to directly conduct template matching (cross-correlation criterion) using a single template, the drive bore at zero position (α = 0 • ) for instance, a lot of mismatching would be found. Even if we use eight templates, as shown in Figure 12, and select the matching with the highest correlation, there are still some mismatching results, as shown in Figure 13. Moreover, the average time for each measurement by direct template matching was 7.981 s.

Conclusions
This paper proposes a template-matching method combined with area-based matching and feature-point detection to measure the angular position of a welding wire spool, and presents a mechanical system that can rotate the spool to match the drive rod and push the spool onto the spindle. The robustness and accuracy of the template-matching-based measuring method were validated using a built prototype of the mechanical system. Based on the above, the following conclusions were made. 1) A novel feature-point distribution density (FPDD) strategy was developed to accelerate the matching process and to improve matching reliability by pre-locating the searching area. The FPDD strategy was based on the AKAZE feature-detection algorithm and the pre-locating accuracy was tested in range of [ 6°, 4°] with good robustness. 2) AKAZE was found to be the most suitable algorithm for this application due to its high efficiency, high feature density, and edge-preserving properties compared to other algorithms such as SIFT, SURF, ORB, and MinEigen.

Conclusions
This paper proposes a template-matching method combined with area-based matching and feature-point detection to measure the angular position of a welding wire spool, and presents a mechanical system that can rotate the spool to match the drive rod and push the spool onto the spindle. The robustness and accuracy of the template-matching-based measuring method were validated using a built prototype of the mechanical system. Based on the above, the following conclusions were made. 1) A novel feature-point distribution density (FPDD) strategy was developed to accelerate the matching process and to improve matching reliability by pre-locating the searching area. The FPDD strategy was based on the AKAZE feature-detection algorithm and the pre-locating accuracy was tested in range of [ 6°, 4°] with good robustness. 2) AKAZE was found to be the most suitable algorithm for this application due to its high efficiency, high feature density, and edge-preserving properties compared to other algorithms such as SIFT, SURF, ORB, and MinEigen. 3) The proposed method was superior in robustness, accuracy, and speed and it was efficient for

Conclusions
This paper proposes a template-matching method combined with area-based matching and feature-point detection to measure the angular position of a welding wire spool, and presents a mechanical system that can rotate the spool to match the drive rod and push the spool onto the spindle. The robustness and accuracy of the template-matching-based measuring method were validated using a built prototype of the mechanical system. Based on the above, the following conclusions were made.
(1) A novel feature-point distribution density (FPDD) strategy was developed to accelerate the matching process and to improve matching reliability by pre-locating the searching area. The FPDD strategy was based on the AKAZE feature-detection algorithm and the pre-locating accuracy was tested in range of [−6 • , +4 • ] with good robustness.
(2) AKAZE was found to be the most suitable algorithm for this application due to its high efficiency, high feature density, and edge-preserving properties compared to other algorithms such as SIFT, SURF, ORB, and MinEigen. (3) The proposed method was superior in robustness, accuracy, and speed and it was efficient for automatic spool positioning in the welding wire winding process, with [−1 • , 0.5 • ] accuracy and less than 1 s computation time. (4) Multi-template matching was unable to measure the angular position of welding wire spool due to too much mismatching, even with eight templates.