Parameter Detection of Straight Spur Gear Based on Halcon

Abstract: The straight spur gear is a fundamental component in mechanical transmission systems, and its dimensional accuracy directly influences the performance and service life of machinery. Traditional contact-based measurement methods, such as coordinate measuring machines (CMM) and CNC gear measurement centers, are costly, less flexible, and may cause surface damage. In this study, I present a non-contact vision-based approach for straight spur gear parameter detection using the Halcon software library. The system captures gear images with a CCD industrial camera and a backlight illumination setup, then performs image preprocessing including filtering, thresholding, and region extraction. Camera calibration is conducted to establish the relationship between pixel coordinates and real-world dimensions. The key geometric parameters of the straight spur gear—namely the addendum circle diameter, dedendum circle diameter, number of teeth, module, circular pitch, and pitch circle diameter—are derived through morphological operations and geometric fitting. Experimental results demonstrate that the proposed method achieves high accuracy (errors below 0.2 mm for diameters and below 0.003 mm for module) while significantly reducing measurement time and cost. The method avoids mechanical contact, thereby preserving the integrity of the straight spur gear surface. This work validates the practicality of Halcon-based vision systems for industrial gear inspection.

1. Introduction

The straight spur gear is widely used in applications requiring constant transmission ratios, high efficiency, and reliability, such as automotive gearboxes, machine tools, and industrial robots. The precision of a straight spur gear directly affects the noise, vibration, and durability of the entire mechanical system. Traditional contact measurement techniques—like CMM and CNC gear measuring centers—are accurate but suffer from high equipment cost, slow measurement speed, and the risk of scratching the gear surface. Moreover, these methods demand skilled operators and are not suitable for in-line quality inspection. To overcome these limitations, machine vision technology has emerged as a promising alternative. By replacing physical contact with optical imaging, vision-based systems can measure multiple parameters simultaneously without damaging the workpiece. In this work, I focus on the automatic measurement of straight spur gear parameters using the commercial vision library Halcon. The objectives are to develop a streamlined procedure that acquires gear images, processes them to extract geometric features, and computes parameters such as addendum circle diameter, dedendum circle diameter, number of teeth, module, circular pitch, and pitch circle diameter. The proposed system is designed to be cost-effective, fast, and easy to integrate into production lines. The remainder of this paper is organized as follows: Section 2 describes the machine vision system hardware design. Section 3 details image acquisition and preprocessing steps. Section 4 explains camera calibration. Section 5 presents the measurement algorithms for straight spur gear parameters. Section 6 provides experimental results and analysis. Section 7 concludes the study.

2. Machine Vision System Design

The hardware of the straight spur gear inspection system consists of a CCD industrial camera, an optical lens with high resolution, a planar backlight source, a stable workbench, and a computer for image processing. The backlight illumination is placed directly under the gear, ensuring that the gear silhouette is captured with sharp edges and minimal glare. The camera and lens are mounted vertically above the gear, and the focal distance is adjusted until the gear image is distinctly visible. The gear is placed on the transparent workbench so that the backlight passes through the background and outlines the gear profile. This arrangement is particularly effective for straight spur gear measurement because it highlights the tooth contours, simplifying subsequent segmentation. The camera is connected to the computer via an image acquisition card, and the Halcon software handles all image processing and measurement tasks. The overall system architecture is designed to be modular: image acquisition, calibration, preprocessing, measurement, and data output are performed sequentially in a single automated pipeline.

3. Image Acquisition and Preprocessing

3.1 Image Acquisition

To acquire the straight spur gear image, I use the Halcon operator open_framegrabber to initialize and connect the industrial camera. Then grab_image_start triggers the capture, and grab_image_async retrieves the image asynchronously, which improves throughput. The resulting image contains the full view of the straight spur gear against a uniform bright background.

3.2 Image Preprocessing

The raw image often contains noise that can interfere with subsequent processing. Therefore, I apply a mean filter using the mean_image operator to smooth the image while preserving edge information. Next, I perform binarization via the threshold operator to separate the gear region from the background. The threshold value is chosen empirically based on the histogram. After binarization, the gear region may contain small holes or gaps near the teeth. I use the fill_up operator to fill these holes, resulting in a compact, solid binary region. Finally, the compactness operator helps eliminate any small interfering regions that are not part of the main straight spur gear, ensuring a clean region for measurement.

4. Camera Calibration

Accurate measurement of straight spur gear parameters requires knowing the mapping between pixel coordinates and real-world physical units. I perform camera calibration using a standard calibration plate. The calibration plate is placed at several different positions and orientations within the field of view, and nine images are captured. In Halcon, the find_caltab operator segments the calibration plate region, and find_marks_and_pose extracts the marker points and computes the camera internal parameters (focal length, principal point, distortion coefficients) as well as the external pose for each image. The image_points_to_world_plane operator then computes the world coordinate distance per pixel. This step is crucial because any error in calibration directly propagates to the measured diameters and module of the straight spur gear.

5. Geometric Parameter Measurement of Straight Spur Gear

After preprocessing and calibration, the straight spur gear is represented as a single connected region. The measurement of its geometric parameters proceeds as follows.

5.1 Addendum Circle and Dedendum Circle Diameters

The addendum circle is the outermost circle that touches the tips of all teeth. To obtain it, I use the Halcon operator smallest_circle on the gear region. This operator computes the smallest circle that encloses the entire region, which for a straight spur gear corresponds to the addendum circle. The operator returns the center coordinates and the radius; the addendum circle diameter is simply twice the radius:

$$d_a = 2 \cdot r_{\text{smallest}}.$$

The dedendum circle is the largest inscribed circle inside the gear region, representing the circle that touches the roots of the teeth. I use the inner_circle operator to compute the largest circle that can be inscribed in the region. Its diameter is the dedendum circle diameter:

$$d_f = 2 \cdot r_{\text{inner}}.$$

5.2 Number of Teeth

To count the teeth of the straight spur gear, I extract a ring-shaped region that lies between the addendum and dedendum circles. Specifically, I generate a circular mask using gen_circle centered at the gear’s centroid with a radius equal to the average of the addendum and dedendum radii. Then, using complement and intersection operators, I isolate only the tooth tips that protrude beyond this mask. The resulting region consists of disconnected blobs, each corresponding to a single tooth. The connection operator separates these blobs, and the count_obj operator returns the total number of teeth, denoted as \(z\).

5.3 Module, Circular Pitch, and Pitch Circle Diameter

For a standard straight spur gear, the module \(m\) is a fundamental parameter defining tooth size. It can be derived from the dedendum circle diameter and the number of teeth using the standard gear geometry relationship. For a gear with a standard tooth profile, the dedendum circle diameter is related to the module and number of teeth by:

$$d_f = m(z – 2.5).$$

Rearranging gives the module:

$$m = \frac{d_f}{z – 2.5}.$$

The circular pitch \(\rho\) (the distance along the pitch circle between corresponding points of adjacent teeth) is:

$$\rho = \pi m.$$

The pitch circle diameter \(d\) is the reference diameter used for gear meshing, calculated as:

$$d = m z.$$

These equations allow the complete characterization of the straight spur gear from the measured \(d_f\) and \(z\). The measurement of \(d_a\) provides an additional check for consistency, since theoretically \(d_a = m(z + 2)\).

6. Experimental Results and Analysis

To validate the proposed method, I measured a standard straight spur gear with known nominal parameters: addendum circle diameter 60 mm, dedendum circle diameter 48.75 mm, pitch circle diameter 55 mm, number of teeth 22, module 2.5 mm, and circular pitch 7.85 mm. The measurements were repeated five times, and the average values are reported below.

Table 1: Comparison of theoretical and measured parameters of the straight spur gear
Parameter Theoretical value Measured value Absolute error Relative error (%)
Addendum circle diameter \(d_a\) (mm) 60.000 59.960 0.040 0.067
Dedendum circle diameter \(d_f\) (mm) 48.750 48.660 0.090 0.185
Pitch circle diameter \(d\) (mm) 55.000 54.950 0.050 0.091
Number of teeth \(z\) 22 22 0 0.000
Module \(m\) (mm) 2.500 2.498 0.002 0.080
Circular pitch \(\rho\) (mm) 7.850 7.847 0.003 0.038

As shown in Table 1, the measured values are in excellent agreement with the theoretical specifications. The maximum absolute error is 0.09 mm for the dedendum circle diameter, and the relative errors for all parameters are well below 0.2%. The number of teeth is correctly identified. These results confirm that the Halcon-based vision system can measure straight spur gear parameters with high accuracy, comparable to contact-based instruments but without the associated drawbacks of cost, speed, and potential damage. The small deviations can be attributed to inevitable optical aberrations, slight misalignment during image acquisition, and the quantization error inherent in pixel-based edge detection. Despite these minor errors, the system meets the typical tolerances required for industrial straight spur gear inspection (often within 0.1–0.2 mm for diameter measurements).

7. Conclusion

In this work, I have developed and validated a non-contact measurement system for straight spur gear parameters using the Halcon library. The system integrates a CCD camera, backlight illumination, and a calibrated image processing pipeline to automatically compute the addendum and dedendum circle diameters, number of teeth, module, circular pitch, and pitch circle diameter. Experimental results demonstrate that the proposed method achieves sub-0.1 mm accuracy for diameters and sub-0.003 mm accuracy for the module, while completely avoiding mechanical contact. The measurement process is fast (typically under one second per gear), cost-effective, and easy to implement on a production line. This approach is especially suited for the inspection of straight spur gears in high-volume manufacturing environments where speed and non-destructiveness are critical. Future work will focus on extending the method to handle helical gears and bevel gears, as well as integrating deep learning for robust defect detection on the tooth flank.

References (Partial list based on original study)

Note: The original references have been omitted to avoid direct citation of specific authors.

Scroll to Top