Next Article in Journal
Optimal User Scheduling in Multi Antenna System Using Multi Agent Reinforcement Learning
Next Article in Special Issue
The Atmospheric Vertical Detection of Large Area Regions Based on Interference Signal Denoising of Weighted Adaptive Kalman Filter
Previous Article in Journal
A Complement Method for Magnetic Data Based on TCN-SE Model
Previous Article in Special Issue
Improvement of Temperature Performance of Singlemode-Multimode-Singlemode Fiber Structure
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Automatic Measurement of External Thread at the End of Sucker Rod Based on Machine Vision

1
Institute of Engineering Technology, University of Science and Technology Beijing, Beijing 100083, China
2
Department of Mechanical Engineering, Baotou Vocational and Technical College, Baotou 014030, China
3
Collaborative Innovation Center of Steel Technology, University of Science and Technology Beijing, Beijing 100083, China
*
Author to whom correspondence should be addressed.
Sensors 2022, 22(21), 8276; https://doi.org/10.3390/s22218276
Submission received: 21 August 2022 / Revised: 5 October 2022 / Accepted: 25 October 2022 / Published: 28 October 2022
(This article belongs to the Special Issue State-of-the-Art Optical Sensors Technology in China)

Abstract

:
Aiming at the low efficiency of manual measurement of threads and the lack of practicability in machine vision measurement before, online size measurement of threads at the end of sucker rods based on machine vision was studied. A robotic arm is used to carry an optical device to achieve high-quality image acquisition of threads. Based on the prior knowledge of the thread profile angle, the directional edge detection operator is customized to achieve the accurate detection of the left and right edges of the thread. Noise filtering, sorting, and left and right edge-matching algorithms based on connected domains are developed to eliminate the interference effects of electrostatic dust and oil pollution in online measurement, and the dimension of thread profile angles, pitches, major diameters, and minor diameters can be precisely calculated. The experimental results show that the screw thread parameter measurement time is about 0.13 s; the maximum and minimum average errors of the thread angles are 0.011° and 0.632°, respectively; and the total average deviation is less than 0.08°. For the screw thread pitch, major diameter, minor diameter, and pitch diameter parameter measurement, the deviation of the measurement results between the proposed method and the universal tool microscope (UTM) method is less than 10 μm. It fully proves the effectiveness and accuracy of the method in this paper and, at the same time, shows that the method has good real-time performance and high application significance, which lays a good foundation for the subsequent online thread measurement.

1. Introduction

A sucker rod is an important component of sucker rod pumping equipment, which transmits the power of the pumping unit to the downhole oil pump. The fatigue strength and service life of a sucker rod determine the maximum pumping depth and displacement of the whole set of oil pumping equipment. In the process of oil production, a sucker rod is subjected to asymmetric cyclic loads, and the breakage of the sucker rod will seriously affect the production of crude oil and increase the cost of workover operations and the cost of crude oil. The failure parts of a sucker rod are mainly concentrated in the external thread and the thread relief groove, so the processing quality of the thread directly affects the life of a sucker rod [1,2,3].
The structure of the end of a sucker rod is shown in Figure 1.
At present, thread parameter measurement usually adopts the method of external-thread go-stop gauge, which is not only time-consuming and labor-intensive, slow in measurement speed, and low in reliability but also prone to problems such as missed inspections and misjudgments. Unqualified sucker rods that are missed or misjudged will cause major production safety accidents and huge economic losses. The development of online rapid precise measurement system has become an urgent problem to be solved, and machine vision technology provides the possibility for the realization of this function.
A variety of approaches have been developed for the precision measurement of external thread. In terms of the measurement method, it is mainly divided into three- and two-dimensional measurements.
Feng et al. proposed the application of corner detection in thread vision measurement [4]. Yang et al. discussed the effect of oil adhesion on the measurement of screw thread with machine vision and put forward the compensation method for the pitch diameter [5]. Lee et al. used machine vision to develop an on-machine thread measurement system for computer numerical control lathe machines and verified the feasibility and accuracy of the on-machine external thread measurement system developed in this study [6]. Man confirmed that the phenomenon of thread profile distortion always exists in measuring screw thread by projection image and proposed the compensation of thread profile distortion in image measuring screw thread [7]. Min designed the measurement method of screw thread geometric error based on machine vision, whose linear precision is less than 10 μm and can be used to detect the comprehensive parameters of screw thread [8]. Senthil et al. proposed the vision measurement of metric screw thread parameters based on orientation invariant feature [9]. Lavrinov et al. presented the laser triangulation 2D scanner signal processing for premium thread pitch measurement [10]. Gadelmawla proposed the computer vision algorithms for measurement and inspection of external screw threads, and the measurement results showed that the maximum difference between the standard and measured values was ±5.4 μm, which shows a good accuracy for measurement [11]. Jing designed a comprehensive measurement system for screw thread parameters based on machine vision, and the feasibility and correctness of this method have been theoretically and practically validated [12]. Wu et al. proposed the thread measurement algorithm research and software development, which does some simple refits to the existing 19JA universal tool-measuring microscope [13]. Shao et al. designed a noncontact thread parameter measuring system based on an array CCD, and the measurement results obtained indicate that this system has advantages such as quick test, high precision, and good repeatability [14]. Hunsicker et al. proposed an automatic vision inspection and measurement system for external screw threads [15].
Antonin proposed a measurement algorithm that adopts the principle of laser triangulation to realize the three-dimensional measurement of the profile parameters of a single cross-section of a screw thread [16]. Farana et al. proposed a method of screw thread measurement using a 3D vision system, which is fast enough to be used on every element in the production line and accurate enough to provide reliable data about the quality of the final product [17]. Sheng et al. presented a new compensation method for measurement of the thread pitch diameter by profile scanning [18]. Tong et al. designed a novel laser-based system for measuring internal thread parameters, and the experimental results show that the measurement accuracy of the thread angle is 2′ and the other parameters are less than 4 μm [19]. Kosarevsky proposed the detection of screw threads in computed tomography 3D density fields, and the described method can be used to automate many operations during screw thread inspection process [20]. Jiang et al. proposed the research on screw thread vision measurement, analyzed and simulated the screw thread’s 3D mathematic model, and, finally, provided a corresponding algorithm to correct the calculation error resulting from the shading effect of backlight projection [21]. Latypov developed an algorithm to detect screw threads in planar point clouds. The described method can be used to automate many operations during screw thread pre-alignment and drastically reduce the operator’s influence on the measurement process resulting in lower measurement times and increased repeatability [22]. Huang et al. developed a laser-based measuring system, which integrated the triangulation laser measuring system and the dual-axis rotary stage for the thread profile of ball screws [23].
Although existing methods and systems can provide high-precision thread detection results, their designs have the following problems in practical application.
(1)
At present, the screw thread images in most literature are collected under the ideal conditions of the laboratory, and the structural requirements of the image acquisition system in the complex environment during on-machine measurement are not considered.
(2)
Due to the existence of the helical structure in the thread, the position of the thread teeth in the different thread images collected on-machine is uncertain, and the template matching method based on grayscale or shape cannot solve the precise positioning of the thread teeth; therefore, the precise measurement of the thread cannot be realized.
(3)
Due to the generation of static electricity, iron filings or dust will adhere to the thread teeth during the threading process. How to design algorithms to effectively remove such noise factors is also the focus of research.
Aiming at the above problems, inspired by the robotic arm in the literature [6], a machine vision system with an adjustable light source device based on a manipulator is designed to solve the first problem above. Based on the characteristics of the thread profile, this paper extended the concept of directional edge detection in the literature [8], and a directional edge detection operator is proposed to solve the problem of precise positioning of the thread teeth. Noise filtering algorithms are developed based on the connected domain to solve the third problem above, and the on-machine high-precision measurement of thread parameters is realized.

2. System Setup

2.1. Sucker Rod Thread

In practical applications, there are many types of sucker rods. The research object selected in this paper is the model 1 1 16 , whose theoretical geometric dimension requirement is shown in Figure 2.
The geometric dimension of the sucker rod thread includes five parameters: the major diameter, minor diameter, effective diameter, pitch, and thread angle. Table 1 lists the measurement standard of the end thread of the sucker rod with model 1 1 16 , which is developed by the American Petroleum Institute.

2.2. Measurement System

The screw thread measurement system is shown in Figure 3, and it includes a machine vision module, manipulator, and analog CNC lathe machine tool. Among them, the manipulator is a robot produced by ABB, which can realize six degrees of freedom movement and meet the needs of complex working conditions. The machine vision module includes a camera, telocentric lens, and parallel light source.
The measurement based on machine vision mainly includes two parts: the hardware and software parts. The hardware system is responsible for stably and reliably collecting high-quality thread images, involving the selection of light sources, cameras, and lenses, as well as reasonable layout; the software part is responsible for the processing and analysis of thread images, and the accurate calculation of various parameters of the screw thread.
In order to ensure the accuracy of thread dimension measurement, the machine vision module adopts a high-performance industrial camera to capture the thread image at a resolution of 5480 × 3648. Taking full account of the structure and measurement tolerance requirements of the measured screw thread, the parameters of the camera and lens are listed in Table 2.
In order to realize multitype thread measurement, the manipulator can carry the light source device for adaptive light source adjustment. The manipulator motion trajectory planning includes the origin waiting position, internal workpiece position, and motion trajectory. The motion trajectory needs to be taught in advance to avoid collisions between the manipulator and the CNC lathe machine tool.

2.3. Principle of Dimension Calculation

Most of the previous literature on thread measurement directly adopts the standard part ratio method [8,11], which is the ideal condition and cannot be applied to the actual production line. In order to improve the robustness of dimensional measurement accuracy, this paper converted pixel coordinates to world coordinates for dimension calculation based on camera calibration parameters.
The height of the diffuse reflection light source plate 4 is at the same height as the center line of the tested thread by adjusting the height adjustment mechanism 6. On the premise of ensuring that the captured image is clear, 20 pictures of the calibration plate 5 in different positions in space are collected, and the first picture is selected as the main world coordinate system. The camera calibration system is shown in Figure 4.
Based on pinhole projection, assuming the measurement plane in the main world coordinate system is Z W = 0 , the perspective projection formula from the world coordinates to the pixel coordinates [24] is as follows:
s [ u v 1 ] = [ α γ u 0 0 β v 0 0 0 1 ] [ R T ] [ X W Y W 0 1 ] = [ α γ u 0 0 β v 0 0 0 1 ] [ r 1   r 2 T ] [ X W Y W 1 ] = M i n M o u t [ X W Y W 1 ] = H [ X W Y W 1 ]
In the equation, ( u , v ) is the coordinate in the pixel coordinate system, and ( X w , Y w , 0 ) in the main world coordinate system. M i n = [ α γ u 0 0 β v 0 0 0 1 ] represents the intrinsic camera parameters, and [ R T ] represents the extrinsic camera parameters. H is the product of the above two, which is a three-order matrix. s is the scale factor, and R   and   T denote the rotation and translation matrixes, respectively.
The result of the camera calibration distortion parameter is as follows:
[ k 1 , k 2 , p 1 , p 2 , k 3 ] = [ 0.00164 , 0.0513 , 0.0117 , 0.0141 , 0.0482 ]
The above distortion parameter results prove that the distortion of telecentric imaging is small, which ensures the accuracy of visual dimension measurement.
The result of the internal parameter matrix obtained by the camera calibration is as follows:
M i n = [ 126105 0 3486 0 126137 2167 0 0 1 ]
The result of the external parameter matrix obtained in the main world coordinate system by the camera calibration is as follows:
M o u t = [ 0.056 0.998 17.407 0.998 0.056 12.653 0.004 0.009 1498.156 ]
Thus, the 3-order matrix H can be obtained as follows:
H = [ 7088.055 125869.124 3.027 e 6 125924.583 7128.754 1.65 e 6 0.004 0.009 1498.156 ]
Given the coordinate of the pixel point, multiply the inverse matrix of H to the left, and then obtain the corresponding world coordinate by de-homogenization.
[ X Y Z ] = 1 s [ X W Y W 1 ] = H 1 [ u v 1 ]
[ X W Y W ] = [ X / Z Y / Z ]
After solving formula (7) to obtain X w   and   Y w , the real space point ( X w , Y w , 0 ) in the main world coordinate system is obtained. The screw thread dimension measurement is the distance between these real points.

2.4. MPEE and Measurement Uncertainty

For a high-precision measurement system, there are many factors that affect the measurement error, which need to be verified by experiments. In order to verify the validity of the above-mentioned visual measurement system, the maximum permissible error for length measurement (MPEE) and the measurement uncertainty of the measurement system are given. In this paper, the following verification scheme was designed with reference to the MPEE calculation process of CMM and the uncertainty of length measurement in the literature [25]. In this paper, three standard length gauge blocks and three angle gauge blocks were selected to realize the calculation of MPEE of this vision system. The three length gauge blocks are all grade I precision gauge blocks; the theoretical values are 5 mm, 8 mm, and 20 mm, respectively, and the accuracy deviations are ±0.2 μm, ±0.2 μm, and ±0.3 μm, respectively. The theoretical values of the three grade I angle gauge blocks are 45°, 60°, and 75°, respectively, and the accuracy deviations are all ±10’’. Because none of the measuring equipment in our laboratory can realize the true value measurement of the above-mentioned length gauge blocks and angle gauge blocks, this paper considered that the theoretical value of each gauge block is its true value. The measurement experiment process is shown in Figure 5.
Each of the above length gauge blocks is placed in five different positions, and three different poses are randomly assigned to each position. For the length measurement experiment, a total of 3 × 5 × 3 = 45 images were collected. The above same process was used in the angle measurement experiment, and 45 angle gauge block images of angle calibration were also obtained. The five positions in the camera’s field of view are shown in Figure 6. The acquired images of the length and angle gauge blocks are shown in Figure 7 and Figure 8, respectively.
After obtaining the collected image of the standard gauge block, based on the camera calibration parameters obtained above, the canny edge detection algorithm is used to realize the visual measurement of the length and angle. The measurement results are shown in Table 3.
As shown in the above table, after measurement and calculation, the MPEE of the visual measurement system in this paper is 30 + L 10 μm, and the accuracy deviation of the angle is 60′′. The measurement results fully verify the validity and accuracy of the measurement system in this paper.

3. Algorithm and Principles

The actual captured thread image and nomenclatures of thread teeth are shown in Figure 9a,b, respectively. The screw thread dimension measurement in this study measures the thread angle; pitch; and minor, major, and pitch diameters in Figure 9b.
The basic specification of the screw thread is shown in Figure 10.
The procedure to measure the thread dimensions is shown in Figure 11.
The procedure of the screw thread dimension measurement includes light source device adjustment, image preprocessing, thread teeth positioning, thread image analysis, and dimension measurement. The screw thread dimension measurement starts from the positioning of the spindle of the CNC lathe to determine the position of the thread workpiece to be measured; and then the manipulator carries the light source device for lighting; after that, screw thread images were captured through the vision module. In order to improve the contrast between the screw thread profile and the background in the image, the method of back-to-parallel light source illumination is adopted, combined with a high-intensity light source, to obtain a clear and sharp thread profile, so as to quickly and easily realize subsequent image processing and analysis.
In order to improve the screw thread dimension measurement speed, the original screw thread image is cropped to obtain the region of interest (ROI) by fixed pixel row and column coordinate position because the position of the threaded workpiece to be tested is almost unchanged. Next, we perform image grayscale, pixel smoothing filtering, and OTSU binarization image preprocessing operations on the ROI area. The obtained binarized image retains the core contour information of the screw thread and then uses the custom directional edge detection operators (DEDOs) to detect the left and right edges of the screw thread. After that, we use the connected domain area and its minimum circumscribed rectangle inclination (CDAMRI) algorithm to filter out the noise area such as dust and oil. Then, in order to facilitate the pairing calculation of the left and right edges of the screw thread, the left and right contour edges of the screw thread are sequentially sorted from top to bottom and left to right based on the connected domain centroid (CDC) method. Actually, on account of the obstruction of dust and oil, the original thread profile edge may be divided into several isolated connected domains after edge detection by DEDO; we design the connected domain union (CDU) algorithm to judge whether the adjacent connected domains are collinear; and then we perform straight-line fitting on each independent unified connected domain and use the left and right edges matching (LREM) algorithm to position each complete thread. Finally, we apply a screw thread parameter calculation (STPC) algorithm to obtain the measured parameter results. The principles of the key algorithms are explained as follows.

3.1. Image Processing

After cropping the original image to obtain the ROI, the three-channel original image is grayed by the weighted average method to obtain a single-channel image [27], which improves the subsequent image processing speed. Because the screw thread dimension measurement system is performed on-machine, the actual captured image, which is disturbed by noise, is filtered by a three-order Gaussian convolution kernel [28]. After that, the OTSU [29] with adaptive threshold is used to realize the binarization of the image, and the obtained binarized image data are simple in content and convenient for subsequent image processing and, at the same time, retain the core profile information of the thread to ensure the measurement accuracy.

3.2. Directional Edge Detection Operator (DEDO) for Screw Thread Positioning

The premise of obtaining the accurate measurement of screw thread parameters is to realize the accurate positioning of the screw thread. In the actual production process, the position and orientation of the camera in the vision module are fixed, and the spindle of the CNC lathe machine tool rotates with the screw thread to be measured. Due to the characteristics of the helical structure of the screw thread, the positions of the screw thread profile are uncertain when capturing the screw thread image at different times. This means that precise positioning of thread teeth cannot be achieved by template matching. Although there are many papers on the screw thread dimension measurement, very few papers mention the problem of automatic positioning of thread teeth. The corner detection method mentioned in [13] is used to separate the straight-line boundary and bottom arc of the thread teeth. The DP algorithm in [30] is used to approximate the thread profile, but not single thread teeth are positioned in the thread image, which makes automatic measurement of sucker rod end threads impossible. In this paper, according to the prior knowledge of the measured thread profile angle, a directional edge detection operator (DEDO) was specially designed to realize the edge detection of a specific angle in the screw thread image, so as to realize the high-precision positioning of the thread teeth.

Principle of DEDO

The calculation principle of the DEDO’s convolution kernel is shown in Figure 12. The standard value of the measured thread angle is 60°. In image edge detection, the normal direction of the edge line is the direction in which the gray value of the pixel changes the fastest. In order to enable the convolution kernel to achieve directional edge detection, it is supposed that the weight of each position in the convolution kernel is related to the distance from the center point and the distance D 1 , D 2 in Figure 12b.
As shown in Figure 12b, the size of the convolution kernel is 7 × 7, and the center point of the convolution kernel is the origin of the coordinate system. The yellow line is the straight line to be detected at a given angle, and the two red dotted lines are the normal lines of the edge line passing through points P1 and P2. D 1 and D 2 are the distances from each position point in the convolution kernel to the two normal lines.
The theoretical functional relationship between weight and distance needs to be further studied and explored in the future. For the convolution kernel of 60° directional edge detection, the weight assignment algorithm is given in this paper as follows:
f ( x , y ) = { 0 D 1 + D 2 T h r e d 1 s g n ( a e x + b e y + c e ) x 2 + y 2 T h r e d 2   a n d   D 1 + D 2 < T h r e d 1 2 * s g n ( a e x + b e y + c e ) x 2 + y 2 < T h r e d 2   a n d   D 1 + D 2 < T h r e d 1
In the equation, a e , b e , c e are the coefficients of the edge line equation, and s g n ( x ) is the signum function.
Based on the above algorithm principle, the convolution kernel weights are shown in Figure 12c assuming T h r e d 1 = 2 and T h r e d 2 = 2 . Similarly, all directional edge detection convolution kernels of the thread teeth can be designed, which are shown in Figure 13.
As shown in Figure 13, there is a symmetric relationship between the convolution kernel weights. In fact, (b), (c), and (d) in Figure 13 can be obtained by flipping the left and right or up and down of (a).
The Sobel operator [31] is a widely used edge detection operator in image processing, which has the characteristics of simple principle and fast operation speed. It has been extended to realize edge detection in eight directions. In order to highlight the superiority of the custom DEDOs, we compare the 67.5° and 112.5° convolution kernels in the eight-direction Sobel operator. The 67.5° and 112.5° Sobel convolution kernels are shown in Figure 14, and the results of edge detection with DEDO and the Sobel operator are shown in Figure 15.
As shown in Figure 15, the custom DEDOs increase the weight of the specific directional edge while reducing the weight of the edges in other directions, and the image edge was obviously more concise and precise, which is more favorable for the edge extraction analysis. By comparison, it is found that the 67.5° and 112.5° Sobel operator detects more edge information, which includes the crest and root part of the screw thread, rather than a complete straight line, which interferes with the straight-line fitting of the edge. Thus, the effectiveness and superiority of the proposed DEDO operator are significantly demonstrated.

3.3. Noise Area Filtering Based on Connected Domain Area and Its Minimum Circumscribed Rectangle Inclination (CDAMRI)

The edge image detected by DEDOs is affected by dust and oil, and the contour edges of the thread teeth can be segmented into multiple connected domains. At the same time, the edge image may contain small discrete noise domains, which obstruct subsequent image analysis and processing. Firstly, based on the connected domain, the small discrete noise domains whose area is less than the set threshold are deleted. Then, the image is dilated to connect the originally collinear discrete connected domains. Because the result of the image dilation operation is controlled by the structural elements, in order to ensure the accuracy of thread dimension measurement, the structural elements need to expand the edge image as far as possible in the direction of the edge straight line but keep the same as far as possible in the direction of the normal line. These two requirements are exactly the functions of the above DEDOs. Thus, this paper repeatedly used the DEDOs to perform the dilation operation.
The results of image dilation are shown in Figure 16. Compared with the original edge image, the connectivity of the image is greatly improved. At the same time, it is only limited to the edge straight-line direction, which ensures the accuracy of the straight-line fitting. For other noise-connected domains, after dilation operation, the area and direction are also enhanced to a certain extent. At this time, it can be further filtered out by the area of the connected domain [32] and the angle between the long side of the minimum circumscribed rectangle of the connected domain and the X-axis.
The minimum circumscribed rectangle inclination angle is shown in Figure 17. Let the rectangle P 0 P 1 P 2 P 3 be the minimum circumscribed rectangle of a certain connected domain, and define the angle α between the long side P 0 P 1 and the X-axis as the inclination of the rectangle P 0 P 1 P 2 P 3 . The angle α threshold of the left and right edges is defined as 150° and 30°, respectively. The inclination results of connected domains are shown in Figure 16e,f, and the results after filtering the noise-connected domains are shown in Figure 16g,h.
As shown in Figure 16, based on the CDAMRI algorithm, the noise-connected domains are well filtered out, and only the thread profile edge information we are interested in is retained, which greatly facilitates the subsequent image analysis and processing and improves the dimension measurement accuracy.

3.4. Connected Domain Sorting Algorithm Based on Connected Domain Centroid (CDC)

Before realizing the accurate positioning of the thread teeth, it is necessary to sort the connected domains to ensure that the connected domains of the left and right edges of the thread teeth follow the same marking sequence rules. In this paper, the connected domain was marked from top to bottom and from left to right. Considering that the edge lines on the same side of the thread are approximately parallel, the centroids of the connected domains can be used to judge their positional relationship. Common connectivity methods include four-connectivity and eight-connectivity. Based on the eight-connectivity method, this paper used depth-first search (DFS) [33] to locate each connected domain in the image and solve its centroid.
Generally, the centroid calculation formula is as follows:
x ¯ = D x ρ ( x , y ) d σ D ρ ( x , y ) d σ , y ¯ = D y ρ ( x , y ) d σ D ρ ( x , y ) d σ
For a two-dimensional image, it is an ideal uniform object, and the pixel coordinate points are discrete. The above formula can be transformed into a formula, that is, the average value of each coordinate point of each pixel point in the connected domain.
x ¯ = 1 n x i n , y ¯ = 1 n y i n
Figure 18 shows the results of connected domain sorting. As shown in Figure 18, the sequential sort of the connected domains is well-realized by applying the CDC algorithm, which provides convenience for the subsequent image analysis and dimension measurement.

3.5. Connected Domain Union (CDU) Algorithm

The above connected-domain-sorting results show that under the influence of electrostatic dust and oil in the field production environment, even after morphological dilation operations, the screw thread edge may be divided into multiple discrete connected domains. As shown in Figure 12, there are 14 connected domains on the left edge, which actually has only eight complete straight lines. Thus, it is necessary to perform a unified operation on the above sorted connected domains and unify the discrete connected domains that belong to the same thread edge as a new connected domain. Straight-line fitting is performed on each of the above connected domains in order, and the degree of coincidence of the two straight lines before and after can be judged. When the degree of coincidence is greater than the set threshold, it means the two adjacent connected domains before and after belong to the same straight line. Considering that the edge lines on the same side of each thread are approximately parallel, the inner product between the straight-line coefficients cannot be directly used for judgment. On the other hand, the intercept of the straight line and the Y-axis is significantly affected by the size of the image. Even if the angle between the two adjacent straight lines is small, if the image pixels are large, the difference between the intercepts of the two straight lines is large enough, even exceeding the pitch of the screw thread. In this paper, the connected domain centroid data obtained in the CDC algorithm were used to judge whether the two adjacent connected domains belong to the same profile edge of the thread teeth by judging the distance from the connecting centroid to the previous straight line. The pseudocode of the CDU algorithm is shown in Algorithm 1.
Algorithm 1 Connected Domain Union (CDU)
Input: C o n t o u r s :   Connected   domain   lists ,   r e t : remove the connected domain whose area is smaller than r e t
Output: l i n e P a r a s : the fitting line parameters of the unified connected domain, c e n t r o i d s : the centroid of unified connected domain
1 :   function   U n i o n F i t l i n e   ( C o n t o u r s ,   r e t )
2 :   l i n e P a r a s [ ]
3 :   f o r m e r C o n t o u r [ ]
4 :   c e n t r o i d s [ ]
5 :   f o r m e r l i n e P a r a 0
6 :   for   c o n t o u r   in   C o n t o u r s do
7 :   l i n e P a r a Apply LS algorithm to fit the contour
8 :   c o n t o u r c e n t r o i d Calculate the Geometric Moment of the contour to get the centroid
9 :   d i s t a c n e Calculate the distance from c o n t o u r c e n t r o i d   to   f o r m e r l i n e P a r a
10 :   if   f o r m e r C o n t o u r   is   not   None   and   d i s t a n c e < r e t then
11 :   c o n t o u r Unify   the   f o r m e r C o u t o u r   and   c o n t o u r
12 :   l i n e P a r a Apply   LS   algorithm   to   fit   the   c o n t o u r
13 :   c o n t o u r c e n t r o i d Calculate the Geometric Moment of the c o n t o u r to get the c e n t r o i d
14 :   l i n e P a r a s . p o p ( )
15 :   c e n t r o i d s . p o p ( )
16: end if
17 :   l i n e P a r a s . a p p e n d ( l i n e P a r a )
18 :   c e n t r o i d s . a p p e n d ( c e n t r o i d )
19 :   f o r m e r l i n e P a r a   l i n e P a r a
20 :   f o r m e r C o n t o u r c o n t o u r
21: end for
22 :   return   l i n P a r a s ,   c e n t r o i d s
end function
Straight lines of the new connected domains, which are obtained by the CDU algorithm, are fitted with the least squares method [34], and the results are shown in Figure 19.
As shown in Figure 19, the yellow straight line is the fitting result of the new connected domain, and the red line below it is the fitting straight line of a certain connected domain. It can be found that the fitting result of the new connected domain better fits the edge information, which proves the necessity of performing the unified operation of segmented connected domains and ensures the measurement accuracy of thread dimension.

3.6. Left and Right Edges Matching (LREM) Algorithm

The thread profile edge detection results are significantly affected by on-site dust and oil pollution. If the left and right edges of the same thread teeth are polluted to different degrees, the number of detected left and right edges of the thread will be inconsistent. The inconsistent number of left and right edges is shown in Figure 20. In Figure 20, the number of left edges is one more than that on the right side, so it is necessary to judge whether the left and right edges are matched.
The left and right edges matching (LREM) algorithm can be achieved by calculating the distance of the centroid of the connected domain. The pseudocode is shown in Algorithm 2.
Algorithm 2 Left and Right Edges Matching (LREM)
Input :   l e f t C e n t r o i d s : the centroids of the left profile of thread; r i g h t C e n t r o i d s : the centroids of the right profile of thread; l e f t l i n e P a r a s : the fitting line parameters of the left profile of the thread; r i g h t l i n e P a r a s : the fitting line parameters of the right profile of thread; r e t : the left and right profile are matching when the distance of Y coordinate of left and right centroid is not larger than r e t
Output :   a n g l e l i s t s : the angle lists of left and right profiles of thread; p o i n t C o o r d s : the intersection point lists of the left and right profiles of thread
1 :   function   P i x e l E d g e M a t c h i n g ( l e f t C e n t r o i d s ,   r i g h t C e n t r o i d s ,   l e f t l i n e P a r a s ,
        r i g h t l i n e P a r a s ,   r e t )
2 :   a n g l e l i s t s     [ ]
3 :   p o i n t C o o r d s [ ]
4 :     l e f t S i z e l e f t C e n t r o i d s . s i z e
5 :     r i g h t S i z e r i g h t C e n t r o i d s . s i z e
6 :   l e f t I d 0
7 :   r i g h t I d 0
8 :   while   l e f t I d < l e f t S i z e   and   r i g h t I d < r i g h t S i z e do
9 :   l e f t Y l e f t C e n t r o i d s [ l e f t I d ] . Y
10 :   r i g h t Y   r i g h t C e n t r o i d s [ r i g h t I d ] . Y
11 :   if   l e f t Y > r i g h t   Y then
12 :   r i g h t I d >   r i g h t I d + 1
13 :   c o n t i n u e
14 :   else   if   r i g h t Y l e f t Y > r e t then
15 :   l e f t I d l e f t I d + 1
16 :   c o n t i n u e
17:  else
18 :   l e f t P   l e f t l i n e P a r a s [ l e f t I d ]
19 :   r i g h t P r i g h t l i n e p a r a s [ r i g h t I d ]
20 :   a n g l e ,   p C o o r d   Calculate the angle-off and intersection point coordinates in use of l e f t P and r i g h t P
21 :   a n g l e l i s t s . a p p e n d ( a n g l e )
22 :   p o i n t C o o r d s . a p p e n d ( p C o o r d )
23 :   l e f t I d l e f t e I d + 1
24 :   r i g h t I d r i g h t I d + 1
25:  end if
26: end while
27 :   return   a n g l e   l i s t s ,   p o i n t C o o r d s
28: end function
Figure 21 shows the precise positioning of the thread teeth with the LREM algorithm. After that, based on the least squares method, the parametric equation of the fitted straight line can be obtained, and then the thread teeth profile angles, as well as parameters such as the pitch and major diameter, can be obtained.

4. Experiments and Discussion

4.1. Measurement of Standard Angle Gauge Block

To verify the accuracy of the DEDOs, a standard 60° angle gauge block is tested. The captured image is preprocessed according to the above image preprocessing methods in Section 3.1, and then the directional edge detection is performed on the binarized image by applying the DEDOs. The actual gauge block angle is 60°, and the angle between the left and right sides and the horizontal line is approximately 60° and 120°, respectively. The obtained detection effect and actual measurement angle result are shown in Figure 22.
As shown in Figure 22, the DEDOs accurately detect the edge line at the specified angle and calculates the included angle of the gauge block, which deviates from the standard value by less than 0.3° under the condition with noise such as dust, which proves the effectiveness and accuracy of the DEDO.

4.2. Screw Thread Parameters Calculation (STPC) Algorithm

The measurement diagram of the screw thread angle, pitch, major diameter, minor diameter, and pitch diameter parameter measurement is shown in Figure 23.
Due to the generation of static electricity, iron filings or dust will adhere to the thread teeth during the threading process; dimension measurement by the distance between pixel points alone cannot guarantee the accuracy and stability of the measurement. Thus, this paper proposed to use the distance between the fitted straight lines to measure the size so as to ensure the accuracy and robustness of the measurement. As shown in Figure 23, the upper peak point P 1 ,   P 2 , P 3 is the intersection point of the fitting line between the left and right edges of the upper part of the screw thread, and the upper peak line specifically is the fitting line of the upper peak points P 1 ,   P 2 , P 3 . Similarly, the upper crest line is the fitting line of the upper crest points, which are the intersection points between the thread crest profile and the vertical line through the peak points. Each peak point has its corresponding crest point. In the same way, other fitted straight lines, such as the lower peak and crest line, can be obtained.

4.2.1. Screw Thread Angle

The screw thread angle is the angle between the left and right profile edges of the thread. After the algorithm analysis in the third section, the least squares method can be used to obtain the left and right thread edge fitting straight-line parameters, including the straight-line slope k and the intercept b on the Y-axis. The screw thread angle θ is given by
θ = a r c t a n | k 2 k 1 1 + k 1 k 2 |

4.2.2. Pitch

The pitch is the distance between two adjacent thread teeth axes, that is, the distance between two adjacent peak points. The screw threads in the on-machine measurement are subject to many interference factors. In order to ensure the accuracy of the thread pitch measurement, the thread pitches between adjacent peak points are measured, and the average value is taken as the final thread pitch value.
In the image coordinate system, the unit of the calculated pitch is pixels, which needs to be converted to the world coordinate system. Most of the previous literature on thread measurement directly adopts the standard part ratio method, which cannot be applied to the actual production line. Based on the dimension calculation principle in Section 2.3, this paper converted the pixel points to the world coordinate system one by one and then calculated the distance between adjacent points in the world coordinate system to obtain the actual physical value of the thread pitch.

4.2.3. Major Diameter, Minor Diameter, and Effective Diameter

The major diameter of the screw thread is the distance between the crest line in the upper profile of the screw thread and the crest line in the lower profile of the screw thread. In the same way, the minor diameter is the distance between the upper and lower valley lines, and the effective diameter can be calculated by taking the average of the major and minor diameters. In actual measurement, the upper and lower crest lines cannot be guaranteed to be completely parallel, and the major diameter cannot be directly calculated from the slope and the difference of intercept. Taking the measurement of the major diameter of the thread as an example, in order to ensure the accuracy of the measurement, this paper selected multiple crest points in the upper crest line and calculated the distance of these crest points to the lower crest line. Finally, we take the average value as the major diameter of the thread. The measurement of the minor diameter is the same. It should be noted that, similar with the above pitch measurement method, the pixel coordinates are converted to the world coordinate system to obtain the actual physical size.

4.3. Discussion

In order to verify the validity of the measurement results of the machine vision algorithm proposed in this paper, a 19JA-780/250 universal tool microscope (UTM) shown in Figure 24 was used to measure the screw thread angle, major diameter, minor diameter, and pitch of the end of a sucker rod, and these measurement results are the standard reference values. The indoor temperature is 20 °C during the measurement, the graduation value for the length measurement of this device is 1 μm, and the division value of the 360° angle measurement range is 1’. MPEE: (2.25 + L/40) um; MPEP: 1.5 um. The screw thread measurement platform by applying the UTM is shown in Figure 24.
The results of the screw thread parameters measured by machine vision and the UTM are shown in Table 4. The display of measurement results in the screw thread is shown in Figure 25.
It can be shown from Table 3 that
(1)
The actual measured value of the tooth profile angle is greater than the theoretical value. After analysis, it is the reason for the real processing and production. As shown in Table 1, although the theoretical standard value of the thread angle is 60°, it has a large qualified interval, from 59.5 to 61.5, and other size parameters also have corresponding size ranges.
(2)
The minimum and maximum deviations of the thread angle measured by the proposed method and the UTM method are 0.011° and 0.63°, respectively, and the total average deviation is less than 0.08°, which proves the effectiveness and accuracy of the method in this paper for the thread angle. Moreover, the robustness of the visual measurement method is better than that of the UTM method.
(3)
For the screw thread pitch, major diameter, and minor diameter parameter measurement, the deviation of the measurement results of the proposed method and the UTM method is less than 10 μm. At the same time, the stability of the proposed method is better than that of the UTM method, and the effectiveness and accuracy of the visual method proposed in this paper for on-machine thread dimension measurement are significantly demonstrated. On the other hand, the completion time of the thread parameter measurement method proposed in this paper is about 0.13 s, which fully meets the real-time requirements of online thread measurement.
The positioning of each thread teeth and the measurement of each of the thread parameters are shown in Figure 25. In Figure 25, ( X , Y ) is the coordinate of the intersection point in the pixel coordinate system.

5. Conclusions

Most previous studies mainly focused on the off-machine thread dimension measurement and rarely discussed on-machine detection and measurement, which is still not up to the requirements of practical production applications. Thus, this paper studied the on-machine measurement method of sucker rod end screw threads based on machine vision. The procedure of the screw thread dimension measurement includes light source device adjustment, image preprocessing, thread positioning, thread image analysis, and dimension measurement.
(1)
CNC machine tools and a manipulator are combined to achieve adjustable light source illumination for high-quality image acquisition of screw threads.
(2)
The custom DEDOs based on the prior knowledge of the thread profile edge angle is developed to accurately and reliably detect the left and right edges of the thread teeth for the positioning of the thread teeth.
(3)
CDAMR, CS, CD, and LREM algorithms are developed to eliminate the influence and interference of electrostatic dust and oil pollution in on-site measurement so as to achieve high-precision measurement of the thread profile angle, pitch, major diameter, minor diameter, and pitch diameter.
(4)
The experimental results show that the maximum and minimum average errors of the thread angles are 0.011° and 0.63°, respectively, and the total average deviation is less than 0.08°. For the screw thread pitch, major diameter, minor diameter, and pitch diameter parameter measurement, the deviation of the measurement results of the proposed method and the UTM method is less than 10 μm. At the same time, the completion time of the thread parameter measurement method is about 0.13 s, which fully meets the real-time requirements of thread online measurement.
In general, the method proposed in this paper achieves high-precision thread parameter dimension measurement under the complex background containing dust and oil pollution, which proves the effectiveness and accuracy of the method proposed. In the future, the measurement accuracy can be further improved by optimizing the camera calibration method and using subpixels. This system has laid a good foundation for the thread on-line measurement of subsequent production lines and has great practical application significance.

Author Contributions

Conceptualization, K.X. and X.L.; methodology, X.L. and S.W.; software, X.L. and S.W.; validation, X.L., K.X. and S.W.; formal analysis, S.W.; investigation, X.L.; resources, X.L.; data curation, S.W.; writing—original draft preparation, X.L.; writing—review and editing, K.X.; visualization, S.W.; supervision, K.X.; project administration, K.X.; funding acquisition, K.X. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the National Key R&D Program of China (grant number 2021YFB3202403), and the National Natural Science Foundation of China (grant number 51874022).

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Ding, H.; Xie, J.; Bai, Z.; Li, Y.; Long, Y.; Qi, D.; Li, H. Fracture analysis of a connecting rod for oil pumping unit in China western oilfield. Eng. Fail. Anal. 2019, 105, 313–320. [Google Scholar] [CrossRef]
  2. An, J.; Li, C.; Wen, Z.; Yang, Y.L.; Sun, S.J. Study of boronizing of steel AISI 8620 for sucker rods. Met. Sci. Heat Treat. 2012, 53, 598–602. [Google Scholar] [CrossRef]
  3. Ding, H.; Zhang, A.B.; Qi, D.T.; Li, H.B.; Ge, P.L.; Qi, G.Q.; Ding, N.; Bai, Z.Q.; Fan, L. Failure analysis of a sucker rod fracture in an oilfield. Eng. Fail. Anal. 2020, 109, 104300. [Google Scholar] [CrossRef]
  4. Feng, Z.; You, F.; He, J. Research on application of corner detection in thread vision measurement. J. Phys. Conf. Ser. 2021, 1812, 012020. [Google Scholar] [CrossRef]
  5. Yang, Z.; Chen, M.; Wang, P. Effect of oil adhesion on the measurement of screw thread with machine vision. Meas. Control 2020, 53, 922–933. [Google Scholar] [CrossRef]
  6. Sun, W.-H.; Yeh, S.-S. Using the Machine Vision Method to Develop an On-machine Insert Condition Monitoring System for Computer Numerical Control Turning Machine Tools. Materials 2018, 11, 1977. [Google Scholar] [CrossRef] [Green Version]
  7. Chen, M. Compensation of thread profile distortion in image measuring screw thread. Measurement 2018, 129, 582–588. [Google Scholar] [CrossRef]
  8. Min, J. Measurement method of screw thread geometric error based on machine vision. Meas. Control 2018, 51, 304–310. [Google Scholar] [CrossRef]
  9. Senthilnathan, R.; Nandhini, M.; Ranjani, R.; Sridevi, S. Vision based orientation invariant measurement of metric screw thread parameters. In Proceedings of the 2017 Trends in Industrial Measurement and Automation, Chennai, India, 6–8 January 2017; pp. 1–5. [Google Scholar] [CrossRef]
  10. Lavrinov, D.S.; Khorkin, A.I. Laser triangulation 2D scanner signal processing for premium thread pitch measurement. In Proceedings of the 2017 International Conference on Industrial Engineering, Applications and Manufacturing (ICIEAM), Petersburg, Russia, 16–19 May 2017; pp. 1–5. [Google Scholar] [CrossRef]
  11. Gadelmawla, E. Computer vision algorithms for measurement and inspection of external screw threads. Measurement 2017, 100, 36–49. [Google Scholar] [CrossRef]
  12. Min, J. Comprehensive measurement system for screw thread parameter based on machine vision. In Proceedings of the 2015 International Conference on Computer and Computational Sciences (ICCCS), Reykjavík, Iceland, 27–29 January 2015; pp. 266–270. [Google Scholar] [CrossRef]
  13. Bin Wu, W.; Shao, D.X.; Wang, W.Q.; Wang, G.L. Thread Measurement Algorithm Research and Software Development. Key Eng. Mater. 2013, 579–580, 392–397. [Google Scholar] [CrossRef]
  14. Shaowei, S.; Shuhua, Y.; Chunlei, Z.; Huipeng, T. Research Based on the CCD Vision Thread Parameters Automatic Detection Technology. In Proceedings of the 2007 8th International Conference on Electronic Measurement and Instruments, Xi’an, China, 16–18 August 2007; pp. 2-969–2-973. [Google Scholar] [CrossRef]
  15. Hunsicker, R.J.; Patten, J.; Ledford, A.; Ferman, C.; Allen, M.; Ellis, C. Automatic vision inspection and measurement system for external screw threads. J. Manuf. Syst. 1994, 13, 454–455. [Google Scholar] [CrossRef]
  16. Vitecek, A.; Sioma, A.; Suliga, P.; Kowal, J. Automatization of screw thread profile measurement using a 3D vision system. J. Mach. Constr. Maint. -Probl. Eksploat. 2018, 3, 15–22. [Google Scholar]
  17. Farana, R.; Sioma, A.; Suliga, P.; Kowal, J. A method of screw thread measurement using a 3D vision system. J. Mach. Constr. Maint.-Probl. Eksploat. 2018, 2, 7–14. [Google Scholar]
  18. Sheng, C.; Dongbiao, Z.; Yonghua, L. A New Compensation Method for Measurement of Thread Pitch Diameter by Profile Scanning. Meas. Sci. Rev. 2014, 14, 323–330. [Google Scholar] [CrossRef] [Green Version]
  19. Tong, Q.-B.; Han, B.-Z.; Wang, D.-L.; Wang, J.-Q.; Ding, Z.-L.; Yuan, F. A Novel Laser-Based System for Measuring Internal Thread Parameters. J. Russ. Laser Res. 2014, 35, 307–316. [Google Scholar] [CrossRef]
  20. Kosarevsky, S.; Latypov, V. Detection of Screw Threads in Computed Tomography 3D Density Fields. Meas. Sci. Rev. 2013, 13, 292–297. [Google Scholar] [CrossRef] [Green Version]
  21. Jiang, J.F.; Jiang, Z.X.; Zhang, Q.C.; Chai, G.Z.; Da Lu, C. Research on Screw Thread Vision Measurement. Adv. Mater. Res. 2011, 346, 600–606. [Google Scholar] [CrossRef]
  22. Kosarevsky, S.; Latypov, V. Development of an Algorithm to Detect Screw Threads in Planar Point Clouds. Meas. Sci. Rev. 2010, 10, 136–141. [Google Scholar] [CrossRef]
  23. Huang, H.-L.; Jywe, W.-Y.; Liu, C.-H.; Duan, L.; Wang, M.-S. Development of a novel laser-based measuring system for the thread profile of ballscrew. Opt. Lasers Eng. 2010, 48, 1012–1018. [Google Scholar] [CrossRef]
  24. Zhang, Z. A flexible new technique for camera calibration. IEEE Trans. Pattern Anal. Mach. Intell. 2000, 22, 1330–1334. [Google Scholar] [CrossRef] [Green Version]
  25. Swojak, N.; Wieczorowski, M.; Jakubowicz, M. Assessment of selected metrological properties of laser triangulation sensors. Measurement 2021, 176, 109190. [Google Scholar] [CrossRef]
  26. ISO 68-1:1998; ISO General Purpose Screw Threads—Basic Profile—Part 1: Metric Screw Threads. International Organization for Standardization: Geneva, Switzerland, 1998.
  27. Ahmed, S.; Ghosh, K.K.; Bera, S.K.; Schwenker, F.; Sarkar, R. Gray Level Image Contrast Enhancement Using Barnacles Mating Optimizer. IEEE Access 2020, 8, 169196–169214. [Google Scholar] [CrossRef]
  28. Liu, S.; Liu, D.; Srivastava, G.; Połap, D.; Woźniak, M. Overview and methods of correlation filter algorithms in object tracking. Complex Intell. Syst. 2021, 7, 1895–1917. [Google Scholar] [CrossRef]
  29. Hoang, N.-D. Detection of Surface Crack in Building Structures Using Image Processing Technique with an Improved Otsu Method for Image Thresholding. Adv. Civ. Eng. 2018, 2018, 3924120. [Google Scholar] [CrossRef] [Green Version]
  30. Shen, N.; Zhao, C.; Li, J.; Xu, Y.; Wu, Y.; Deng, Z. A parameterized automatic programming solution for composite grinding based on digital image processing. Int. J. Adv. Manuf. Technol. 2020, 110, 2727–2742. [Google Scholar] [CrossRef]
  31. Gao, W.; Zhang, X.; Yang, L.; Liu, H. An improved Sobel edge detection. In Proceedings of the 2010 3rd International conference on computer science and information technology, Chendu, China, 9 July 2010; Volume 5, pp. 67–71. [Google Scholar] [CrossRef]
  32. Thompson, M.; Gonzalez, R.C.; Wintz, P. Digital Image Processing. Leon 1981, 14, 256. [Google Scholar] [CrossRef]
  33. Tarjan, R. Depth-first search and linear graph algorithms. SIAM J. Comput. 1972, 1, 146–160. [Google Scholar] [CrossRef]
  34. Tey, W.Y.; Sidik, N.A.C.; Asako, Y.; Muhieldeen, M.W.; Afshar, O. Moving Least Squares Method and its Improvement: A Concise Review. J. Appl. Comput. Mech. 2021, 7, 883–889. [Google Scholar] [CrossRef]
Figure 1. Structure of sucker rod: (1) thread; (2) relief groove; (3) bearing surface; (4) wrench square; (5) transition section; and (6) rod body.
Figure 1. Structure of sucker rod: (1) thread; (2) relief groove; (3) bearing surface; (4) wrench square; (5) transition section; and (6) rod body.
Sensors 22 08276 g001
Figure 2. Theoretical geometric dimension requirement of sucker rod.
Figure 2. Theoretical geometric dimension requirement of sucker rod.
Sensors 22 08276 g002
Figure 3. Measurement platform: (1) manipulator; (2) camera; (3) telocentric lens; (4) parallel light; and (5) analog CNC lathe machine tool.
Figure 3. Measurement platform: (1) manipulator; (2) camera; (3) telocentric lens; (4) parallel light; and (5) analog CNC lathe machine tool.
Sensors 22 08276 g003
Figure 4. Camera calibration platform: (1) manipulator; (2) camera; (3) telocentric lens; (4) light source plate; (5) calibration plate; (6) height adjustable device; (7) parallel light; and (8) analog CNC lathe machine tool.
Figure 4. Camera calibration platform: (1) manipulator; (2) camera; (3) telocentric lens; (4) light source plate; (5) calibration plate; (6) height adjustable device; (7) parallel light; and (8) analog CNC lathe machine tool.
Sensors 22 08276 g004
Figure 5. Measurement experiment process.
Figure 5. Measurement experiment process.
Sensors 22 08276 g005
Figure 6. Five positions in the camera’s field of view.
Figure 6. Five positions in the camera’s field of view.
Sensors 22 08276 g006
Figure 7. Acquired images of length gauge blocks: (a) 5 mm length gauge block; (b) 20 mm length gauge block.
Figure 7. Acquired images of length gauge blocks: (a) 5 mm length gauge block; (b) 20 mm length gauge block.
Sensors 22 08276 g007
Figure 8. Acquired images of angle gauge blocks: (a) 45° angle gauge block; (b) 75° angle gauge block.
Figure 8. Acquired images of angle gauge blocks: (a) 45° angle gauge block; (b) 75° angle gauge block.
Sensors 22 08276 g008
Figure 9. External thread of sucker rod: (a) overall image; (b) local image of thread.
Figure 9. External thread of sucker rod: (a) overall image; (b) local image of thread.
Sensors 22 08276 g009
Figure 10. Basic specification of ISO thread [26].
Figure 10. Basic specification of ISO thread [26].
Sensors 22 08276 g010
Figure 11. Procedure to measure thread dimensions.
Figure 11. Procedure to measure thread dimensions.
Sensors 22 08276 g011
Figure 12. Operator principle: (a) edge of thread profile; (b) weight calculation principle of kernel; (c) directional edge detection kernel.
Figure 12. Operator principle: (a) edge of thread profile; (b) weight calculation principle of kernel; (c) directional edge detection kernel.
Sensors 22 08276 g012
Figure 13. Four DEDOs: (a) left edge DEDO of upper thread profile; (b) right edge DEDO of upper thread profile; (c) left edge DEDO of lower thread profile; (d) right edge DEDO of lower thread profile.
Figure 13. Four DEDOs: (a) left edge DEDO of upper thread profile; (b) right edge DEDO of upper thread profile; (c) left edge DEDO of lower thread profile; (d) right edge DEDO of lower thread profile.
Sensors 22 08276 g013
Figure 14. Directional Sobel operator: (a) 67.5° direction template; (b) 112.5° direction template.
Figure 14. Directional Sobel operator: (a) 67.5° direction template; (b) 112.5° direction template.
Sensors 22 08276 g014
Figure 15. Comparison of edge detection with DEDO and Sobel operator.
Figure 15. Comparison of edge detection with DEDO and Sobel operator.
Sensors 22 08276 g015
Figure 16. Results of image dilation and filtering out noise: (a) the left edge detection with left DEDO; (b) the right edge detection with right DEDO; (c) the dilation result of the left edge detection; (d) the dilation result of the right edge detection; (e) the result of the inclination angle of the minimum circumscribed rectangle of each connected domain in the left edge dilation image; (f) the result of the inclination angle of the minimum circumscribed rectangle of each connected domain in the right edge dilation image; (g) the left edge image after filtering out the noise-connected domains based on the inclination angle; (h) the right edge image after filtering out the noise-connected domains based on the inclination angle.
Figure 16. Results of image dilation and filtering out noise: (a) the left edge detection with left DEDO; (b) the right edge detection with right DEDO; (c) the dilation result of the left edge detection; (d) the dilation result of the right edge detection; (e) the result of the inclination angle of the minimum circumscribed rectangle of each connected domain in the left edge dilation image; (f) the result of the inclination angle of the minimum circumscribed rectangle of each connected domain in the right edge dilation image; (g) the left edge image after filtering out the noise-connected domains based on the inclination angle; (h) the right edge image after filtering out the noise-connected domains based on the inclination angle.
Sensors 22 08276 g016
Figure 17. Schematic diagram of minimum circumscribed rectangle inclination angle.
Figure 17. Schematic diagram of minimum circumscribed rectangle inclination angle.
Sensors 22 08276 g017
Figure 18. Connected domain sorting results.
Figure 18. Connected domain sorting results.
Sensors 22 08276 g018
Figure 19. Results of line fitting.
Figure 19. Results of line fitting.
Sensors 22 08276 g019
Figure 20. Inconsistent number of left and right edges.
Figure 20. Inconsistent number of left and right edges.
Sensors 22 08276 g020
Figure 21. Positioning of thread teeth based on LREM algorithm.
Figure 21. Positioning of thread teeth based on LREM algorithm.
Sensors 22 08276 g021
Figure 22. Detection and measurement result of standard gauge block.
Figure 22. Detection and measurement result of standard gauge block.
Sensors 22 08276 g022
Figure 23. The measurement diagram of the screw thread parameters.
Figure 23. The measurement diagram of the screw thread parameters.
Sensors 22 08276 g023
Figure 24. UTM platform: (1) UTM; (2) sucker rod thread; (3) adjustable device. (a) Overall display of UTM. (b) Partial display of UTM.
Figure 24. UTM platform: (1) UTM; (2) sucker rod thread; (3) adjustable device. (a) Overall display of UTM. (b) Partial display of UTM.
Sensors 22 08276 g024
Figure 25. Measurement results of screw thread dimension.
Figure 25. Measurement results of screw thread dimension.
Sensors 22 08276 g025
Table 1. Measurement tolerance of thread with model 1 1 16 (10UNR-2A).
Table 1. Measurement tolerance of thread with model 1 1 16 (10UNR-2A).
Pitch: 2.54 mm; 10 teeth/inch; Thread Angle: 60
Major DiameterMinor DiameterPitch DiameterThread Angle
∅26.624–∅26.952∅25.146–∅25.303≤∅23.83559.5–61.5
Table 2. Inherent parameters of camera and lens.
Table 2. Inherent parameters of camera and lens.
IndexParameter NamesParameters Values
1Pixels of camera5480 × 3648
2Physical size of the camera chip2.4 μm × 2.4 μm
3Area of the camera chip5480 × 2.4 = 13.152 mm
3648 × 2.4 = 8.7552 mm
4Lens ratio0.202
5Visual field13.152/0.202 = 65.11 mm
8.7552/0.202 = 43.34 mm
Table 3. Measurement results of length gauge blocks and angle gauge blocks.
Table 3. Measurement results of length gauge blocks and angle gauge blocks.
PositionsLength Gauge BlocksAngle Gauge Blocks
5 mm8 mm20 mm45°60°75°
Position15.0168.08520.01644.98560.00375.018
5.0248.04320.01344.99560.00374.904
5.0198.01620.01245.00260.00475.006
Position25.0178.00920.07644.98860.05475.001
4.9948.03720.02644.98360.01874.998
5.0258.01620.05144.99659.99575.004
Position34.9828.01420.02845.01259.9874.992
5.2358.01620.06645.00860.0275.015
5.0198.08920.07245.00759.99875.011
Position45.0228.01420.01144.99460.02875.049
5.0018.00519.98144.99559.99275.006
5.0158.06720.04845.03459.99575
Position55.0228.01720.01745.06660.00675.001
5.028.01320.02145.00459.99575.009
5.0178.01120.03145.04559.99275.011
x ¯ 5.0298.03020.03145.00860.00675.002
σ 0.0580.0280.0260.0230.0180.030
μ A 0.0180.0080.0080.0070.0050.009
MPEE ( 30 + L / 10 )   μ m
L is the measured length, in mm
60′′
0 0 360 0 angle measurement
Table 4. Measurement results of STPC and UTM.
Table 4. Measurement results of STPC and UTM.
IndexMethodThread AnglePitch1Maj DMin DD
12312---------------------------
1DEDO60.99161.48560.1432.5432.54326.51923.42524.972
UTM61.25461.28260.7752.5392.53827.76123.44725.104
2DEDO60.71161.42560.5782.5312.53126.62523.44925.037
UTM60.45461.90360.8852.5422.57626.81123.44325.127
3DEDO60.46561.43160.5332.5552.53126.67323.43725.055
UTM60.62761.02661.3342.5412.54626.85923.46625.163
4DEDO60.67960.91260.6822.5432.54326.70823.46525.087
UTM60.38661.67660.3532.5412.53826.90123.47525.189
5DEDO60.69461.32660.1992.5422.53326.73323.44125.087
UTM61.32561.02560.2532.5032.59426.84523.47925.162
6DEDO60.68560.79160.3952.5312.54226.75723.46625.112
UTM60.58461.52860.7062.5372.53426.85923.50225.179
7DEDO60.80561.45160.9462.5322.53126.53423.46725.001
UTM60.84561.33560.8852.5442.53926.91323.50725.211
8DEDO60.39561.47860.7332.5432.54226.63223.46825.05
UTM60.52861.52360.8542.5512.53826.82123.50725.164
9DEDO60.71161.32260.6992.5422.53526.67223.48225.077
UTM61.21361.54760.6682.5372.54726.82123.46425.143
10DEDO60.94661.53160.6072.5422.54326.72223.44625.084
UTM60.49761.54860.5822.5382.54326.92923.41725.173
x ¯ DEDO60.70861.31560.5522.5402.53726.65823.45525.056
UTM60.77161.43960.7302.5372.54926.95223.47125.162
σ DEDO0.1840.2550.2470.0070.0060.0810.0180.041
UTM0.3620.2760.3030.0120.0190.2870.0290.031
u 95 DEDO0.1320.1820.1770.0050.0040.0580.0130.029
UTM0.2590.1970.2170.0090.0140.2050.0210.022
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Li, X.; Wang, S.; Xu, K. Automatic Measurement of External Thread at the End of Sucker Rod Based on Machine Vision. Sensors 2022, 22, 8276. https://doi.org/10.3390/s22218276

AMA Style

Li X, Wang S, Xu K. Automatic Measurement of External Thread at the End of Sucker Rod Based on Machine Vision. Sensors. 2022; 22(21):8276. https://doi.org/10.3390/s22218276

Chicago/Turabian Style

Li, Xianyou, Shun Wang, and Ke Xu. 2022. "Automatic Measurement of External Thread at the End of Sucker Rod Based on Machine Vision" Sensors 22, no. 21: 8276. https://doi.org/10.3390/s22218276

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop