Abstract
With the development of modern industry, image measurement technology—with its high speed, high precision, and non-contact advantages—has received significant attention. In machine vision systems used for measuring mechanical parts, the accuracy of edge positioning directly influences the precision of measurement results. This paper analyzes sub-pixel location methods based on Gray Moment Theory and Gaussian Fitting Theory. Through experimental size measurements of mechanical parts, these methods are compared against classical edge detection operators to evaluate performance and accuracy, providing a practical reference for sub-pixel edge detection in industrial applications.
Introduction
In modern industrial inspection, machine vision is preferred for its speed and non-contact nature. However, traditional edge detection operators (such as Sobel, Canny, or LOG) are limited to pixel-level accuracy. If a camera sensor's resolution dictates that one pixel represents 0.2mm, a standard operator can only measure within that 0.2mm margin of error. For high-precision mechanical parts, this is insufficient. The challenge lies in identifying the "true" edge that exists between the discrete grid of pixels. This research explores mathematical modeling to bridge this gap through sub-pixel positioning.
Theoretical Framework
Gray Moment Theory
This method treats an edge as a transition between two gray levels ($h_1$ and $h_2$). By calculating the first three orders of gray moments in the image data and matching them to an ideal "step function" model, the algorithm solves for the exact sub-pixel coordinate ($k$) where the transition occurs.
Gaussian Fitting Theory
This approach assumes that the gradient (the rate of change in brightness) across an edge follows a Gaussian (bell-shaped) curve. The "true" edge is identified as the peak of this curve. By applying a logarithmic transformation and the least-squares principle, a quadratic curve is fitted to the data, with the vertex representing the sub-pixel edge position. Gaussian fitting offers the advantage of rotation invariance, simplifying setup in factory environments.
Experimental Setup and Results
Methodology
The measurement workflow consists of three main steps:
- Coarse Location: A standard Sobel operator identifies the general area of the edge.
- Preprocessing: Image filtering is applied to remove noise.
- Sub-pixel Refinement: Either Gray Moment or Gaussian Fitting is applied within a small window (e.g., 11 pixels) around the coarse edge to find the precise coordinate.
Comparative Analysis
The experiment measured a rectangular mechanical part with a known width of 39.00 mm. A 15mm target was used for calibration, establishing a transformation factor of $k = 0.1852$ mm/pixel. The results demonstrate that sub-pixel methods provide significantly more granular data than standard pixel-level detection:
| Method | Left Edge (pixel) | Right Edge (pixel) | Distance (pixel) | Dimensions (mm) |
|---|---|---|---|---|
| Sobel (Pixel-level) | 234 | 445 | 211 | 39.0772 |
| Moments Theory | 234.8288 | 445.1341 | 210.3053 | 38.9485 |
| Gaussian Fitting | 234.4230 | 445.3536 | 210.9306 | 39.0643 |
Conclusion
While the Sobel operator provides a result close to the target, sub-pixel methods provide the fractional data necessary for statistical process control in manufacturing. Gaussian fitting is mathematically elegant but highly sensitive to noise and specific gray-value trends. Currently, the Gray Moment method is more practical for standard mechanical parts due to its robustness. Future work will focus on optimizing these algorithms for real-time processing on high-speed assembly lines.
Summary updated