


Summary:The automatic filling machine is based on computer vision technology and uses LabVIEW as the platform. The image is collected by an image acquisition card. Through image calibration, median filtering, fast image matching and other processing algorithms, the center coordinate position information of the eccentric filling port is obtained to control the drive. The movement of the three-coordinate workbench stepper motor realizes the automatic positioning of the filling gun relative to the eccentric barrel mouth.
0 Introduction
Automatic filling machinery in modern industrial automation production occupies a very important position, widely used in petroleum, chemical, medical, beverage and other production areas. However, when the container's filling port is eccentric, the application of fully automatic filling technology has been seriously constrained, and most of the current filling production line of the enterprise to this more semi-automatic way, that is, manually positioning the barrel mouth filling. This is for the penetration of highly toxic liquids such as sodium cyanide, hydrofluoric acid and other filling, it becomes an extremely dangerous operation process. In the paper, on the basis of deep investigation of the current situation at home and abroad, a self-localization system of barrel mouth of highly toxic automatic filling machine based on computer vision technology is developed. Experiments have proved that the system runs reliably, the algorithm is efficient and stable, and has good practicality.
1 Overview of the working principle of the filling system
The filling system consists of an industrial camera, monochrome image acquisition card, high-brightness low-angle LED array ring light source, industrial control computer, driver, three-coordinate worktable, LabVIEW and IMAQVision development platform.
The industrial camera CCD takes the image of the inspected barrel on the inspection table in real time and transmits it to the image acquisition card. After digital decoding A/D conversion and other processing, through the PCI bus to the computer memory for storage. The image processing program accesses the memory buffer of the retained image and, after calculation, obtains the position information of the circular filling port in the image of the barrel lid surface, i.e., the radius of the filling port, the coordinates of the center of the filling port and the height of the oil gun. Then the corresponding position information is transmitted to the stepping motor control system, and the motor control system drives the XYZ-axis stepping motor according to the pulse commands issued by the computer, driving the oil gun to the top of the filling port, realizing automatic positioning and filling. The system adopts CCS high-brightness low-angle LED array ring light source illumination, which can obtain high-contrast images and facilitate image segmentation processing.
2 Eccentric barrel mouth image processing
In the uncalibrated original image captured by the camera, the place pointed out by the arrow is the eccentric filling mouth. Because of the low gray value of its pixels and the high gray value of the impurity interference on the surface of the barrel mouth, a black background is used in the text in order to enhance the contrast of the image.
2.1 Calibration calibration of image acquisition system
The metering and filling machine acquires the target image pixel information through the camera to calculate the actual position size of the pail mouth, therefore, it is very important to accurately obtain the pixel coordinates of the pail mouth. Due to the lens radial or tangential distortion, camera installation angle deviation and environmental changes and other factors on the camera parameter aspects of the impact, resulting in image distortion distortion, therefore, the camera must be calibrated and parameter calibration.
The filler takes the standard raster dot matrix as the calibration template and adopts the non-linear calibration method to calibrate the target image, and accurately obtains the position of the actual bucket mouth by obtaining the ratio of the correct pixel coordinates of the bucket mouth image to the actual coordinates. The basic steps are as follows:
(1) Establish a right-angle coordinate system in the raster image and select the top-left vertex as the standard origin.
(2) Specify the actual distance of the raster in the work direction and y direction, i.e., make the center distance between adjacent raster points equal (dx=dy=10mm), the circle radius r=2mm, and apply the image acquisition system to obtain a raster image.
(3) Select the nonlinear calibration algorithm operation, and set the scale mode, the cognitive score is not less than 600, save the calibration information, and realize the pixel conversion by linking the acquired image with the calibration information.
In this system, the focal length of the lens is fixed at 8mm, the object distance is 65cm, the size of the CCD target surface is 4.8mmx3.6mm, and the image resolution is 768x576. The spatial resolution of the camera system is calculated to be 0.5mm/pixel, i.e., the distance between the neighboring pixels on the image represents the distance between these two points on the actual photographed object of 0.5mm. The spatial coordinates of the center position of the filling port on the lid of the bucket can be obtained.
2.2 Image Preprocessing
Image signals in the acquisition, transmission process, due to environmental impact, sensor parts and other electrical signal interference impact, transmission channel and other imperfections formed by the noise, so that the image degradation. For the noise in the digital image, such as Gaussian noise, pretzel noise, uniformly distributed noise, etc. to have noise reduction preprocessing. The main purpose of image preprocessing is to improve the visual effect of the image, improve the clarity of the image, so that it is more conducive to computer arithmetic processing. The system uses a fast median filtering algorithm for signal noise reduction, and then image binarization for image segmentation. Compared with similar low-pass linear filters, median filtering filters out point and thick line noise in the image, removes binary, impulse and particle noise, and attenuates random noise without blurring the boundaries, which is suitable for detection requirements.
The idea of fast median filtering is to choose a certain form of window, such as square, cross, line, circle, diamond, so that it is moved at various points of the image, and the median of the gray value of the pixels in the window is used to replace the gray value of the pixels at the center point of the window. When finding the median value of the current window, only the effect of moving out and moving in pixels on the median value of the previous window is considered, which avoids the comparison of a large number of unchanged pixel values and saves computing time. Image binarization is also applied to extract the barrel mouth image from the original image. Image binarization is the transformation of an image into a binary image represented by two gray values by setting a threshold value the key lies in the selection of the threshold value.
2.3 Circular filling port matching template design
The filling port of the filling container is generally circular, fast and accurate detection of the location of the circular region is the key technology of the detection system.
The detection of the circle mainly refers to the extraction and determination of the circle, and the traditional methods mainly include the shape analysis method, the center method, the median method, the least squares fitting method, the loop integral differentiation method, and the Hough transform method (HT), of which HT is currently the most widely used and highly reliable, and in the case of noise, deformation, etc., it can still achieve better results. However, the method takes a long time to compute, and the accuracy is also not high, and the resource demand is large. In the paper, a fast correlation matching algorithm based on gradient features is used, which can well satisfy the detection of circular objects with clearer a priori knowledge.
2.4 Hybrid Programming in LabVIEW Calling C Language
Automatic filling machine algorithm implementation part of the use of LabVIEW's CIN node to call the external C language code function, in order to reduce the programming of the G language connectivity complexity, to obtain a better program execution efficiency. The principle of implementation is: first call the CIN node (Function/AllFunction/Advanced/CodeInterfaceNode) in the LabVIEW program block diagram to generate the C source code editing format file *. Then enter the VC+10 programming environment and add C source code to the above generated file. Then use the cintools tool in LabVIEW to convert the DLL file generated by VC++ into an .lsb file. Load the .lsb file by using the LoadCodeResource option on the CIN node to load and run.
Serial port communication to control stepper motor system 3
LabVIEW collects all the functions of hardware communication such as GPIB, VXI, RS-232, RS-485, etc. By taking advantage of its graphical programming language and applying the sub-VIs in its VISA to set up the serial port communication function module, you can build a measurement and control communication system. The following are the basic steps of LabVIEW communication:
(1) Initialize the port: set the port number, baud rate, stop bit, parity bit, data bit for communication;
(2) Read and write ports: read and write strings with Read-vi and Write-vi;
(3) Get serial port byte count and serial port pause control;
(4) Close the port to complete the communication.
4 Conclusion
The barrel mouth positioning system of the highly toxic liquid filling machine is an intelligent detection system integrating optical, electrical, mechanical, computer and other technologies. Comprehensive use of computer vision technology, in the acquisition and pre-processing, the image filtering and binarization, to speed up the overall operation of the system, can quickly and accurately detect the position of the filling port in the image, and the realization of convenient, rapid, for the improvement of the filling equipment industry is of great significance.