


Summary:Sorting machine using HALCON software to provide the operator on the camera inside and outside parameters and robot "hand-eye" system for calibration, based on the combination of vision inspection technology proposed a workpiece online defect detection method. This method is a spatial phase shift method to determine the position of the workpiece at the grasping moment according to the spatial position at the triggering moment, and then use the electrical signals issued by the image processing software to control the manipulator to complete the dynamic grasping of defective workpieces. Finally, the use of C++ to complete the design of the human-machine interface, after debugging can be completed real-time online detection, can meet the production requirements of precision.
0 Introduction
In the modern packaging industry automated production, involving a variety of inspection, measurement, continuous high-volume production, as well as the high demand for product quality, if the manual method to check, need to consume a lot of manpower, but still can not guarantee 100% inspection pass rate (i.e., "zero defects"). Sorting machine through the use of advanced machine vision technology, through the computer to automatically identify the defective condition of the packaged products, the phenomenon of leakage, loading the wrong phenomenon, and control the robot to remove the defective and unqualified products, which can greatly reduce the workload of people to realize the 24-hour day and night work to improve the output and efficiency of the product. This paper takes the plastic pinion as an example for the extraction of features, as well as the completion of the grasping work. Determination of visual inspection projects usually rely on the preparation of software, change the parameters to complete the different workpiece detection, coupled with more parameters of the plastic pinion, manual inspection is more complex, so this study to the standard parameters of the plastic pinion as the object of detection.
1 workpiece sorting machine hardware construction
The main task of the detection machine is to use machine vision technology for the current moment of the photographed workpiece (such as gears, bolts, flat shims, spring shims, etc.) image pre-processing, according to the characteristics of the workpiece analysis to analyze the analysis results, and then passed to the actuator for positional correction or rejection processing. The conveying system is mainly composed of feeding subsystem, conveying device, signal triggering subsystem, light source subsystem, image acquisition device, image processing and analysis software, control system, actuator subsystem and so on.
The working principle is that the feeding device should be coordinated with the conveyor device, the workpiece is irregularly placed on the conveyor belt, when the infrared photoelectric switch under the camera detects that a gear passes through the triggering signal, which triggers the industrial camera to take pictures of the work under the camera, and then the captured images are transmitted to the computer's image analysis software for processing and judging, and the resulting results are fed back to the manipulator. The result will be fed back to the robot for grasping and rejecting.
Camera selection of Germany's AVT company's Stingray-F201 ℃ industrial camera, which has a continuous shooting, triggered shooting, single photo shooting and other modes of operation; FWB-PCIEIX21A capture card, can be synchronized with real-time transmission, and hardware and software compatibility is good, support for a variety of types of cameras at the same time, also support the commonly used development language; light source using a ring of LED The light source adopts ring-shaped LED, in order to better display the edge contour of the workpiece, increase the contrast between the workpiece and the surrounding environment, and reduce the difficulty and pressure for the subsequent image processing; the image analysis software adopts the HALCON software of Daheng Company, and HALCON provides more than 1,100 kinds of libraries with outstanding performance controllers such as fuzzy analysis, morphology, pattern matching, 3D correction etc. HALCON supports Multiple operating systems, programming languages and interception devices, thus bringing great convenience to image processing; the reject system is accomplished using a robot.
2 Pre-processing work for workpiece detection
To identify and localize an object, the attitude and position of the object must be determined before grasping, i.e., the hand claw needs to know the position of the object relative to the robot base before reaching the target position. Therefore, the target object can be limited to the world coordinate system, the position of the object relative to the camera is the external parameters of the camera, which can be obtained by the method of camera calibration, if the relationship between the camera coordinate system and the robot coordinate system is known, the orientation of the object measured by the camera relative to the camera coordinate system can be transformed into the orientation relative to the robot system, i.e., the data required by the robot .
2.1 Method and procedure of calibration
The sorting machine adopts the camera fixed installation method, and then use the robot to clamp the made calibration plate in the appropriate position, use AVT-SMARTVIEWER software to take images of the calibration plate at different positions, the calibration accuracy is related to the number of images, at least 10~20 images are selected, the position of the calibration plate in the selected image should be able to cover the 4 corners of the image, because the lens at the corners The distortion is the largest, so that a more accurate distortion coefficient k can be obtained. 18 images are selected for analysis and processing in this experiment.
(1) The principle of calibration principle of camera internal and external parameters is to transform a known point p = (x, y,) in the world coordinates to its projection point p on the imaging coordinate system, the process of which utilizes the vector translation method, the principle of convex lens imaging, the empirical formula for aberration and other methods. Then complete the calibration of the camera in the HALCON software.
(2) robotic "hand-eye" calibration principle hand-eye calibration is mainly the use of the relationship between the coordinate transformation to find the unknown variable method.
2.2 Calibration results
The calibration process should be divided into the calibration of the internal and external parameters of the camera and the calibration of the robot hand-eye system. The calibration of the internal and external parameters of the camera can be derived from the internal parameters of the camera (fh, dx, dr, U) and the positional relationship between the calibration plate and the camera; while the calibration of the robot hand-eye system can be derived from the current robot's coordinate position, i.e., the tool seating system with respect to the base of the posture relationship between the base and the camera external parameters. The calibration of the robot hand-eye system can be derived from the current coordinate position of the robot, i.e., the positional relationship between the tool sitting system and the camera, and the external parameters of the camera, which correspond to a set of external parameters of the camera. Each image corresponds to a set of external parameters of the camera. Different workpiece positions correspond to different individual parameters.
Calibration of the robot hand-eye system The robot hand-paw position coordinates for this experiment are given by the robot control system.
3 Pre-processing of gear images
After the objects on the conveyor belt are photographed, they can not be directly processed for image analysis, first image preprocessing, then filter processing, and finally edge extraction, and finally image analysis.
(1) Grayscale processing
Grayscale processing refers to the color photo first gray-scale transformation method, grayscale image processing methods are grayscale histogram, grayscale linear transformation, grayscale logarithmic transformation, gamma transformation, segmented linear transformation, histogram equalization and other methods. The histogram can reflect the gray scale range of the image, the frequency of each gray level, the gray scale distribution, the brightness of the whole image, etc. It is an important basis for image processing. Its grayscale effect graph is shown in Figure 7, which shows that the effect of linear transformation is more obvious, the contrast is stronger, and the feature edges are clearer.
(2) Image denoising
Due to the external environment, light and other influences and the shooting of the image and by the measured parts on the stains, the lens on the stains, impurities in the air, light intensity, electromagnetic radiation from electronic equipment and other interferences, these interfering data will be contained in the data acquisition end or the acquisition is completed after the transmission process, to the clarity of the image to the detriment of the impact. In the experiment, the collected images were processed by mean, Gaussian and median filtering, and through comparison, it can be seen that the method of Gaussian filtering is obviously in the edge of the nonlinear smoothing, noise impulse has a significant effect, and after the comprehensive examination, the smoothing of the image to take the template for the Gaussian smoothing of 3x3.
(3) Edge Extraction
Commonly used edge detection algorithms are based on finding the first-order derivative operator, such as Roberts operator, Sobel operator, Ptewitt operator; second-order operator of the Gaussian-Laplace edge detection operator (LoG). Since the Sobel operator first performs weighted smoothing of the image in the detection process, and then does the differentiation operation, it has a certain suppression ability for noise, and the operator is more effective in detecting oblique step edges, so this study adopts the Sobel operator to extract the diameter of the axial hole and the gear boundary.