Abstract
Key technologies of a machine vision detection system for industrial parts are investigated, resulting in the development of a high-speed detection system. This paper introduces the design of the machine vision platform, analyzing its hardware and software structure and the fundamental principles of its control units. A hybrid auto-focusing strategy is proposed, utilizing a variance function for coarse tuning and a Roberts gradient sum function search algorithm for fine tuning. Experimental results demonstrate that the system completes image collection and processing in 3.246 seconds, meeting real-time online detection requirements and proving feasible for industrial product inspection.
Introduction
In modern mass production, manual inspection is increasingly inadequate due to its low speed and susceptibility to human error. Machine vision offers a high-precision alternative; however, industrial environments demand systems that are both versatile and high-speed. A primary challenge is auto-focusing: standard algorithms often fail to meet the rapid cycle times required by moving conveyor belts. This research presents an integrated platform designed to overcome these bottlenecks through hardware-software co-design and a novel two-stage focusing algorithm.
System Architecture and Hardware Design
The experimental platform is designed to be a "universal" inspection tool capable of handling diverse industrial components. The hardware stack integrates several key components to ensure stability and precision.
As illustrated in the hardware schematic, the imaging system utilizes a 5-megapixel industrial camera paired with a telecentric lens and adjustable LED strip lighting to minimize perspective distortion and ensure consistent illumination. Motion control is handled by an STM32f103RCT6 (ARM Cortex-M3) microcontroller, which manages high-precision stepper motors to adjust the camera's position along the Z-axis. This dedicated control unit offloads timing-critical tasks from the host PC, which is reserved for high-level image processing and defect analysis.
Hybrid Auto-Focusing Strategy
The core innovation of this platform is its two-stage auto-focusing algorithm, which balances search range with precision.
- Coarse Tuning (Variance Function): Initially, the system performs large-step movements. It employs a Variance function to evaluate image clarity. This function is chosen for its wide "capture range," providing a reliable gradient even when the image is significantly out of focus.
- Fine Tuning (Roberts Gradient Sum): Once the system identifies the general vicinity of the focus peak, it switches to smaller steps and utilizes the Roberts gradient sum function. This function is highly sensitive to high-frequency details, allowing for precise localization of the optimal focus point.
The search optimization logic includes a "peak-finding" mechanism that reverses and halves the step size upon detecting a decrease in image quality, significantly reducing the total number of motor movements required to achieve focus.
Experimental Results and Discussion
The platform was validated using physical industrial components, such as metal gears, on a live conveyor system. The system achieved an average image collection and detection cycle of 3.246 seconds. This performance is attributed to the synergy between the coarse and fine-tuning functions and the efficient hardware-software interface.
The use of the STM32 MCU improved code density by 30%–45% compared to standard 32-bit alternatives, enhancing system responsiveness. Furthermore, the hybrid algorithm successfully transitioned images from highly blurred states to sharp, high-contrast frames suitable for subsequent defect detection steps, such as median filtering and binary segmentation.
Conclusion
This research successfully developed a machine vision platform capable of real-time industrial inspection. By combining a robust hardware architecture with a dual-stage auto-focusing algorithm, the system achieves the necessary speed and precision for modern production lines. Future work will focus on improving the system's robustness against environmental factors like dust and vibration, as well as extending its capabilities to handle complex 3D geometries.
Summary updated