1 Introduction
Machine vision technology, as an important branch of computer science, has developed rapidly in the last 30 years. Its applications span across industry, agriculture, scientific research, and the military, playing a crucial role in improving the level of automation in these fields. A key characteristic of machine vision systems is their ability to enhance the flexibility and automation of production. In hazardous working environments unsuitable for manual labor or where human vision is insufficient, machine vision is often used to replace human vision. Furthermore, in large-scale industrial production, manual inspection of product quality is inefficient and lacks precision; machine vision inspection methods can significantly improve production efficiency and automation. Machine vision also facilitates information integration, making it a fundamental technology for computer-integrated manufacturing.
Virtual instrument technology combines general-purpose computers with hardware through software to form a testing or measurement and control system. Users can operate this computer through a user-friendly virtual front panel, just like operating a single traditional instrument that they have defined and designed themselves.
Combining virtual instrumentation technology with machine vision technology allows for the customization of fully PC-based machine vision systems for users. This not only reduces user investment but also enables the development of highly automated and reliable systems. Therefore, integrating virtual instrumentation and machine vision leverages their respective strengths, shortens system development cycles, and improves system reliability and price-performance ratio.
2 Machine Vision and Virtual Instruments
Machine vision is the use of machines to replace human eyes for measurement and judgment. A machine vision system refers to the process of converting the captured target into an image signal through machine vision products (i.e., image acquisition devices, which are divided into CMOS and CCD types), transmitting it to a dedicated image processing system, and converting it into a digital signal based on pixel distribution, brightness, color, and other information; the image system performs various operations on these signals to extract the target's features, and then controls the on-site equipment actions based on the judgment results.
The input devices for machine vision systems can be cameras, rotating drums, etc., all of which take three-dimensional images as input sources. That is, what is input into the computer is a two-dimensional projection of the three-dimensional objective world. If we consider the transformation from the three-dimensional objective world to the two-dimensional projected image as a forward transformation, then what the machine vision system needs to do is to perform an inverse transformation from this two-dimensional projected image to the three-dimensional objective world, that is, to reconstruct the three-dimensional objective world based on this two-dimensional projected image.
A machine vision system mainly consists of three parts: image acquisition, image processing and analysis, and output or display.
Virtual instruments combine general-purpose computers with instrument hardware through applications, allowing users to operate the computer via a user-friendly graphical interface, just as if operating a single, custom-defined, and custom-designed traditional instrument. Virtual instruments transparently combine computer resources with the measurement and control capabilities of instrument hardware, enabling data analysis, processing, and representation through software, as well as providing a graphical user interface.
3. System Hardware and Software Components
The virtual instrument vision system consists of a light source, a CCD camera, an image acquisition card, and a PC.
In machine vision applications, a good light source and illumination scheme are often the key to the success or failure of the entire system, playing a very important role. It is not simply about illuminating the object. The coordination of the light source and illumination scheme should highlight the object's features as much as possible, creating a clear distinction between the parts of the object that need to be detected and those that are not important, increasing contrast, while ensuring sufficient overall brightness. Changes in the object's position should not affect the image quality.
Cameras and image acquisition cards work together to acquire and digitize images of materials. High-quality image information is the primary basis for the system's correct judgment and decision-making, and is another key to the success of the entire system. Currently, CCD cameras are widely used in machine vision systems due to their advantages of small size, reliable performance, and high definition. The CCD converts the target into a video signal and sends it to the image acquisition card. The image acquisition card analyzes and digitizes the video signal before sending it to a dedicated image processing system. The image acquisition card can be considered the interface between the CCD and the computer. When selecting one, the following points should be considered: the video standard supported by the image acquisition card; the number of input channels; the pixel clock; the spatial resolution; and the supported software.
The image processing system performs various operations on the image signal to extract the target's features. Finally, based on pre-set conditions, it makes decisions to control the actions of external actuators such as PLCs and motors, while simultaneously recording the corresponding data into a database for later analysis. The block diagram of the machine vision system is shown in Figure 1.
The core of virtual instruments is software technology, which consists of three parts: a system development platform, application software packages, and device drivers. To achieve the lowest possible cost while meeting performance requirements, LabVIEW was chosen as the development platform for this system's software. It allows for the rapid generation of graphical user interfaces for display, analysis, and control. More importantly, LabVIEW provides the high-level machine vision and image processing software package, IMAQVision. Utilizing these functionalities provided by LabVIEW, the required functions of a quality inspection machine vision system can be accomplished according to the specific circumstances.
imaqvision includes a series of optimized MMX functions, providing a wealth of image acquisition and processing capabilities commonly used in scientific research and engineering. These include various types of filtering, statistical analysis, geometric transformations, and image display functions, as well as binary image processing, model matching, edge detection, blob analysis, and measurement capabilities. imaqvision is easy to learn and use, significantly reducing development costs and time.
4 Image Processing
In machine vision systems, visual information processing techniques primarily rely on image processing methods, including image enhancement, data encoding and transmission, smoothing, edge sharpening, segmentation, feature extraction, and image recognition and understanding. Image processing transforms one image into another, essentially altering the grayscale distribution of a digital image to highlight information in the relevant parts and remove redundant information to suit specific requirements. After these processes, the quality of the output image is significantly improved, enhancing both its visual appeal and facilitating computer analysis, processing, and recognition.
Because digital images contain not only information about the object being measured but also background noise, digital image processing is necessary to extract target features. After digitization, the image is no longer a perfect replica of the original; it contains far less information, but retains useful information while removing unnecessary interference. The image at this point contains only the necessary information and is quite clear. Through digital image analysis, the object's feature information can be extracted. The flowchart of machine vision image processing is shown in Figure 2.
Figure 2 Flowchart of machine vision image processing
Image preprocessing involves filtering and denoising the acquired image, primarily using median filtering to reduce noise, as it effectively suppresses image noise while maintaining clear contours. The filtered and denoised image is then sharpened using a second-order difference method. Finally, the sharpened image undergoes contrast enhancement using histogram equalization. This preprocessing improves the image's visualization and facilitates image segmentation.
The image segmentation module separates the target from the background in the preprocessed image to facilitate target processing and improve computational speed. Feature images retain useful scene information and reduce redundant data. Many algorithms exist, but image binarization is simple, fast, and meets the real-time requirements of image processing systems; therefore, image binarization segmentation is adopted. The main challenge in this segmentation method is determining the threshold (grayscale threshold). Depending on the specific situation, an adaptive thresholding method can be used to determine the threshold.
Image smoothing, also known as image denoising, primarily aims to remove image distortions caused by imaging equipment and the environment during the actual imaging process, thereby extracting useful information. As is well known, images inevitably encounter external and internal interference during their formation, transmission, reception, and processing. This interference includes factors such as the non-uniformity of sensitivity of sensitive elements during photoelectric conversion, quantization noise during digitization, transmission errors, and human factors, all of which can degrade the image. Therefore, noise removal and restoration of the original image are crucial aspects of image processing. A comparison of image filtering effects is shown in Figure 3.
Figure 3 Comparison of image filtering effects
Image edge sharpening primarily enhances the contour edges and details in an image, forming complete object boundaries to separate objects from the image or detect regions representing the surface of the same object. It was a fundamental problem in early vision theory and algorithms, and remains a crucial factor in the success or failure of vision technology in its later stages.
5. Conclusion
The development methodology for combining machine vision and virtual instruments can be summarized as follows:
First, the changes in the hardware development platform should be considered when developing a vision system. Combining virtual instruments with machine vision directly impacts the development of machine vision systems by shifting the hardware platform from traditional dedicated hardware to PC-based development. Therefore, when developing a machine vision system based on virtual instruments, the first consideration should be whether PC-based development can meet the user's system requirements, and then a solution should be formulated accordingly.
Secondly, the design should combine the strengths of virtual instruments and machine vision. One of the purposes of developing a machine vision system by combining virtual instruments and machine vision systems is to combine their respective advantages to make the system more flexible and reliable. Therefore, the design should be based on the strengths of virtual instruments and machine vision. Virtual instruments should be used to implement top-level tasks such as measurement and motion control and user interface design, while the system design, low-level algorithms, and selection of related hardware should be guided by machine vision theory.
Finally, to develop a machine vision system by combining virtual instruments with a machine vision system, the entire system can be divided according to its logical structure, each part can be designed, and then the parts can be integrated.
In summary, by combining virtual instruments with machine vision to develop machine vision systems, as long as attention is paid to changes in the system hardware platform, the respective advantages of virtual instruments and machine vision, and the logical structure of the machine vision system, the system structure can be clear and well-defined, with high reusability and cost-effectiveness of each part.