An intelligent sorting system and method based on product color and shape recognition
Through an intelligent sorting system based on machine vision, combined with CCD cameras and robots, the color and shape recognition of workpieces is realized, which solves the problem of poor environmental adaptability in the traditional industrial sorting process, improves sorting efficiency and flexibility, and reduces costs.
Patent Information
- Application Number
- CN202210229454.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-09
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-03-09
AI Technical Summary
In the traditional industrial sorting process, industrial robots have weak adaptability to the environment and poor flexibility, making it difficult to meet the needs of high-speed sorting and flexible production, and relying on manual sorting is costly and inefficient.
An intelligent sorting system based on machine vision is used to realize the color and shape recognition of workpieces through the combination of CCD cameras and robots. The visual signal collection, processing and control layer is used to realize automatic sorting and external size detection, reducing human errors.
It improves the efficiency of workpiece sorting, reduces inspection costs, meets the needs of enterprises for product quality management, and enables robots to flexibly respond to the production environment.
Smart Images

Figure CN114913346B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent manufacturing technology and is particularly suitable for the sorting process of industrial products; specifically, it relates to an intelligent sorting system and method based on product color and shape recognition. Background Art
[0002] The industrial sorting process is defined as the process of accurately grasping the target product and placing it in the predetermined position according to the category. In light industries such as food, logistics and electronics, the production process often needs to complete the sorting operation of large quantities of industrial products. The traditional sorting method that relies on a large number of manual labor can no longer meet the production needs. With the popularization and development of automation-related technologies, more and more industrial production processes have begun to be equipped with automated equipment to implement sorting tasks. The sorting process includes two methods: static sorting and dynamic sorting. The static sorting process requires the target to be in a static state. The position and posture of the target product and the motion path of the robot end need to be strictly set in advance through teaching or offline programming. Although the sorting accuracy can be guaranteed, the industrial robot has weak adaptability to the environment and poor flexibility, and cannot meet the high-speed sorting and flexible production requirements of the production system. The dynamic sorting process is more suitable for high-speed pick-and-place operations on light and small items moving on the assembly line. If combined with an industrial vision system, the robot can quickly complete the sorting process for the randomly presented moving target products on the assembly line, which will significantly improve the intelligence of the robot and enable the robot to quickly respond to changes in the production environment. Therefore, developing a robot sorting system and method based on machine vision is of great significance to improving industrial production efficiency. Summary of the invention
[0003] The present invention aims at the above problems, makes up for the deficiencies of the prior art, and provides an intelligent sorting system and method based on product color and shape recognition; the present invention constructs a robot intelligent sorting system based on machine vision, realizes the automatic sorting of workpieces, i.e., target products, automatically detects the external dimensions of workpieces, and compares them with standard workpiece templates to distinguish different categories of workpieces. The system of the present invention can greatly improve the efficiency of workpiece sorting, thereby reducing the inspection cost of products and meeting the needs of enterprises for product quality management.
[0004] To achieve the above purpose, the present invention adopts the following technical solution.
[0005] The present invention provides an intelligent sorting system based on product color and shape recognition, comprising a visual signal acquisition layer, a visual signal processing layer, a visual task control layer, and a visual application layer;
[0006] The visual signal acquisition layer is used to provide the system with real-time on-site assembly line visual information. A CCD camera is arranged above the on-site conveyor belt, and the CCD camera is used in conjunction with the on-site robot to control the robot to sort workpieces. When triggered by an external signal, the visual signal is collected to obtain the color and shape information of the sorted workpiece, providing raw data for the judgment of the workpiece category and the positioning of the workpiece.
[0007] Visual signal processing layer, which includes the workshop master control server, host computer, and workpiece storage master control; the visual signal processing layer is used to process and analyze the signals obtained by the visual signal acquisition layer and to provide information feedback to the upper-layer equipment to meet the visual signal requirements of each unit equipment in the workshop;
[0008] Visual task control layer, which includes the unit master control; the visual task control layer is used to realize the production task scheduling and the coordinated control of the equipment in the unit, and to realize the distribution of visual tasks; it is also used to realize the visual acquisition control of each processing unit, realize the collection of on-site information and the online monitoring of equipment status information, production management information, and quality statistical information;
[0009] The visual application layer includes a robot controller, which uses the results of processing and analysis by the visual signal processing layer to implement motion control on the robot on site and realize the workpiece grasping function; and can apply different applications to visual signals for different functions.
[0010] As a preferred solution of the present invention, the visual signal acquisition layer includes a lens, a CCD camera, a light source and an image acquisition card. The light source is arranged above the workpiece on the conveyor belt, the CCD camera is located above the light source, the lens is installed on the CCD camera, the robot is located on one side of the conveyor belt, and the CCD camera is connected to the image acquisition card; the visual task control layer also includes detection tasks and workpiece transportation tasks.
[0011] As another preferred solution of the present invention, the image acquisition card is connected to the host computer of the visual signal processing layer, the host computer is communicatively connected to the robot controller through the cloud platform, and the robot controller is connected to the robot.
[0012] The intelligent sorting system based on product color and shape recognition described in the present invention can meet the network communication connection of devices with different protocols, realize statistical analysis and intelligent management of workpiece quality; and realize intelligent sorting of products by combining image acquisition and processing technology with motion control technology.
[0013] The present invention provides an intelligent sorting method based on product color and shape recognition, which uses the intelligent sorting system to implement the intelligent sorting method, including the following steps:
[0014] Step 1: Determine the coordinate transformation relationship between the pixel coordinate system and the robot coordinate system through the robot hand-eye calibration operation;
[0015] The CCD camera scale uses pixel coordinates, and the robot coordinates are space coordinates. The hand-eye calibration is to obtain the coordinate transformation relationship between the pixel coordinate system and the robot coordinate system. The nine-point calibration is used to directly establish the coordinate transformation relationship between the CCD camera and the robot, so that the end of the robot obtains the coordinates in the robot coordinate system through nine points, and the CCD camera is used to identify the nine points to obtain the pixel coordinates. The calibration parameters of the coordinate transformation between the pixel coordinate system and the robot coordinate system can be obtained by calculation.
[0016] If there is a point that is [x, y, 1] before transformation and [x', y', 1] after transformation, the transformation system is expressed as follows:
[0017] TX+M=Y (1)
[0018] in, M=[c,f,0] T ,X=[x,y,1], Y=[x',y',1];
[0019] If you want to find the six variables between af, you need three groups of points. In order to improve the accuracy of calibration, 9 groups of points are usually used, and the least squares method is used to determine the coefficients to be determined.
[0020] Step 2: Use the workpiece template of the CCD imaging standard and store it in the database of the workshop master control server;
[0021] Through CCD imaging of the standard workpiece template, a template for the workpiece to be sorted is established and stored in the database of the workshop master control server.
[0022] Step 3: Determine whether the workpiece to be measured is within the field of view
[0023] The auxiliary switch of the conveyor belt is used to detect whether there is a workpiece in the field of view. If there is a workpiece, the auxiliary switch is closed. After the unit master control detects that the auxiliary switch is closed, it controls the CCD camera to capture an image of the workpiece in the field of view. Otherwise, the system loops to detect whether the workpiece is in the field of view.
[0024] Step 4: By extracting the color and shape features of the workpiece, the workshop master control server determines whether the workpiece in the field of view is a workpiece to be picked, which specifically includes the following steps:
[0025] 4.1 Preprocessing of workpiece images
[0026] The acquired image is filtered and denoised using Gaussian filtering to reduce the impact of noise on the image; the image is segmented into regions with different characteristics through image segmentation, and the foreground target in the image is separated and extracted from the background; the workpiece image is edge detected, and the target is separated from the background based on the detected edge region;
[0027] 4.2 Workpiece Image Feature Extraction
[0028] ①Extraction of color features
[0029] The color feature extraction method uses the color histogram. The color histogram is the most basic color feature representation method. It reflects the composition distribution of colors in the image, that is, which colors appear and the probability of color appearance; its function expression is as follows:
[0030]
[0031] Among them, k represents the feature value of the image, L is the number of possible feature values, and n k is the number of pixels with characteristic value k in the image, and N is the total number of image pixels; since the extraction process of this color feature does not need to consider the spatial position of the object, the similarity of the workpiece color can be judged according to the proportion of different colors described by the color histogram in the entire image;
[0032] ②Extraction of shape features
[0033] The template matching method of edge centroid distance is used to extract the shape features of the workpiece. After obtaining the stable edge information of the target through preprocessing edge feature extraction, the edge centroid distance is used as the expression method of shape features; the minimum circumscribed rectangle of the target workpiece is obtained by image analysis, and the centroid coordinates of the target workpiece are obtained by analogy with the centroid principle:
[0034]
[0035] Where n represents the number of all pixels in the bounding rectangle of the target workpiece, P i x represents the coordinate position of the current pixel in the x direction of the image. Similarly, P i y represents the coordinate position of the pixel point in the y direction of the image; next, the distance from each edge point of the target workpiece to its centroid is calculated, and all distances are sequentially constructed into a multidimensional vector as an abstract expression of the target edge, thus completing the establishment of the target template; templates of all categories of workpieces are established respectively, and the above operation is performed on all target workpieces in the search image, and the matching process of the corresponding target is completed by calculating the feature vector distance between the template workpiece and the search workpiece;
[0036] 4.3 Calculation of similarity between workpiece color and shape
[0037] ③Color similarity calculation
[0038] The basic hue of the feature area after Gaussian filtering is single, there is no hue mutation, and the color distribution is uniform; considering the characteristics of the feature area, the advantages and disadvantages of the commonly used color feature description and the efficiency of the algorithm, the difference of each color channel of the simplest color histogram is used to judge the similarity of the workpiece color; the color difference calculation formula is as follows:
[0039]
[0040] Where C is the color difference of any channel of the color histogram; n, m are the number of pixels in the x and y directions of the image; p is the average pixel difference of the image;
[0041] The color histogram is used to calculate the color distance between the target image's region of interest and each color template. The smaller the distance, the higher the similarity. The category to which the target image belongs is the category represented by the color template with the smallest distance.
[0042] ④ Shape similarity calculation
[0043] By comparing the centroid coordinates of the workpiece image with the centroid coordinates of the template image, it is determined whether the shape characteristics of the workpiece meet the sorting requirements. The comparison result provides the difference information between the images. The centroid coordinates of the detected workpiece image and the qualified template workpiece image can be matched and variance calculation can be performed to intuitively obtain the shape difference between the template image of the workpiece and the image to be detected, and then the workpiece classification can be performed based on the comparison of the difference image with the threshold.
[0044] If ∑ΔG=0, that is, Img(A)-Img(B)=0, Img(A) is the centroid coordinate vector of the workpiece template, and Img(B) is the centroid coordinate vector of the workpiece image to be tested, it means that the workpiece to be tested is exactly the same as the workpiece module; but due to the existence of processing errors, ∑ΔG cannot be zero, so a threshold is set. When ∑ΔG is less than the threshold, it is judged to be the same workpiece, otherwise it is a different workpiece or a defective product;
[0045] ⑤Feature similarity fusion normalization
[0046] To identify an object based on the color and shape features of an image, the similarity of the two feature recognitions needs to be fused. The similarity between the two color and shape feature vectors is calculated using the variance value of the numerical value. The closer it is to 0, the greater the similarity between the two features. Since the quantization units of color features and shape features are different, it is necessary to normalize the similarity distance function so that the similarity measures of the two features are normalized within the interval [0, 1], thereby performing linear weighted fusion.
[0047] The shape feature similarity and color feature similarity are Dc and Dt respectively, and their calculation formulas are as follows:
[0048]
[0049] Among them, ∑ΔG is the sum of the squares of the centroid coordinates of the object and the template image, ∑G is the sum of the squares of the centroid coordinates of the template, ∑Δp is the sum of the squares of the pixel differences between the object and the template image, and ∑p is the sum of the squares of the pixels of the template image;
[0050] 4.4 Identification of artifact types
[0051] To identify artifacts based on the color and shape features of an image, it is necessary to fuse the similarities of the two features. In 4.3, the normalized similarities of shape and color features have been obtained through the maximum matching distance. At this time, the similarities of the two features have the same value range and can be fused. The color feature similarity and the shape feature similarity are fused to form an artifact similarity function through weighted fusion. The fusion rules are as follows:
[0052] Assuming that the shape feature similarity and color feature similarity of the two workpieces are Dt and Dc respectively, the fusion similarity of shape feature and color feature D TC for:
[0053] D TC =ω c D C +ω T D T (6)
[0054] Among them, ω c is the weight of color similarity, ω T is the weight of shape similarity, ω c ,ω T The formula is:
[0055]
[0056] Formula (7) indicates that when one of the shape feature similarity and the color feature similarity is less than 0.5, then ω c and ω T are all 0, indicating that there is no similarity between the two artifacts; therefore, D TC ∈[0,1]; The artifact similarity function established according to this rule indicates that two artifacts are likely to be similar artifacts only when their shape features and color features meet a certain threshold, that is, both are greater than 0.5. Otherwise, the two artifacts have no similarity. TC The closer it is to 1, the more similar the two workpieces are; conversely, the smaller the similarity between the two workpieces, the less likely they are to be similar.
[0057] Step 5: Calculation of workpiece centroid position and angle
[0058] After the CCD camera matches the corresponding target workpiece, the next step is to obtain the pose information of the matching workpiece to guide the robot to accurately grasp the target workpiece; the target pose information under the visual task includes the position information and deflection angle of the target on the two-dimensional motion plane; the centroid coordinates extracted by the shape features are used to describe the position coordinate information of the target workpiece in the image; the deflection angle of the target is the rotation process relative to its initial template state, so the minimum circumscribed rectangle is obtained for the current target image and its corresponding category template image respectively, and the angle difference between the two rectangles in the horizontal or vertical direction is compared as the compensation angle when the robot grasps the current target workpiece; the default pattern feature on the surface of the sorting workpiece is an asymmetric figure, so the angular rotation range of the target workpiece is specified to be ±180°, so that the pose information of a single target workpiece under the 2D vision task is obtained: X_Y_A_.
[0059] Step 6: Control the robot to reach the specified location and perform sorting operations
[0060] If the current workpiece is a certain type of assumed qualified workpiece, adjust the machine end effector according to the position and angle calculated in step 5 and sort it to the specified channel. If it is not a certain type of workpiece to be found, jump to step 3 and continue executing until the sorting process is completed.
[0061] Beneficial effects of the present invention:
[0062] 1. The present invention has intelligent characteristics. It uses machine vision to sort workpieces, saving labor costs and reducing losses caused by human errors.
[0063] 2. The present invention has the characteristic of high reliability. The present invention adopts the workshop master control server to realize image processing and analysis, realizes the overall computing power balance of the system, improves the computing efficiency of the system, and thus meets the real-time processing performance of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 The figure is a schematic structural diagram of an embodiment of the sorting system of the present invention applied to an on-site assembly line.
[0065] Figure 2 It is a schematic diagram of the hierarchical modular system structure of the present invention.
[0066] Figure 3 It is a processing flow chart of the intelligent sorting method of the present invention.
[0067] Figure 4 This is a schematic diagram of the robot hand-eye calibration of the present invention.
[0068] Markings in the figure: 1 is the conveyor belt, 2 is the light source, 3 is the lens, 4 is the CCD camera, 5 is the image acquisition card, 6 is the host computer, 7 is the cloud platform, 8 is the robot controller, and 9 is the robot. DETAILED DESCRIPTION
[0069] In order to make the technical problems, technical solutions and beneficial effects solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be understood that the specific implementation methods described herein are only used to explain the present invention and are not used to limit the present invention.
[0070] Example 1
[0071] The intelligent sorting system of the present invention generates the centroid position of the workpiece 1 by image acquisition and processing (i.e., machine vision) technology, and provides coordinate points for the robot 9 to grasp; the host computer 6 sends the processed coordinate points as motion control parameters to the robot controller 8 through the cloud platform 7, and the robot controller 8 controls the end actuator of the robot 9 to perform tracking and grasping operations within the area set by the host computer 6 to realize the workpiece grasping function. The system of the present invention adopts a template matching method to distinguish the workpieces to be sorted, and compares the workpiece to be tested with the standard workpiece template. If a certain error is exceeded, it is judged as a non-similar product.
[0072] Combination Figure 1 and Figure 2 As shown, the present invention provides an intelligent sorting system based on product color and shape recognition, including a visual signal acquisition layer, a visual signal processing layer, a visual task control layer, and a visual application layer;
[0073] The visual signal acquisition layer is used to provide the system with real-time on-site assembly line visual information; a CCD camera 4 is arranged above the on-site conveyor belt 1, and the CCD camera 4 is used in conjunction with the on-site robot 9 to control the robot 9 to sort workpieces; when triggered by an external signal, the visual signal is collected to obtain the color and shape information of the sorted workpiece, providing raw data for the judgment of the workpiece category and the positioning of the workpiece;
[0074] Visual signal processing layer, which includes the workshop master control server, the host computer 6, and the workpiece storage master control; the visual signal processing layer is used to process and analyze the signals obtained by the visual signal acquisition layer and to provide information feedback to the upper layer equipment to meet the visual signal requirements of each unit equipment in the workshop;
[0075] Visual task control layer, which includes the unit master control; the visual task control layer is used to realize the production task scheduling and the coordinated control of the equipment in the unit, and to realize the distribution of visual tasks; it is also used to realize the visual acquisition control of each processing unit, realize the collection of on-site information and the online monitoring of equipment status information, production management information, and quality statistical information;
[0076] The visual application layer includes a robot controller 8, which uses the results of processing and analysis by the visual signal processing layer to implement motion control on the robot 9 on site to achieve the workpiece grasping function; and can apply different applications to the visual signals according to different functions.
[0077] The visual signal acquisition layer includes a lens 3, a CCD camera 4, a light source 2 and an image acquisition card 5. The light source 2 is arranged above the workpiece on the conveyor belt 1, the CCD camera 4 is located above the light source 2, the lens 3 is installed on the CCD camera 4, the robot 9 is located on one side of the conveyor belt, and the CCD camera 4 is connected to the image acquisition card 5; the visual task control layer also includes detection tasks and workpiece transportation tasks.
[0078] The image acquisition card 5 is connected to the host computer 6 of the visual signal processing layer, the host computer 6 is connected to the robot controller 8 through the cloud platform 7, and the robot controller 8 is connected to the robot 9.
[0079] The intelligent sorting system based on product color and shape recognition described in the present invention can meet the network communication connection of devices with different protocols, realize statistical analysis and intelligent management of workpiece quality; and realize intelligent sorting of products by combining image acquisition and processing technology with motion control technology.
[0080] Example 2
[0081] Combination Figure 3 and Figure 4 As shown, the present invention provides an intelligent sorting method based on product color and shape recognition, and the intelligent sorting method is implemented by using the intelligent sorting system, including the following steps:
[0082] Step 1: Determine the coordinate transformation relationship between the pixel coordinate system and the robot coordinate system through the robot hand-eye calibration operation;
[0083] The CCD camera scale uses pixel coordinates, the robot coordinates are space coordinates, and the hand-eye calibration is to obtain the coordinate transformation relationship between the pixel coordinate system and the robot coordinate system; Figure 4 The schematic diagram of the robot hand-eye calibration shown in the figure uses nine-point calibration to directly establish the coordinate transformation relationship between the CCD camera 4 and the robot 9, so that the end of the robot 9 obtains the coordinates in the robot 9 coordinate system through nine points, and the CCD camera is used to identify the nine points to obtain the pixel coordinates; the calibration parameters of the coordinate transformation between the pixel coordinate system and the robot 9 coordinate system can be obtained by calculation;
[0084] If a point is [x, y, 1] before transformation and [x', y', 1] after transformation, the transformation relationship is expressed as follows:
[0085] TX+M=Y (1)
[0086] in, M=[c,f,0] T ,X=[x,y,1], Y=[x',y',1];
[0087] If you want to find the six variables between af, you need three groups of points. In order to improve the accuracy of calibration, 9 groups of points are usually used, and the least squares method is used to determine the coefficients to be determined.
[0088] Step 2: Use the workpiece template of the CCD imaging standard and store it in the database of the workshop master control server;
[0089] Through CCD imaging of the standard workpiece template, a template for the workpiece to be sorted is established and stored in the database of the workshop master control server.
[0090] Step 3: Determine whether the workpiece to be measured is within the field of view
[0091] The auxiliary switch of the conveyor belt is used to detect whether there is a workpiece in the field of view. If there is a workpiece, the auxiliary switch is closed. After the unit master control detects that the auxiliary switch is closed, it controls the CCD camera 4 to capture an image of the workpiece in the field of view. Otherwise, the system loops to detect whether the workpiece is in the field of view.
[0092] Step 4: By extracting the color and shape features of the workpiece, the workshop master control server determines whether the workpiece in the field of view is a workpiece to be picked, which specifically includes the following steps:
[0093] 4.1 Preprocessing of workpiece images
[0094] The acquired image is filtered and denoised using Gaussian filtering to reduce the impact of noise on the image; the image is segmented into regions with different characteristics through image segmentation, and the foreground target in the image is separated and extracted from the background; the workpiece image is edge detected, and the target is separated from the background based on the detected edge region;
[0095] 4.2 Workpiece Image Feature Extraction
[0096] ①Extraction of color features
[0097] The color feature extraction method uses the color histogram. The color histogram is the most basic color feature representation method. It reflects the composition distribution of colors in the image, that is, which colors appear and the probability of color appearance; its function expression is as follows:
[0098]
[0099] Among them, k represents the feature value of the image, L is the number of possible feature values, and n kis the number of pixels with characteristic value k in the image, and N is the total number of image pixels; since the extraction process of this color feature does not need to consider the spatial position of the object, the similarity of the workpiece color can be judged according to the proportion of different colors described by the color histogram in the entire image;
[0100] ②Extraction of shape features
[0101] The present invention adopts the template matching method of edge centroid distance to extract the shape features of the workpiece. After obtaining the stable edge information of the target through pre-processed edge feature extraction, the edge centroid distance is used as the expression method of the shape features; the minimum circumscribed rectangle of the target workpiece is obtained by image analysis, and the centroid coordinates of the target workpiece are obtained by analogy with the centroid principle:
[0102]
[0103] Where n represents the number of all pixels in the bounding rectangle of the target workpiece, P i x represents the coordinate position of the current pixel in the x direction of the image. Similarly, P i y represents the coordinate position of the pixel point in the y direction of the image; next, the distance from each edge point of the target workpiece to its centroid is calculated, and all distances are sequentially constructed into a multidimensional vector as an abstract expression of the target edge, thus completing the establishment of the target template; templates of all categories of workpieces are established respectively, and the above operation is performed on all target workpieces in the search image, and the matching process of the corresponding target is completed by calculating the feature vector distance between the template workpiece and the search workpiece;
[0104] 4.3 Calculation of similarity between workpiece color and shape
[0105] ③Color similarity calculation
[0106] The basic hue of the feature area after Gaussian filtering is single, there is no hue mutation, and the color distribution is uniform; considering the characteristics of the feature area, the advantages and disadvantages of the commonly used color feature description and the efficiency of the algorithm, the difference of each color channel of the simplest color histogram is used to judge the similarity of the workpiece color; the color difference calculation formula is as follows:
[0107]
[0108] Where C is the color difference of any channel of the color histogram; n, m are the number of pixels in the x and y directions of the image; p is the average pixel difference of the image;
[0109] The color histogram is used to calculate the color distance between the target image's region of interest and each color template. The smaller the distance, the higher the similarity. The category to which the target image belongs is the category represented by the color template with the smallest distance.
[0110] ④ Shape similarity calculation
[0111] By comparing the centroid coordinates of the workpiece image with the centroid coordinates of the template image, it is determined whether the shape characteristics of the workpiece meet the sorting requirements. The comparison result provides the difference information between the images. The centroid coordinates of the detected workpiece image and the qualified template workpiece image can be matched and variance calculation can be performed to intuitively obtain the shape difference between the template image of the workpiece and the image to be detected, and then the workpiece classification can be performed based on the comparison of the difference image with the threshold.
[0112] If ∑ΔG=0, that is, Img(A)-Img(B)=0, Img(A) is the centroid coordinate vector of the workpiece template, and Img(B) is the centroid coordinate vector of the workpiece image to be tested, it means that the workpiece to be tested is exactly the same as the workpiece module; but due to the existence of processing errors, ∑ΔG cannot be zero, so a threshold is set. When ∑ΔG is less than the threshold, it is judged to be the same workpiece, otherwise it is a different workpiece or a defective product;
[0113] ⑤Feature similarity fusion normalization
[0114] To identify an object based on the color and shape features of an image, the similarity of the two feature recognitions needs to be fused. The similarity between the two color and shape feature vectors is calculated using the variance value of the numerical value. The closer it is to 0, the greater the similarity between the two features. Since the quantization units of color features and shape features are different, it is necessary to normalize the similarity distance function so that the similarity measures of the two features are normalized within the interval [0, 1], thereby performing linear weighted fusion.
[0115] The shape feature similarity and color feature similarity are Dc and Dt respectively, and their calculation formulas are as follows:
[0116]
[0117] Among them, ∑ΔG is the sum of the squares of the centroid coordinates of the object and the template image, ∑G is the sum of the squares of the centroid coordinates of the template, ∑Δp is the sum of the squares of the pixel differences between the object and the template image, and ∑p is the sum of the squares of the pixels of the template image;
[0118] 4.4 Identification of artifact types
[0119] To identify artifacts based on the color and shape features of an image, it is necessary to fuse the similarities of the two features. In 4.3, the normalized similarities of shape and color features have been obtained through the maximum matching distance. At this time, the similarities of the two features have the same value range and can be fused. The color feature similarity and the shape feature similarity are fused to form an artifact similarity function through weighted fusion. The fusion rules are as follows:
[0120] Assuming that the shape feature similarity and color feature similarity of the two workpieces are Dt and Dc respectively, the fusion similarity of shape feature and color feature D TC for:
[0121] D TC =ω c D C +ω T D T (6)
[0122] Among them, ω c is the weight of color similarity, ω T is the weight of shape similarity, ω c ,ω T The formula is:
[0123]
[0124] Formula (7) indicates that when one of the shape feature similarity and the color feature similarity is less than 0.5, then ω c and ω T are all 0, indicating that there is no similarity between the two artifacts; therefore, D TC ∈[0, 1]; The artifact similarity function established according to this rule indicates that two artifacts are likely to be similar artifacts only when their shape features and color features meet a certain threshold, that is, both are greater than 0.5, otherwise the two artifacts have no similarity; where D TC The closer it is to 1, the more similar the two workpieces are; conversely, the smaller the similarity between the two workpieces, the less likely they are to be similar.
[0125] Step 5: Calculation of workpiece centroid position and angle
[0126] After the CCD camera matches the corresponding target workpiece, the next step is to obtain the pose information of the matching workpiece to guide the robot to accurately grasp the target workpiece; the target pose information under the visual task includes the position information and deflection angle of the target on the two-dimensional motion plane; the centroid coordinates extracted by the shape features are used to describe the position coordinate information of the target workpiece in the image; the deflection angle of the target is the rotation process relative to its initial template state, so the minimum circumscribed rectangle is obtained for the current target image and its corresponding category template image respectively, and the angle difference between the two rectangles in the horizontal or vertical direction is compared as the compensation angle when the robot grasps the current target workpiece; the default pattern feature on the surface of the sorting workpiece is an asymmetric figure, so the angular rotation range of the target workpiece is specified to be ±180°, so that the pose information of a single target workpiece under the 2D vision task is obtained: X_Y_A_.
[0127] Step 6: Control the robot to reach the specified location and perform sorting operations
[0128] If the current workpiece is a certain type of assumed qualified workpiece, adjust the machine end effector according to the position and angle calculated in step 5 and sort it to the specified channel. If it is not a certain type of workpiece to be found, jump to step 3 and continue executing until the sorting process is completed.
[0129] like Figure 3 As shown, it is a processing flow chart of the intelligent sorting method of the present invention, and the main features of the processing flow are:
[0130] (1) In terms of machine vision image processing algorithms, the randomness of workpiece placement is solved, and the research results can be applied to automatic sorting systems.
[0131] (2) In terms of machine vision feature extraction, the color features and shape features of the workpiece are considered simultaneously, and the reliability of the sorting results is ensured through the similarity judgment of the fusion of the two.
[0132] (3) In terms of machine vision image recognition, a standard workpiece template was established. By performing translation and rotation transformations on the workpiece to be tested and comparing the similarity with the standard template, it can be determined whether it is a workpiece of the same type.
[0133] In summary, the present invention utilizes robots combined with machine vision to realize a dynamic high-speed sorting process in an industrial production process. The sorting objects, i.e., workpieces, will be randomly scattered on the conveyor belt 1 and move in a uniform linear motion with the conveyor belt 1. When the workpiece passes through the field of view of the CCD camera 4 fixed above the conveyor belt 1, the system of the present invention will trigger the CCD camera 4 to acquire images in a triggering manner. The host computer 6 of the system obtains the workpiece category information and posture information through the corresponding processing algorithm, and interacts with the robot controller 8 of the robot 9 according to a certain data format, guiding the end actuator of the robot 9 to perform tracking and grasping operations in a suitable action area, and placing different categories of workpieces in pre-specified positions.
[0134] It can be understood that the above specific description of the present invention is only used to illustrate the present invention and is not limited to the technical solutions described in the embodiments of the present invention. Those skilled in the art should understand that the present invention can still be modified or replaced by equivalents to achieve the same technical effects; as long as the use requirements are met, they are within the protection scope of the present invention.
Claims
1. An intelligent sorting method based on product color and shape recognition, characterized in that: The steps include: Step 1: Determine the coordinate transformation relationship between the pixel coordinate system and the robot coordinate system through the robot hand-eye calibration operation; The CCD camera scale uses pixel coordinates, the robot coordinates are the space coordinate system, and the hand-eye calibration is to obtain the coordinate transformation relationship between the pixel coordinate system and the robot coordinate system; the nine-point calibration is used to directly establish the coordinate transformation relationship between the CCD camera and the robot, so that the end of the robot obtains the coordinates in the robot coordinate system through nine points, and the CCD camera is used to identify the nine points to obtain the pixel coordinates; the calibration parameters of the coordinate transformation between the pixel coordinate system and the robot coordinate system can be obtained by calculation; If a point is [x, y, 1] before transformation and [ , ,1], the transformation relationship is as follows: (1) Among them, , M = [c, f, 0] T , X = [x, y, 1], Y = , , 1]; If you want to find the 6 variables between af, you need 3 sets of points. To improve the accuracy of calibration, use 9 sets of points and use the least squares method to determine the coefficients to be determined. Step 2: Use the workpiece template of the CCD imaging standard and store it in the database of the workshop master control server; Through CCD imaging of standard workpiece templates, a template of the workpiece to be sorted is established and stored in the database of the workshop master control server; Step 3: Determine whether the workpiece to be measured is within the field of view The auxiliary switch of the conveyor belt is used to detect whether there is a workpiece in the field of view. If there is a workpiece, the auxiliary switch is closed. After the unit master detects that the auxiliary switch is closed, the CCD camera is controlled to collect images of the workpiece in the field of view. Otherwise, the system cyclically detects whether the workpiece is in the field of view. Step 4: By extracting the color and shape features of the workpiece, the workshop master control server determines whether the workpiece in the field of view is a workpiece to be picked, which specifically includes the following steps: 4.1 Preprocessing of workpiece images 4.2 Workpiece Image Feature Extraction 4.3 Calculation of similarity between workpiece color and shape 4.4 Identification of artifact types; Step 5: Calculation of workpiece centroid position and angle After the CCD camera matches the corresponding target workpiece, the next step is to obtain the pose information of the matching workpiece to guide the robot to accurately grasp the target workpiece; the target pose information under the visual task includes the position information and deflection angle of the target on the two-dimensional motion plane; the centroid coordinates extracted by the shape feature are used to describe the position coordinate information of the target workpiece in the image; the deflection angle of the target is the rotation process relative to its initial template state, so the minimum circumscribed rectangle is obtained for the current target image and its corresponding category template image respectively, and the angle difference between the two rectangles in the horizontal or vertical direction is compared as the compensation angle when the robot grasps the current target workpiece; the default pattern feature on the surface of the sorting workpiece is an asymmetric figure, so the angle rotation range of the target workpiece is specified to be ±180°, so that the pose information of a single target workpiece under the 2D vision task is obtained: X_Y_A_; Step 6: Control the robot to reach the specified location and perform sorting operations If the current workpiece is a certain type of assumed qualified workpiece, adjust the machine end effector according to the position and angle calculated in step 5 and sort it to the specified channel. If it is not a certain type of workpiece to be found, jump to step 3 and continue to execute until the sorting process is completed; The similarity calculation of the workpiece color and shape includes ③ color similarity calculation, ④ shape similarity calculation, and ⑤ feature similarity fusion normalization; ③Color similarity calculation: The basic hue of the feature area after Gaussian filtering is single, there is no hue mutation, and the color distribution is uniform; considering the characteristics of the feature area, the advantages and disadvantages of the commonly used color feature description and the efficiency of the algorithm, the difference of each color channel of the simplest color histogram is used to judge the similarity of the workpiece color; the color difference calculation formula is as follows: (4) Where C is the color difference of any channel of the color histogram; n, m are the number of pixels in the x and y directions of the image; p is the average pixel difference of the image; The color histogram is used to calculate the color distance between the target image's region of interest and each color template. The smaller the distance, the higher the similarity. The category to which the target image belongs is the category represented by the color template with the smallest distance. ④ Shape similarity calculation: By comparing the centroid coordinates of the workpiece image with the centroid coordinates of the template image, it is determined whether the shape characteristics of the workpiece meet the sorting requirements. The comparison result provides the difference information between the images. The centroid coordinates of the detected workpiece image and the qualified template workpiece image can be matched and variance calculation can be performed to intuitively obtain the shape difference between the template image of the workpiece and the image to be detected, and then the workpiece classification can be performed based on the comparison of the difference image with the threshold. if =0, that is, Img (A) - Img (B) = 0, Img (A) is the centroid coordinate vector of the workpiece template, and Img (B) is the centroid coordinate vector of the workpiece image to be tested, which means that the workpiece to be tested is exactly the same as the workpiece module; but due to the existence of processing errors, It is impossible to be zero, so a threshold is set. If it is less than the threshold, it is judged to be the same workpiece, otherwise it is a different workpiece or a defective product; ⑤Feature similarity fusion normalization: To identify an object based on the color and shape features of an image, the similarity of the two feature recognitions needs to be fused. The similarity between the two color and shape feature vectors is calculated using the variance value of the numerical value. The closer it is to 0, the greater the similarity between the two features. Since the quantization units of color features and shape features are different, it is necessary to normalize the similarity distance function so that the similarity measures of the two features are normalized within the interval [0,1], thereby performing linear weighted fusion. The shape feature similarity and color feature similarity are Dc and Dt respectively, and their calculation formulas are as follows: (5) in, is the sum of the squares of the centroid coordinate differences between the object and the template image, is the sum of the squares of the template centroid coordinates, is the sum of squares of pixel differences between the object and the template image, is the square sum of the pixels of the template image; The identification of the workpiece type includes workpiece identification based on the color features and shape features of the image, and the two feature similarities need to be fused; the color feature similarity and the shape feature similarity are fused by weighted fusion to form a workpiece similarity function; the fusion rule is as follows: Assuming that the shape feature similarity and color feature similarity of the two workpieces are Dt and Dc respectively, the fusion similarity of shape feature and color feature D TC for: (6) in, is the weight of color similarity, is the weight of shape similarity, The formula is: (7) Formula (7) indicates that when one of the shape feature similarity and the color feature similarity is less than 0.5, then and are all 0, indicating that there is no similarity between the two artifacts; therefore, D TC ∈[0,1]; The artifact similarity function established according to this rule indicates that two artifacts are likely to be similar artifacts only when their shape features and color features meet a certain threshold, that is, both are greater than 0.
5. Otherwise, the two artifacts have no similarity. TC The closer it is to 1, the more similar the two workpieces are; conversely, the smaller the similarity between the two workpieces, the less likely the two workpieces are to be similar.
2. The intelligent sorting method based on product color and shape recognition according to claim 1, characterized in that: The preprocessing of the workpiece image includes filtering and denoising the acquired image using Gaussian filtering, segmenting the image into regions with different characteristics through image segmentation, and separating and extracting the foreground target in the image from the background; performing edge detection on the workpiece image, and separating the target from the background according to the detected edge region.
3. The intelligent sorting method based on product color and shape recognition according to claim 1 is characterized in that: The workpiece image feature extraction includes ① color feature extraction and ② shape feature extraction; ① Extraction of the color features: The color feature extraction method uses the color histogram. The color histogram is the most basic color feature representation method. It reflects the composition distribution of colors in the image, that is, which colors appear and the probability of color appearance; its function expression is as follows: (2) Among them, k represents the feature value of the image, L is the number of possible feature values, is the number of pixels with characteristic value k in the image, and N is the total number of image pixels; since the extraction process of this color feature does not need to consider the spatial position of the object, the similarity of the workpiece color can be judged according to the proportion of different colors described by the color histogram in the entire image; ②Extraction of shape features: The template matching method of edge centroid distance is used to extract the shape features of the workpiece. After obtaining the stable edge information of the target through preprocessing edge feature extraction, the edge centroid distance is used as the expression method of shape features; the minimum circumscribed rectangle of the target workpiece is obtained by image analysis, and the centroid coordinates of the target workpiece are obtained by analogy with the centroid principle: (3) Where n represents the number of all pixels in the bounding rectangle of the target workpiece, P i x represents the coordinate position of the current pixel in the x direction of the image. Similarly, P i y represents the coordinate position of the pixel point in the y direction of the image; next, the distance from each edge point of the target workpiece to its centroid is calculated, and all distances are sequentially constructed into a multidimensional vector as an abstract expression of the target edge, thus completing the establishment of the target template; templates of all categories of workpieces are established separately, and the above operations are performed on all target workpieces in the search image, and the matching process of the corresponding targets is completed by calculating the feature vector distance between the template workpiece and the search workpiece.
4. An intelligent sorting system based on product color and shape recognition, characterized in that: Used to implement the intelligent sorting method based on product color and shape recognition as described in any one of claims 1 to 3, including a visual signal acquisition layer, a visual signal processing layer, a visual task control layer, and a visual application layer; Visual signal acquisition layer, used to provide the system with real-time on-site pipeline visual information; A CCD camera is arranged above the conveyor belt on site. The CCD camera is used in conjunction with the robot on site to control the robot to sort workpieces. When triggered by an external signal, the visual signal is collected to obtain the color and shape information of the sorted workpiece, providing raw data for the judgment of the workpiece category and the positioning of the workpiece. Visual signal processing layer, which includes the workshop master control server, host computer, and workpiece storage master control; the visual signal processing layer is used to process and analyze the signals obtained by the visual signal acquisition layer and to provide information feedback to the upper-layer equipment to meet the visual signal requirements of each unit equipment in the workshop; Visual task control layer, which includes the unit master control; the visual task control layer is used to realize the production task scheduling and the coordinated control of the equipment in the unit, and to realize the distribution of visual tasks; it is also used to realize the visual acquisition control of each processing unit, realize the collection of on-site information and the online monitoring of equipment status information, production management information, and quality statistical information; The visual application layer includes a robot controller, which uses the results of processing and analysis by the visual signal processing layer to implement motion control on the robot on site and realize the workpiece grasping function; and can apply different applications to visual signals for different functions.
5. The intelligent sorting system based on product color and shape recognition according to claim 4, characterized in that: The visual signal acquisition layer includes a lens, a CCD camera, a light source and an image acquisition card. The light source is arranged above the workpiece on the conveyor belt, the CCD camera is located above the light source, the lens is installed on the CCD camera, the robot is located on one side of the conveyor belt, and the CCD camera is connected to the image acquisition card; the visual task control layer also includes detection tasks and workpiece transportation tasks.
6. The intelligent sorting system based on product color and shape recognition according to claim 5, characterized in that: The image acquisition card is connected to the host computer of the visual signal processing layer, the host computer is connected to the robot controller through the cloud platform, and the robot controller is connected to the robot.
