Design and Research of Numerical Measure Tool for Straight Spur Gear Based on Computer Vision

In this work, I present a comprehensive study on the design and development of a numerical measurement instrument for straight spur gear based on computer vision technology. The primary objective is to achieve high-precision, rapid, and automated parameter measurement of straight spur gear components, which are fundamental in mechanical transmission systems. I systematically describe the operating principle, hardware architecture, software functional modules, and core measurement algorithms. The experimental results demonstrate that the proposed instrument outperforms traditional contact-based methods in terms of accuracy, speed, and automation level, making it highly suitable for real-time quality control in gear manufacturing processes.

1. Introduction

Gears are among the most widely used mechanical transmission components, and their machining precision directly influences the performance and service life of mechanical products. Traditional contact-based measurement methods, such as mechanical probes and coordinate measuring machines, are time-consuming and computationally intensive. With the rapid advancement of computer technology and detection theory, computer vision-based inspection technology has gained widespread adoption due to its non-contact nature, high precision, fast speed, and large dynamic range. In this context, I designed and investigated a digital measurement instrument specifically for straight spur gear that leverages image processing techniques to achieve automated parameter extraction. This system not only improves measurement efficiency and precision but also can be integrated directly into the manufacturing process for real-time data monitoring and database management.

2. Measurement Principle

The operational principle of the digital measurement instrument is based on the coordination between the instrument coordinate system and the image coordinate system. The actual position of the straight spur gear is determined jointly by the position of the vision system in the instrument coordinate system and the position of the gear image in the image coordinate system. The gear is placed on a uniform and stable illumination source, and a CCD camera captures its two-dimensional image at a fixed focal length. The optical signal is converted into an electrical signal, which is transmitted to an industrial computer through an image acquisition card. The digital image processing software analyzes the gear image to extract basic data in the image coordinate system. Subsequently, system calibration parameters convert these data into the instrument coordinate system. By considering the readings from the grating rulers, the exact parameters of the straight spur gear are obtained. Finally, the measured data are displayed on the screen or stored in a database for further management and retrieval.

For gears with dimensions up to 100 mm, direct measurement is feasible. For larger gears, image stitching techniques are employed to ensure complete coverage. If higher precision is required, close-up imaging of local regions can be performed, followed by feature reconstruction.

3. Instrument Architecture and Functional Modules

The digital measurement instrument comprises the following main components: a Sony F717 CCD camera, a COMPUTAR M1214-MP2 industrial lens, an industrial computer equipped with a PCI-based NIPCI-1409 monochrome four-channel image acquisition card and a NIPCI-7344 motion control card, a filter cover, an LED light source, an actuation mechanism, and a precision worktable. The system is organized into four functional modules: the mechanical system, the vision system, the data acquisition system, and the software system.

3.1 Mechanical System

The mechanical system consists of X and Y sliding guide rails, a combined actuator, stepper motors, and a worktable. Its primary functions are to support, move, and position the gear. During initial operation, the vision system is moved along the guide rails to align with the gear. For coarse positioning, stepper motors enable rapid large-range movement. For fine positioning, manual adjustment using handwheels is available.

3.2 Vision System

The vision system is the key differentiator between this instrument and traditional measurement tools. It includes a light source and an imaging system. I selected a red LED light source with a wavelength of 0.68 μm due to its advantages of high visible light intensity, no heat generation, no shadow, and stepless adjustment. This prevents thermal deformation of the gear and the tool, which could otherwise compromise measurement accuracy. To achieve high imaging quality, the Kohler illumination method is adopted. This method uses multiple lens groups to overcome illumination non-uniformity, providing a stable and uniform field intensity. The imaging system includes a condenser, a filter, and the CCD camera. To prevent stray light interference, a 0.68 μm filter hood and filter are placed in the optical path.

3.3 Data Acquisition System

Grating rulers are installed along the X and Y directions of the sliding guide rails. When the vision system moves, the gratings generate response signals that are filtered, direction-identified, and subdivided before being transmitted to the industrial computer. The gear image captured by the CCD camera can be transmitted in real time to the monitor via the AV port and image acquisition card, or directly to the computer memory via the USB interface for subsequent digital processing.

3.4 Software System

The digital image processing software is developed in the Windows environment using Visual C++ 6.0. It serves as the user interface and the core of the instrument. The software implements automatic focus and parameter measurement for the straight spur gear, displays precise measurement data in real time, and provides database management functions for convenient gear parameter storage and retrieval. The software workflow includes image filtering and denoising, image binarization, edge detection, and region labeling.

3.4.1 Image Filtering and Denoising

During optical imaging and data transmission, various noise sources, such as photon noise, dark current noise, and quantization noise, degrade the image quality. For a straight spur gear with many fine details and sharp edges, the standard median filter can cause detail loss and edge blurring. To address this, I propose an improved median filtering algorithm. Three adjacent filtering windows \(A_I (I=1,2,3)\) are selected. For each window, the grayscale variance \(B_I\) is computed. The window with the smallest variance is chosen as the optimal window, and its median grayscale value replaces the central pixel value. This approach preserves edge sharpness while effectively suppressing noise.

3.4.2 Image Binarization

Binarization partitions the image into two distinct regions: the gear region and the background region. I use a Gaussian smoothing function with \(\delta=15\) to smooth the histogram before thresholding. The binarization formula is expressed as:

$$F(x,y) = \begin{cases} 0, & \text{if } f(x,y) \leq M \\ 255, & \text{if } f(x,y) > M \end{cases}$$

where \(M\) is the threshold value, \(f(x,y)\) is the original grayscale value, and \(F(x,y)\) is the binary value.

3.4.3 Image Edge Detection

Accurate edge localization is critical for precise parameter measurement. I implement a fast subpixel edge detection algorithm based on spatial moments and orthogonal polynomial fitting. First, the rotation invariance of spatial moments is exploited to reduce the two-dimensional edge detection problem to a one-dimensional problem. The spatial moment \(M_{pq}\) is defined as:

$$M_{pq} = \iint x^p y^q h(x,y) \, dx \, dy$$

The edge normal angle \(\alpha\) is obtained from:

$$\alpha = \arctan\left(\frac{M_{01}}{M_{10}}\right)$$

Then, the pixels are projected onto the edge normal line using:

$$T = x \cos\alpha + y \sin\alpha$$

For the one-dimensional edge detection, the Sobel operator is used for coarse localization. Along the edge normal direction, a series of pixel grayscale values are interpolated. Using the orthogonal polynomial least squares method, a fifth-order fitting function \(F_5(x)\) is derived:

$$F_5(x) = \sum_{k=0}^{5} \frac{(y, G_k)}{(G_k, G_k)} G_k(x)$$

The subpixel edge position \(x_0\) is found by solving:

$$\frac{d^2 F_5(x)}{dx^2} = 0$$

which yields:

$$x_0 = \sqrt[3]{m + \sqrt{m^2 + n^3}} + \sqrt[3]{m – \sqrt{m^2 + n^3}}$$

where

$$m = \frac{9a_0 a_1 a_2 – 2a_1^3 – 27a_0^2 a_1}{54a_0^3}, \quad n = \frac{3a_0 a_2 – a_1^2}{9a_0^2}$$

This method provides precise subpixel edge coordinates for the straight spur gear profile.

3.4.4 Image Region Labeling

Region labeling assigns a unique mark to each connected component in the binary image. This allows the inner (hole) and outer profiles of the straight spur gear to be distinguished. The algorithm scans the image row by row, assigns a new label to the first encountered target pixel, then propagates the same label to all connected pixels. The process continues until all regions are labeled.

4. Gear Parameter Measurement Algorithm

The primary parameters of a straight spur gear include the addendum circle radius \(r_a\), the dedendum circle radius \(r_f\), the number of teeth \(Z\), the module \(m\), and the base tangent length \(L\). The first critical step is to determine the gear center.

4.1 Determination of Gear Center \(O\)

The gear center is represented by the image center coordinates in pixels. I employ an improved random Hough transform. The basic idea is to construct the set of edge points and randomly select three non-collinear points to define a candidate circle. The circle parameters are computed, and the number of edge points \(M_{pc}\) that lie on this circle is counted. If \(M_{pc}\) exceeds a predefined threshold \(M_{\min}\), the candidate circle is accepted as the true circle, and its center is taken as the gear center. A comparison between the basic Hough transform and the improved random Hough transform is shown in Table 1.

Table 1: Comparison of Hough Transform Methods for Center Detection
Algorithm Time (s) Center Coordinates (pixel)
Basic Hough Transform 21.52 (433, 432)
Improved Random Hough Transform 4.28 (430, 431)

The improved algorithm significantly reduces processing time while maintaining comparable accuracy.

4.2 Calculation of Addendum Circle Radius \(r_a\) and Dedendum Circle Radius \(r_f\)

Under ideal conditions, the distance from the gear profile points to the gear center follows a periodic function. The addendum and dedendum points have distinct radial distances. However, due to manufacturing errors, the actual distances fluctuate. To extract the addendum and dedendum points, I compute the slope of the distance curve and identify its extrema. The distances of all addendum and dedendum points to the center are averaged to obtain \(r_a\) and \(r_f\).

4.3 Calculation of Number of Teeth \(Z\)

The number of teeth \(Z\) is derived from the central angle of the teeth on the addendum circle. To minimize errors, feature matching is first used to exclude defective gear portions. Then, the central angles of multiple teeth are measured, and the average central angle per tooth \(\phi\) is computed. The number of teeth is then:

$$Z = \text{round}\left(\frac{360^\circ}{\phi}\right)$$

4.4 Calculation of Module \(m\)

The module \(m\) is calculated from the addendum and dedendum radii. First, an estimated module \(m_1\) is obtained using:

$$m_1 = \frac{r_a + r_f}{2}$$

Then, two or three standard module values from the GB 1357-87 standard closest to \(m_1\) are selected as candidates. After rounding, the appropriate standard module \(m\) is determined.

4.5 Calculation of Base Tangent Length \(L\)

The base tangent length is a critical parameter for gear manufacturing and inspection. For a straight spur gear, it is computed based on the number of teeth and the module. First, the number of teeth spanned \(k\) is determined from the pressure angle \(\alpha\):

$$k = \begin{cases} \left\lfloor \frac{Z}{12} \right\rfloor + 1, & \alpha = 15^\circ \\ \left\lfloor \frac{Z}{9} \right\rfloor + 1, & \alpha = 20^\circ \end{cases}$$

where \(\lfloor x \rfloor\) denotes the floor function. Then, the base tangent length \(L\) is:

$$L = m \cos\alpha \left[ (k – 0.5)\pi + Z \cdot \text{inv}\,\alpha \right]$$

where \(\text{inv}\,\alpha = \tan\alpha – \alpha\) (with \(\alpha\) in radians).

5. Experimental Results and Error Analysis

I conducted experiments on a straight spur gear with a pressure angle of \(\alpha = 20^\circ\) and a keyway. The gear was measured using both the proposed digital instrument and traditional contact-based methods under identical environmental conditions. The results are summarized in Table 2.




Table 2: Comparison of Measurement Results for a Straight Spur Gear (Units: mm, except Z)
Parameter \(r_a\) \(r_f\) \(Z\) \(m\) \(L\)
Traditional Measurement 29.981 23.143 18 2.947 21.987
Digital Measurement 29.975 23.201 18 2.954 22.468

The measurement errors are relatively small, validating the effectiveness of the proposed instrument. However, discrepancies still exist due to several factors:

  • Hardware-induced errors: The finite resolution of the CCD camera causes each pixel to represent a larger physical dimension for larger gears, reducing precision. Noise from photon fluctuations, dark current, and quantization during signal acquisition and transmission also contribute to errors.
  • Image processing errors: The Hough transform and edge detection algorithms have inherent accuracy limitations. The derivative-based method for locating extrema may occasionally misidentify points, leading to data loss.
  • Rounding errors: During parameter calculation, numerical rounding based on the effective digits of the computer introduces small inaccuracies.

Despite these error sources, the digital instrument demonstrates significant advantages over traditional methods, including non-contact operation, higher speed, and full automation.

6. Conclusion

I have successfully designed and researched a numerical measurement tool for straight spur gear based on computer vision technology. The instrument achieves rapid, precise, and automated measurement of key gear parameters such as addendum circle radius, dedendum circle radius, number of teeth, module, and base tangent length. The experimental results confirm that the proposed system offers superior performance in terms of accuracy, efficiency, and automation level compared to conventional contact-based methods. Moreover, the system exhibits excellent flexibility and scalability, allowing it to be integrated into gear manufacturing processes for real-time quality monitoring and database management. This work has significant implications for the precision manufacturing of straight spur gear and mechanical transmission systems in general.

Scroll to Top