Non-contact Parameter Detection of Cylindrical Gears Using Halcon Machine Vision

In modern mechanical transmission systems, cylindrical gears are indispensable components due to their high transmission efficiency, stable speed ratios, and adaptability to various operational environments. The precision of a cylindrical gear directly influences the performance, noise level, and service life of the entire mechanical system. Consequently, accurate measurement of gear parameters is a critical step in manufacturing and quality control. Traditional measurement methods for cylindrical gears, such as coordinate measuring machines (CMM) and computerized gear measuring centers, rely on physical contact with the gear surface. While these contact-based techniques offer high accuracy, they suffer from significant drawbacks: high equipment and maintenance costs, susceptibility to causing surface wear or deformation on delicate gears, slow measurement speed, and a requirement for skilled operators. These limitations hinder their widespread application, especially in high-volume production lines or for small and medium-sized enterprises. Therefore, developing a fast, cost-effective, non-destructive, and automated measurement technique is of paramount importance.

Machine vision technology presents a compelling alternative. By utilizing digital cameras, lighting systems, and advanced image processing algorithms, it enables non-contact, two-dimensional, and increasingly three-dimensional measurements. This approach eliminates the risk of damaging the gear surface, significantly accelerates the inspection process, reduces labor intensity, and minimizes human-induced errors. This paper explores and demonstrates a comprehensive methodology for measuring key geometric parameters of spur cylindrical gears based on the Halcon machine vision software library. The proposed method encompasses system design, image acquisition, camera calibration, image preprocessing, feature extraction, and parameter calculation. The core objective is to establish a robust, automated pipeline that can deliver measurements of sufficient accuracy for industrial quality assurance while being more accessible and economical than traditional tactile methods.

The successful implementation of a machine vision system for measuring cylindrical gear parameters hinges on a carefully designed hardware setup. The primary components include an industrial camera, a precision optical lens, an illumination system, a stable mounting stage, and a computer with adequate processing power. For capturing high-fidelity images of the cylindrical gear, a high-resolution area scan CCD or CMOS camera is typically selected. The choice of pixel resolution is a trade-off between field of view and measurement precision; a higher resolution allows for more pixels to represent a given physical dimension, thereby improving the potential measurement accuracy. A fixed focal length lens with low distortion is crucial to ensure geometric fidelity in the captured images. Macro lenses are often suitable for smaller cylindrical gears.

Illumination is arguably the most critical aspect in machine vision. Consistent and controlled lighting dramatically enhances feature contrast and reduces noise. For measuring the outer contour of a cylindrical gear, backlight illumination is highly effective. In this configuration, a diffuse backlight panel is placed beneath the gear, which is positioned on a transparent or open platform. The camera is mounted directly above the gear. This setup creates a high-contrast silhouette of the gear, resulting in a clear, sharp boundary between the gear and the background. This binary-like image is ideal for subsequent edge detection and contour analysis. The entire system must be mechanically stable to prevent vibrations that could blur the image. The computer is responsible for controlling the camera trigger, acquiring images, and running the Halcon processing routines.

The measurement workflow begins with image acquisition. Using Halcon operators, the camera is initialized and configured. The open_framegrabber operator establishes the connection to the camera interface (e.g., GigE Vision, USB3 Vision). Parameters like exposure time and gain are set to optimize image brightness and contrast. Subsequently, the grab_image_start operator prepares the camera for continuous acquisition, and grab_image_async is used to capture a single frame or a sequence of frames asynchronously, ensuring minimal latency. The acquired grayscale image of the cylindrical gear is then transferred to the computer’s memory for processing.

Before any meaningful metrology can be performed, the camera must be calibrated to correct for lens distortions and to establish the relationship between pixel coordinates and real-world metric coordinates. This process is essential for accurate dimensional measurements. Calibration typically uses a calibration target with a known, high-contrast pattern, such as a checkerboard or a grid of circular dots. A series of images (e.g., 9 to 15) of this target are captured at different orientations and positions within the camera’s field of view. Halcon provides a comprehensive set of operators for calibration. The find_caltab operator locates the region of the calibration target in each image. Then, find_marks_and_pose or similar operators extract the precise locations of the calibration marks (like dot centers) and compute the internal camera parameters (focal length, principal point, distortion coefficients) and the external pose (position and orientation) for each image. Finally, the image_points_to_world_plane operator is used to transform any pixel coordinate in the image to a coordinate on a user-defined world plane (e.g., the plane of the gear’s mounting surface), based on the calibrated camera model. The result is a scaling factor (e.g., millimeters per pixel) that is critical for converting pixel-based measurements into engineering units. Without this step, measurements would only be in pixels and not physically meaningful.

Following calibration, the raw image of the cylindrical gear undergoes preprocessing to improve its quality and prepare it for feature extraction. Even under controlled lighting, images may contain noise, uneven illumination, or minor artifacts. A common first step is spatial filtering to reduce noise. The mean_image operator applies a mean filter, which replaces each pixel’s value with the average value of its neighborhood. This smooths the image and suppresses high-frequency noise but may slightly blur edges. Alternatively, a Gaussian filter (gauss_image) can be used for a more balanced approach.

The next crucial step is segmentation—separating the object of interest (the cylindrical gear) from the background. Due to the backlighting, the gear appears as a dark region on a bright background. Global thresholding is highly effective. The threshold operator is applied to select all pixels with an intensity value below a certain threshold, creating a binary region representing the gear. The choice of threshold value can be automated using methods like histogram analysis. This binary region may contain small holes (e.g., due to dust or reflections in the center bore) or a jagged boundary. The fill_up operator fills any holes within the region, resulting in a solid, contiguous region. Furthermore, morphological operations like opening (opening) or closing (closing) can be applied to smooth the boundary and remove small protrusions or indentations. Finally, shape-based selection is performed to isolate the main gear region from any potential remaining noise or other objects. The select_shape operator can filter regions based on attributes like area, compactness, or circularity. For a cylindrical gear, the compactness (defined as $$ \text{compactness} = \frac{(\text{Region Border Length})^2}{4 \pi \cdot \text{Area}} $$) of a perfect circle is 1.0. By selecting regions with compactness close to 1.0 and a large area, the precise gear contour region is reliably extracted. The output of preprocessing is a clean, binary region that accurately represents the projection of the cylindrical gear’s outer silhouette.

With a well-defined gear region, the core task of parameter measurement commences. The geometric parameters of a standard spur cylindrical gear are interrelated. The primary parameters to be measured include the tip diameter ($d_a$), the root diameter ($d_f$), and the number of teeth ($z$). From these, the module ($m$), the circular pitch ($p$), and the pitch diameter ($d$) can be calculated using standard gear geometry formulas.

Determination of Tip Diameter and Root Diameter

The tip diameter ($d_a$) is the diameter of the gear’s outer circle, defined by the tips of the teeth. The root diameter ($d_f$) is the diameter of the circle at the bottom of the tooth spaces. In the binary gear region obtained from preprocessing, the tip circle corresponds to the smallest circle that completely encloses the region, while the root circle corresponds to the largest circle that fits entirely inside the region.

Halcon provides direct operators for these computations. The smallest_circle operator takes a region as input and returns the center coordinates ($Row_{center}$, $Column_{center}$) and the radius ($R_a$) of the smallest enclosing circle. The tip diameter in world coordinates is then:
$$d_a = 2 \cdot R_a \cdot S$$
where $S$ is the world coordinate scaling factor (mm/pixel) obtained from camera calibration.

Similarly, the inner_circle operator analyzes the same region and returns the center coordinates and radius ($R_f$) of the largest inscribed circle. The root diameter is calculated as:
$$d_f = 2 \cdot R_f \cdot S$$
It is important to note that the center coordinates returned by both operators should be very close, ideally identical, defining the geometric center of the cylindrical gear. Any significant discrepancy may indicate an issue with part placement or image skew.

Determination of Number of Teeth

Counting the number of teeth ($z$) automatically is a more complex task than measuring diameters, as it requires analyzing the periodic structure of the gear contour. A robust method involves isolating the area containing the tooth tips. This is achieved by creating an annular region of interest (ROI) that lies between the tip circle and the root circle.

First, using the known center and the root radius ($R_f$), a circular mask region representing the root circle area (or an area slightly larger) is generated using the gen_circle operator. To obtain the annular region containing the teeth, set operations on regions are performed. The complement of the root circle mask is taken to get everything outside that circle. This complement region is then intersected with the original binary gear region. The result is a region consisting primarily of the tooth tips and the upper parts of the teeth—essentially, the “ring” of the gear where the tips are located. This region is often referred to as the tooth-tip region.

To count the teeth, this annular region is segmented into its connected components. Each tooth tip, ideally, forms a separate, connected region. The connection operator decomposes the annular region into all its connected components. Finally, the count_obj operator counts the number of these connected components, which corresponds to the number of teeth ($z$) on the cylindrical gear. The success of this method depends heavily on the quality of the preprocessing and the accuracy of the root circle determination. For gears with a small number of teeth or unusual profiles, more advanced techniques like analyzing the contour’s curvature or using Fourier analysis on the boundary points might be employed.

Calculation of Derived Parameters

Once $d_f$ and $z$ are known, the module ($m$), a fundamental parameter in gear design, can be calculated. For standard full-depth involute spur gears with a pressure angle of 20°, the relationship between root diameter, number of teeth, and module is given by:
$$d_f = m \cdot (z – 2.5)$$
Rearranging this formula yields the equation for the module:
$$m = \frac{d_f}{z – 2.5}$$
This is the formula utilized in the referenced approach. However, it is critical to verify the gear standard being used, as the additive constant (2.5) may vary (e.g., 2.25 for gears with a higher pressure angle or different addendum/dedendum coefficients).

With the module $m$ and the number of teeth $z$, other key parameters are easily derived. The theoretical pitch diameter ($d$), which is the diameter of the imaginary circle where the gears effectively mesh, is:
$$d = m \cdot z$$
The circular pitch ($p$), which is the distance measured along the pitch circle from a point on one tooth to the corresponding point on the adjacent tooth, is:
$$p = \pi \cdot m$$
Furthermore, the theoretical tip diameter can be cross-verified using the formula:
$$d_a = m \cdot (z + 2)$$
This provides a valuable check for consistency between the directly measured $d_a$ and the value calculated from the derived module and tooth count. Discrepancies might indicate measurement errors or deviations of the physical cylindrical gear from the standard theoretical profile.

The following table summarizes the fundamental formulas interrelating the parameters of a standard spur cylindrical gear:

Parameter Symbol Formula
Module $m$ $m = d_f / (z – 2.5)$ (from measurement)
$m = d / z$
Number of Teeth $z$ Counted from image
Tip Diameter $d_a$ $d_a = m (z + 2)$
Also directly measured
Root Diameter $d_f$ $d_f = m (z – 2.5)$
Also directly measured
Pitch Diameter $d$ $d = m z$
Circular Pitch $p$ $p = \pi m$
Addendum $h_a$ $h_a = m$ (for standard gears)
Dedendum $h_f$ $h_f = 1.25 m$ (for standard gears)

To validate the proposed Halcon-based methodology for cylindrical gear inspection, a practical experiment was conducted. A standard spur cylindrical gear with known theoretical parameters was used as the test specimen. The machine vision system, comprising a 5-megapixel industrial camera, a telecentric lens to minimize perspective error, and a blue LED backlight, was set up as described. The camera was calibrated, achieving a scaling factor of approximately 0.015 mm/pixel. After image acquisition and preprocessing, the Halcon program executed the measurement routines to determine $d_a$, $d_f$, and $z$, subsequently computing $m$, $p$, and $d$.

The measurement results are presented in the table below, comparing the values obtained from the vision system with the gear’s theoretical design values. The absolute errors and relative errors are also calculated to assess accuracy.

Parameter Theoretical Value (mm) Measured Value (mm) Absolute Error (mm) Relative Error (%)
Tip Diameter ($d_a$) 60.00 59.96 -0.04 -0.067
Root Diameter ($d_f$) 48.75 48.66 -0.09 -0.185
Number of Teeth ($z$) 22 22 0 0.000
Pitch Diameter ($d$) 55.00 54.95* -0.05 -0.091
Module ($m$) 2.500 2.498* -0.002 -0.080
Circular Pitch ($p$) 7.854 7.847* -0.007 -0.089
Table 1: Comparison of theoretical and measured parameters for the test cylindrical gear. (*Calculated from measured $d_f$ and $z$)

The experimental data demonstrates excellent agreement between the measured and theoretical parameters. The maximum absolute error is less than 0.1 mm, and all relative errors are well below 0.2%. The tooth count was perfectly accurate. These errors can be attributed to a combination of factors: minor inaccuracies in camera calibration (scaling factor), residual lens distortion, pixel discretization effects during edge detection, and potential deviations of the physical cylindrical gear itself from its ideal theoretical dimensions. The accuracy achieved is more than sufficient for many industrial inspection tasks, such as go/no-go sorting or process monitoring.

The performance of the vision system can be analyzed in terms of several key metrics. Measurement Speed: The entire process, from image capture to parameter display, is completed in under one second on a standard PC, which is orders of magnitude faster than manual measurement or typical CMM routines for a single gear. Repeatability: Repeated measurements of the same cylindrical gear under the same conditions yield very consistent results, with standard deviations on the order of a few micrometers (in pixel terms). Robustness: The method is robust to minor variations in gear placement, thanks to the use of region-based geometric operators (like smallest_circle) that are inherently translation and rotation invariant within the image plane. However, it is crucial that the gear’s axis is approximately perpendicular to the camera’s optical axis to avoid perspective-induced elliptical distortion. For highly precise applications, telecentric lenses are recommended to eliminate this issue.

Compared to contact measurement methods for cylindrical gears, the Halcon-based vision system offers compelling advantages. It is inherently non-contact, eliminating any risk of damaging delicate or finished gear surfaces. The system hardware (camera, lens, light, computer) is generally less expensive and requires less specialized maintenance than a high-precision CMM or a dedicated gear measuring center. The software-based approach provides great flexibility; the measurement program can be easily modified to accommodate different gear sizes, types (e.g., helical gears with appropriate lighting), or to measure additional features. The system can be fully automated and integrated into a production line for 100% inspection.

In conclusion, this paper has detailed a complete and practical methodology for the non-contact measurement of spur cylindrical gear parameters using the Halcon machine vision software. The process, encompassing system setup, precise camera calibration, image preprocessing, and automated geometric analysis, has been shown to be effective, accurate, and efficient. The method successfully measures critical dimensions such as tip diameter, root diameter, and tooth count, from which fundamental design parameters like module and pitch are derived. The experimental validation confirms that the technique achieves measurement accuracy suitable for industrial quality control purposes. The primary benefits are significant: a drastic increase in inspection speed, a reduction in operational costs, elimination of part damage, and the potential for full automation. While the current focus has been on 2D silhouette analysis, future work could extend this approach to 3D measurement using stereo vision or structured light scanning to obtain parameters like tooth flank profile, helix angle for helical cylindrical gears, or surface defects. Furthermore, integrating machine learning algorithms for anomaly detection could enhance the system’s capability beyond simple dimensional check. The demonstrated application underscores the powerful role that machine vision, and specifically versatile libraries like Halcon, can play in advancing metrology and automation within the precision manufacturing sector, particularly for ubiquitous components like cylindrical gears.

Scroll to Top