A system and method for detecting and processing weld lines of machined parts based on visual image detection
Through the visual image detection system, the brightness cluster of welding pattern pixels in the welding image is calculated, and the welding defects are judged using the region growth algorithm, which solves the problem of welding pattern uniformity detection during welding, and improves the welding quality and the service life of the workpiece.
Patent Information
- Application Number
- CN202410520266.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-04-28
AI Technical Summary
The prior art is difficult to effectively detect the uniformity of welding marks during workpiece welding, resulting in welding quality problems, such as uneven strength, pores and stress concentration, which affects the service life and safety of the workpiece.
Using a system based on visual image detection, the welding image is collected for grayscale processing, the pixel light brightness and neighborhood brightness are calculated, and the welding pattern pixel light brightness cluster is formed. The area growth algorithm is used to judge the uniformity of the welding pattern abnormality and determine the welding pattern. defect.
The system can accurately detect the uniformity of welding marks, identify the unevenness of welding areas, prevent weak strength and risk of fracture at the welding point, and improve the inspection quality and welding quality of workpieces.
Smart Images

Figure CN118297929B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image detection, and in particular to a system and method for detecting and processing weld lines of processed parts based on visual image detection. Background Art
[0002] With modern factories and modern production, some composite workpieces are often needed in the industry, and these workpieces need to be processed by welding; however, in the welding process, there are often some welding defects and defects in the uniformity of the weld line. These weld line defects will cause great problems for the workpiece during use.
[0003] At the same time, the researchers found that due to the diversity and complexity of the welding of workpieces, when inspecting the workpieces after welding, it is often impossible to correctly detect whether the weld marks have defects due to the different uniformity of the weld marks; this will also greatly affect the inspection time of the workpiece weld marks.
[0004] The uniformity of welding weld has an important influence on welding quality. The uniformity of welding texture refers to whether the distribution of welding rod or welding wire in the weld is uniform during welding. If the welding texture is uneven, the following problems may occur: The first is uneven strength: uneven welding texture will lead to uneven strength distribution of the weld. The weld in some areas may be weak and prone to cracking or detachment, which will affect the strength of the welded joint. The second is pores: uneven welding texture may also lead to the formation of pores in the weld. Areas with uneven welding texture may have problems such as unfilled welds or unremoved pores, which will reduce the sealing and strength of the welded joint. The third is stress concentration: uneven welding texture will lead to stress concentration in the welded joint. The shape and size of the weld may change, leading to stress concentration and increasing the stress concentration factor of the joint, thereby increasing the risk of fracture. During the welding process, the operator should closely monitor the formation of the welding texture and take appropriate measures to adjust the welding posture, welding speed, etc. to ensure the uniformity of the welding texture.
[0005] Research has found that there is little research on the welding uniformity of processed parts in the prior art; therefore, there is an urgent need for a processing method for detecting weld lines of processed parts to detect whether there are defects in the weld line uniformity of the workpiece. Summary of the invention
[0006] The purpose of the present invention is to provide a system and method for detecting and processing weld marks of processed parts based on visual image detection, which solves the above-mentioned technical problems pointed out in the prior art.
[0007] The present invention provides a workpiece gap detection and processing system based on visual image detection, comprising: a sample collection module, a weld mark detection module, and a weld mark determination module;
[0008] The sample acquisition module is used to obtain the welding image of the workpiece to be detected, perform grayscale processing, and obtain the grayscale image to be detected;
[0009] The welding mark detection module is used to calculate the brightness of each pixel and the brightness of the adjacent domain pixels of each pixel according to the gray value of each pixel of the grayscale image to be detected, and obtain a welding mark pixel brightness cluster; obtain a uniform abnormal welding mark cluster of the brightness of each pixel in the welding mark pixel brightness cluster; and determine whether a target uniform abnormal welding mark cluster is obtained by performing the growth of the pixel brightness of the regional growing algorithm based on the uniform abnormal welding mark cluster;
[0010] The weld mark determination module is used to determine whether the weld mark defect exists in the welding image of the workpiece to be detected according to the target uniformity abnormal weld mark cluster.
[0011] Accordingly, the present invention also provides a method for detecting and processing weld lines of a workpiece based on visual image detection, and the detection and processing is implemented by using the processing system, including the following steps:
[0012] Acquire the welding image of the workpiece to be inspected, perform grayscale processing, and obtain the grayscale image to be inspected;
[0013] Calculate the brightness of each pixel and the brightness of the adjacent pixel in the grayscale image to be detected according to the grayscale value of each pixel, and obtain a weld mark pixel brightness cluster; obtain a weld mark cluster with abnormal uniformity of the brightness of each pixel in the weld mark pixel brightness cluster; and determine whether a target weld mark cluster with abnormal uniformity is obtained by performing pixel brightness growth of a regional growing algorithm based on the weld mark cluster with abnormal uniformity;
[0014] The presence of weld line defects in the welding image of the workpiece to be inspected is determined based on the target uniformity abnormal weld line cluster.
[0015] Compared with the prior art, the embodiments of the present invention have at least the following technical advantages:
[0016] From the analysis of the above-mentioned method for detecting and processing weld marks of workpieces based on visual image detection provided by the present invention, it can be known that in specific applications, the brightness of the pixel points is determined by determining the grayscale values of each pixel point of the grayscale image to be detected, and the brightness of the pixel points can be used to determine which welding areas of the welding image of the workpiece to be detected may have abnormal conditions or no abnormal conditions; and by clustering the brightness of the pixel points to form a number of abnormal pixel point brightness clusters, it can be determined whether there are welding areas on the grayscale image to be detected or at which positions there are welding areas; and by clustering the abnormal pixel point brightness clusters again to form a number of weld mark pixel point brightness clusters, it is determined which welding areas have uneven weld marks, and whether there is a risk of weak strength and fracture at the weld due to uneven weld marks;
[0017] Furthermore, the Euclidean distances of adjacent high-brightness pixels are calculated through the high-brightness pixels inside the weld mark pixel brightness cluster, and the average Euclidean distance is obtained by calculating the brightness Euclidean distances of all two adjacent high-brightness pixels. In this way, the pixel distribution of the weld mark condition of the weld mark pixel brightness cluster can be determined, and the larger the average Euclidean distance of the high-brightness pixels of the weld mark pixel brightness cluster is, the greater the possibility that the weld mark of the weld mark pixel brightness cluster in the welding area has uneven defects, and the smaller the average Euclidean distance of the high-brightness pixels of the weld mark pixel brightness cluster is, the smaller the possibility that the weld mark of the weld mark pixel brightness cluster in the welding area has uneven defects.
[0018] Furthermore, by selecting the weld mark pixel brightness cluster with the largest average Euclidean distance as the uniformity abnormal weld mark cluster, and selecting the pixel point with the minimum brightness within the uniformity abnormal weld mark cluster to grow the pixel seed point of the regional growing algorithm, when the brightness of the pixel seed point is less than or equal to the brightness of the adjacent pixel point, the growth is stopped, and the weld mark pixel brightness cluster with the average Euclidean distance is reselected as the uniformity abnormal weld mark cluster, and the pixel seed point growth of the regional growing algorithm is continued; if the pixel seed point with the minimum brightness within the selected uniformity abnormal weld mark cluster is completely grown, the uniformity abnormal weld mark cluster of the weld mark pixel brightness cluster is determined to be the target uniformity abnormal weld mark cluster, and according to the target uniformity abnormal weld mark cluster, it is determined that there is a weld mark defect in the welding image of the workpiece to be inspected.
[0019] In summary, the above-mentioned workpiece weld mark detection and processing system and method can systematically and accurately detect the uniformity of the weld mark of the workpiece, determine whether there is a defect of uneven welding texture, and ultimately ensure the inspection quality of the workpiece. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 An overall flow chart of a method for detecting and processing weld marks of a workpiece based on visual image detection provided in Embodiment 1 of the present invention;
[0022] Figure 2 A logic flow chart of a method for detecting and processing weld marks of a workpiece based on visual image detection provided in the first embodiment of the present invention;
[0023] Figure 3A welding diagram of a welding line detection method for a workpiece based on visual image detection provided in the first embodiment of the present invention;
[0024] Figure 4 A flowchart of obtaining weld mark defects by using the average Euclidean distance of weld mark pixel brightness clusters in a weld mark detection and processing method for a workpiece based on visual image detection provided in Embodiment 1 of the present invention;
[0025] Figure 5 A flowchart of updating and selecting the average Euclidean distance of the brightness clusters of weld mark pixels in a method for detecting and processing weld marks of a workpiece based on visual image detection provided in the first embodiment of the present invention;
[0026] Figure 6 A flow chart of a workpiece gap detection and processing system based on visual image detection provided in the second embodiment of the present invention.
[0027] Markings: sample collection module 10, weld mark detection module 20, weld mark determination module 30. DETAILED DESCRIPTION
[0028] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0029] The present invention is further described in detail below through specific embodiments in conjunction with the accompanying drawings.
[0030] Embodiment 1
[0031] like Figure 1 , 2 As shown in , 3, the present invention proposes a method for detecting and processing weld lines of a workpiece based on visual image detection, which specifically includes the following steps:
[0032] S1: Acquire the welding image of the workpiece to be inspected, perform grayscale processing, and obtain the grayscale image to be inspected;
[0033] S2: Calculate the brightness of each pixel and the brightness of the adjacent pixel in the grayscale image to be detected according to the grayscale value of each pixel to obtain a weld mark pixel brightness cluster; obtain a weld mark cluster with abnormal uniformity of the brightness of each pixel in the weld mark pixel brightness cluster; and determine whether a target weld mark cluster with abnormal uniformity is obtained by performing a pixel brightness growth algorithm based on the weld mark cluster with abnormal uniformity;
[0034] S3: Determine whether the welding image of the workpiece to be inspected has weld line defects based on the target uniformity abnormal weld line cluster.
[0035] It should be noted that the brightness of the pixel is calculated by the gray value of the gray image to be detected, and the final weld mark pixel brightness cluster is obtained by multiple clustering of the pixel brightness. The weld mark condition of the weld image of the workpiece to be detected is understood through the weld mark pixel brightness cluster, and it is judged whether there are defects in the weld mark in different trajectories and shapes; the average Euclidean distance of all adjacent high-brightness pixels in the weld mark pixel brightness cluster is calculated, and all the average Euclidean distances are sorted in descending order, and the weld mark pixel brightness cluster with the largest average Euclidean distance is selected as the uniformity abnormal weld mark cluster for the growth of pixel seeds of the regional growing algorithm;
[0036] When the pixel seed point is completely grown in the uniformity abnormal weld mark cluster, the target uniformity abnormal weld mark cluster is obtained, and the presence of weld mark defects in the welding image of the workpiece to be detected is determined based on the target uniformity abnormal weld mark cluster; if the pixel seed point cannot be completely grown in the uniformity abnormal weld mark cluster, the weld mark pixel point brightness cluster with the average Euclidean distance is reselected as the uniformity abnormal weld mark cluster for the growth of pixel seeds of the regional growing algorithm. If it still cannot grow, it is determined that the welding image of the workpiece to be detected has no weld mark defects.
[0037] Specifically, Figure 4 As shown, in step S2, a uniform abnormal weld pattern cluster of the brightness of each pixel in the weld pattern pixel brightness cluster is obtained; based on the uniform abnormal weld pattern cluster, the pixel brightness growth of the regional growing algorithm is performed to determine whether a target uniform abnormal weld pattern cluster is obtained. The specific operation steps are as follows:
[0038] S21: traverse and calculate the grayscale value of each pixel point of the grayscale image to be detected, and determine the brightness of the pixel point through the grayscale value of the pixel point; cluster the brightness of the same pixel points in adjacent domains through the brightness of the pixel point to obtain a number of abnormal pixel brightness clusters with the same brightness (that is, the abnormal pixel brightness cluster is the welding area that may exist in the grayscale image to be detected); cluster the abnormal pixel brightness clusters with the same brightness in adjacent domains again for the abnormal pixel brightness clusters to obtain a number of different types of weld mark pixel brightness clusters (that is, different types of weld mark pixel brightness clusters refer to the weld mark conditions of the welding area of the grayscale image to be detected, and the two most common shapes of weld mark conditions mainly include: long strip weld marks and circular weld marks);
[0039] It should be noted that the brightness of the pixels is clustered by the same brightness between the pixels in adjacent domains to obtain several abnormal pixel brightness clusters, and the abnormal pixel brightness cluster is the welding area that may exist in the grayscale image to be detected (that is, during clustering, it is found that the pixels with the same brightness in the normal area image are uniform, but the distribution density of the pixels with the same brightness in the welding area is larger, which is greater than the standard density threshold, so it can be initially judged that the current area is a possible welding area); and further, the abnormal pixel brightness cluster is used to cluster the same abnormal pixels in the adjacent domains again to obtain the weld mark pixel brightness cluster. The brightness cluster further determines the weld condition of the welding area of the grayscale image to be detected. The size and shape of the weld mark pixel brightness cluster can indicate whether the strength of the weld mark is good. If the pixels within the weld mark pixel brightness cluster are more densely distributed, it indicates that the weld mark strength is good. If the pixels within the weld mark pixel brightness cluster are more dispersed, it indicates that the strength of the weld mark may be at risk of breaking (research shows that the weld mark condition can be divided into long strip weld marks and round or circular weld marks, that is, by clustering the same abnormal pixels in adjacent domains through abnormal pixel brightness clusters, the weld mark pixel brightness clusters in the grayscale image to be detected can be identified, which is commonly known as the weld mark condition).
[0040] S22: For the different types of weld mark pixel brightness clusters, the corresponding preset pixel brightness threshold q (research shows that the preset pixel brightness threshold q values of the weld mark pixel brightness clusters corresponding to the long strip weld mark and the circular weld mark are not the same), if the brightness of each pixel in the weld mark pixel brightness cluster is greater than the corresponding preset pixel brightness threshold q, then the brightness of the pixel is a high-brightness pixel; if the brightness of each pixel in the weld mark pixel brightness cluster is less than or equal to the corresponding preset pixel brightness threshold q, then the brightness of the pixel is a low-brightness pixel;
[0041] The calculation formula for calculating the average Euclidean distance of all high-brightness pixel points in the current weld mark pixel brightness cluster is (i.e., an example is given to calculate the average Euclidean distance of all two adjacent high-brightness pixel points in the i-th weld mark pixel brightness cluster):
[0042]
[0043] In the formula, ω i is the average Euclidean distance between all two adjacent high-brightness pixels in the ith weld pixel brightness cluster, Wi represents the number of high-brightness pixels in the ith weld pixel brightness cluster, represents the Euclidean distance between the Wi-th high-brightness pixel and its adjacent high-brightness pixel, It represents the sum of the Euclidean distances of all two adjacent high-brightness pixels, and exp{} represents a function with a natural constant as the base.
[0044] Explanation: The above formula can be used to calculate the average Euclidean distance of all high-brightness pixel points in the current (i-th or j-th, etc.) weld mark pixel brightness cluster; the average Euclidean distance of all two adjacent high-brightness pixel points in the i-th weld mark pixel brightness cluster is a group of data, and the average Euclidean distance of all two adjacent high-brightness pixel points in the j-th weld mark pixel brightness cluster is a group of data. According to this formula, the average Euclidean distance of all two adjacent high-brightness pixel points in several groups of i-th (j or n) weld mark pixel brightness clusters can be obtained, and the distance set L{ω1, ω2…ω n}, and recorded as the average Euclidean distance of all weld pixel brightness clusters;
[0045] Then, the average Euclidean distances of all the weld mark pixel brightness clusters in the distance set are descended to establish a weld mark cluster to be evaluated list; the weld mark pixel brightness cluster with the largest average Euclidean distance that is first in the arrangement order of the weld mark cluster to be evaluated list is selected as the uniformity abnormal weld mark cluster to be verified (for example, assuming that in the above distance set, the average Euclidean distance of all two adjacent high-brightness pixels in the nth weld mark pixel brightness cluster (i.e., ω n ) as the largest value in the distance set L); then the nth weld mark pixel brightness cluster is selected as the uniformity abnormal weld mark cluster to be verified.
[0046] Preferably, in the specific implementation process, it is necessary to further determine that the weld mark pixel brightness cluster with the largest average Euclidean distance that is first in the weld mark cluster to be evaluated list is the uniformity abnormal weld mark cluster to be verified, and continue the verification process, specifically including:
[0047] Performing pixel seed point growth of a regional growing algorithm through the minimum pixel brightness value inside the uniformity abnormal weld pattern cluster to be verified;
[0048] If the corresponding pixel seed point (i.e. the pixel seed point corresponding to the minimum pixel brightness value inside the uniformity abnormal weld pattern cluster to be verified) can diffuse and cover all the pixel points inside the weld pattern pixel brightness cluster after growth, the target uniformity abnormal weld pattern cluster is obtained;
[0049] If the corresponding pixel seed point (i.e. the pixel seed point corresponding to the minimum pixel brightness value inside the uniformity abnormal weld pattern cluster to be verified) stops growing without spreading to all the pixels inside, then the current uniformity abnormal weld pattern cluster to be verified is determined to be a non-target uniformity abnormal weld pattern cluster (no subsequent processing operations will be performed); from then on, the weld pattern pixel brightness clusters in the evaluation list will continue to be determined as uniformity abnormal weld pattern clusters to be verified one by one in the order of the list arrangement.
[0050] Through the above embodiment, the weld mark pixel brightness cluster corresponding to the current largest average Euclidean distance is selected to be determined as the weld mark cluster with uniformity abnormality to be verified, and the verification process is started. Then, the weld mark pixel brightness cluster corresponding to the second average Euclidean distance (that is, the average Euclidean distance of the subsequent weld mark pixel brightness clusters that are first in the list of weld mark clusters to be evaluated) is verified, and then the weld mark pixel brightness cluster corresponding to the third largest average Euclidean distance is verified, and then until the Nth weld mark pixel brightness cluster to be verified, the target uniformity abnormal weld mark cluster is obtained; that is, the weld mark cluster with uniformity abnormality to be verified is ready for further verification processing.
[0051] It should be noted that the brightness of each pixel in the weld mark pixel brightness cluster is determined to be high brightness or low brightness by a preset pixel brightness threshold p; the distribution of pixel brightness in the weld mark pixel brightness cluster is determined as the average value of the Euclidean distance between adjacent high-brightness pixels, the strength of the weld mark is determined by the distribution of the pixel brightness, a weld mark cluster evaluation list is constructed based on the average Euclidean distance of the pixel brightness in all weld mark pixel brightness clusters, and the average Euclidean distance in the weld mark cluster evaluation list is sorted in descending order from large to small;
[0052] When the average Euclidean distance of the pixel brightness in the weld mark pixel brightness cluster is larger, it means that the pixel brightness in the weld mark pixel brightness cluster is more dispersed, and the more dispersed the pixel brightness is, the weaker the strength of the weld mark in the weld mark pixel brightness cluster is; therefore, the weld mark pixel brightness cluster with the largest average Euclidean distance in the weld mark cluster to be evaluated list is selected as the uniformity abnormal weld mark cluster to be verified, indicating that the weld mark pixel brightness cluster with the largest average Euclidean distance has the greatest possibility of having weld mark defects among all weld mark pixel brightness clusters; high-brightness pixels can more effectively determine which welding areas of weld mark pixel brightness clusters have weld marks;
[0053] S23: Performing a regional growing algorithm on the brightness of each pixel in the uniformity abnormal weld pattern cluster to be verified; calculating the brightness value of the pixel brightness, selecting the minimum brightness value of the pixel brightness as the pixel seed point, and performing adjacent domain growth on the pixel seed point; comparing the brightness values of the pixels in the adjacent domain by the minimum pixel brightness value, if the brightness value of the pixel in the adjacent domain is greater than the pixel seed point, then performing a growth diffusion on the brightness of the pixels in the adjacent domain, and using the brightness of the pixels in the adjacent domain that grows and diffuses as the growth pixel point;
[0054] If the pixel brightness value of the adjacent domain is equal to the pixel seed point, it is determined that the pixel seed point stops growing, and the weld pattern pixel brightness cluster of the uniformity abnormal weld pattern cluster to be verified is removed, and the deleted uniformity abnormal weld pattern cluster to be verified is determined as a non-target uniformity abnormal weld pattern cluster; the weld pattern cluster to be evaluated list is updated, and the uniformity abnormal weld pattern cluster is reselected in descending order from the weld pattern cluster to be evaluated list, and the pixel seed point of the reselected uniformity abnormal weld pattern cluster is grown;
[0055] Further comparison is made on whether the brightness of the growing pixel point is less than the brightness value of the adjacent domain pixel point. If the brightness of the growing pixel point is less than the brightness value of the adjacent domain pixel point, the growing pixel point continues to grow until it can diffuse to all the pixel points inside the weld mark pixel point brightness cluster after M growths (that is, in fact, after the above multiple growth and diffusions, it can continue to grow until it diffuses to all the pixel points inside the weld mark pixel point brightness cluster, but the present application believes that it is not necessary to identify the situation where the growth diffuses outside the weld mark pixel point brightness cluster. Therefore, until it can diffuse to all the pixel points inside the weld mark pixel point brightness cluster after multiple growths, it can be determined that the target uniformity abnormal weld mark cluster is obtained). Then, it is determined that the pixel seed point can diffuse and cover all the pixel points inside the weld mark pixel point brightness cluster after growth, and the target uniformity abnormal weld mark cluster is obtained;
[0056] It should be noted that, in the M growth processes, if the stop generation condition only occurs once, that is, it only occurs once, if the brightness of the growing pixel point is greater than or equal to the brightness value of the pixel point in the adjacent domain, the growing pixel point stops growing, and then the weld pattern pixel point brightness cluster of the weld pattern cluster with abnormal uniformity to be verified is removed, and the deleted weld pattern cluster with abnormal uniformity to be verified is determined as a non-target weld pattern cluster with abnormal uniformity, and the list of weld pattern clusters to be evaluated after the deletion is updated to obtain an updated list of weld pattern clusters to be evaluated;
[0057] It should be noted that, starting from this, the pixel brightness clusters of the weld pattern in the updated weld pattern cluster to be evaluated list are continuously determined one by one as the uniformity abnormal weld pattern clusters to be verified in the order of the list arrangement, specifically, the uniformity abnormal weld pattern clusters to be verified are reselected in descending order from the updated weld pattern cluster to be evaluated list, and pixel seed points are grown for the reselected uniformity abnormal weld pattern clusters to be verified;
[0058] S24: determining whether the weld line defect exists in the weld line image of the workpiece to be inspected by using the target uniformity abnormal weld line cluster;
[0059] It should be noted that the presence of a welding area in the grayscale image to be detected is determined by using several abnormal pixel brightness clusters, and the abnormal pixel brightness clusters are clustered to form a weld mark pixel brightness cluster as the weld mark condition of the welding area in the grayscale image to be detected;
[0060] The pixel brightness of the uniformity abnormal weld pattern cluster to be verified is grown through the growth area algorithm, and the pixel with the smallest pixel brightness value in the uniformity abnormal weld pattern cluster to be verified is selected as the growth seed. The smallest pixel brightness can reflect the uniformity of the weld pattern of the uniformity abnormal weld pattern cluster to be verified. When the pixel brightness value is larger, the larger the uneven defect of the weld pattern is; when the pixel brightness value is smaller, the smaller the uneven defect of the weld pattern is; therefore, the smallest pixel brightness value is selected for gradual expansion and growth to reflect the uniformity of the weld pattern pixel brightness cluster. The weld defect situation; and after the pixel brightness of the regular weld cluster grows from the minimum pixel brightness value to the maximum pixel brightness value in the first step, the target uniformity abnormal weld cluster can be obtained (that is, the target uniformity abnormal weld cluster can not only be determined as the weld defect problem of the weld image of the workpiece to be detected; at the same time, it can also be determined that the irregular tree shape is formed after the pixel seed point is fully grown, indicating that the weld image of the workpiece to be detected has a long strip weld defect or a circular weld defect), and the target uniformity abnormal weld cluster is determined as the weld defect problem of the weld image of the workpiece to be detected;
[0061] When the pixel seed point in the weld mark pixel brightness cluster meets the growth condition, it will continue to grow until the growth covers all the pixel points inside the weld mark cluster with abnormal uniformity to be verified, and the target weld mark cluster with abnormal uniformity is obtained. When the target weld mark cluster with abnormal uniformity is obtained, it indicates that there is a weld mark defect problem in the weld mark image of the workpiece to be detected; when the condition is not met, the weld mark pixel brightness cluster is removed. The weld mark pixel brightness cluster of the weld mark cluster with abnormal uniformity to be verified that does not meet the growth condition indicates that there is no welding area or the weld condition of the welding area is good, and the greater the pixel brightness, the greater the possibility of uneven defects in the weld, and there may be defects such as weak strength and easy breakage of the weld. Therefore, when the growth condition is not met, the smaller the pixel brightness, the more stable the weld uniformity of the weld.
[0062] Specifically, Figure 5 As shown, in step S23, if the brightness of the growing pixel point is greater than or equal to the brightness value of the adjacent domain pixel point, the growing pixel point stops growing, and the weld pattern pixel point brightness cluster of the weld pattern cluster with abnormal uniformity to be verified is removed, and the weld pattern cluster with abnormal uniformity is reselected in descending order from the list of weld pattern clusters to be evaluated, and the pixel seed point is grown for the reselected weld pattern cluster with abnormal uniformity. The specific operation steps are as follows:
[0063] S231: in the original list of weld mark clusters to be evaluated, the weld mark clusters with uniformity abnormality to be deleted are obtained to obtain an updated list of weld mark clusters to be evaluated (i.e., equivalent to deleting the weld mark cluster with uniformity abnormality ranked first and waiting for the updated list of weld mark clusters to be evaluated); the average value of the average Euclidean distance of all weld mark pixel brightness clusters in the updated list of weld mark clusters to be evaluated is calculated (i.e., equivalent to updating the parameters related to the entire list), and the average value is set as the update threshold r (i.e., judging whether the average Euclidean distance of all weld mark pixel brightness clusters in the list of weld mark clusters to be evaluated is greater than the update threshold r, because the larger the average Euclidean distance, the more likely it is that the weld mark pixel brightness cluster has weld mark defects, and the smaller the average Euclidean distance, the more likely it is that the weld mark defect exists in the weld mark pixel brightness cluster. It indicates that the brightness cluster of the weld mark pixel point does not exist in the welding area or the weld mark condition in the welding area is good. The average Euclidean distance is continuously updated by judging the update threshold r. When it is less than or equal to the update threshold r, the weld mark pixel point brightness cluster with the average Euclidean distance less than or equal to the update threshold r will not have the problem of weld mark defects. The average Euclidean distance is selected in descending order in the list of weld mark clusters to be evaluated. The subsequent average Euclidean distances of the average Euclidean distance less than or equal to the update threshold r do not need to be updated (that is, the smaller the average Euclidean distance, the more it indicates that the brightness cluster of the weld mark pixel point does not exist in the welding area or the weld mark condition in the welding area is good. In descending order, the average Euclidean distance will become smaller and smaller, and the uniformity of the weld mark will become better and better. Therefore, when it is less than or equal to the update threshold r, stop updating);
[0064] S232: determining one by one in descending order whether the average Euclidean distances of the weld mark pixel brightness clusters in the updated list of weld mark clusters to be evaluated are greater than the update threshold r (that is, because the weld mark pixel brightness cluster of the average Euclidean distance is the largest average Euclidean distance in the list of weld mark clusters to be evaluated, it will not be affected by the update threshold r of the average value of all average Euclidean distances, so in step S22, there is no need to set the update threshold r of the average value of all average Euclidean distances to compare the average Euclidean distances, and during the updating process, the second average Euclidean distance is compared to see whether it is greater than the update threshold r);
[0065] If the average Euclidean distance of the second in the descending order of the list of weld pattern clusters to be evaluated is greater than the update threshold r, then select the weld pattern pixel brightness cluster with the average Euclidean distance of the second in the list of weld pattern clusters to be evaluated as the weld pattern cluster with uniformity abnormality to be verified, and perform pixel seed point growth of the region growing algorithm on the weld pattern cluster with uniformity abnormality to be verified; select the pixel with the smallest brightness value as the pixel seed point, perform adjacent domain growth on the pixel seed point, and if the pixel brightness value of the adjacent domain is greater than the pixel seed point, then perform growth diffusion on the pixel brightness of the adjacent domain;
[0066] S233: If the brightness value of the pixel point in the adjacent domain is equal to the pixel seed point, the pixel seed point stops growing, and the weld pattern pixel brightness cluster of the uniformity abnormal weld pattern cluster to be verified is removed, and the deleted uniformity abnormal weld pattern cluster to be verified is determined as a non-target uniformity abnormal weld pattern cluster; and return to the above step S232, update the updated list of weld pattern clusters to be evaluated again, and continue to select subsequent average Euclidean distances in descending order from the updated list of weld pattern clusters to be evaluated, until the pixel seed point of the uniformity abnormal weld pattern cluster to be verified is grown M times by the regional growing algorithm to obtain the target uniformity abnormal weld pattern cluster;
[0067] S234: If the pixel seed point of the region growing algorithm for the uniformity abnormal weld pattern cluster to be verified is still a non-target uniformity abnormal weld pattern cluster, the subsequent average Euclidean distances are continuously selected in descending order from the list of weld pattern clusters to be evaluated after being updated again, until the average Euclidean distance of the Nth weld pattern pixel brightness cluster is selected as the pixel seed point of the region growing algorithm for the uniformity abnormal weld pattern cluster to be verified to obtain the target uniformity abnormal weld pattern cluster;
[0068] If the average Euclidean distance of the weld mark pixel brightness cluster is less than or equal to the update threshold r in the subsequent average Euclidean distances selected in descending order from the updated weld mark cluster to be evaluated list, stop selecting the average Euclidean distance of the weld mark pixel brightness cluster in the updated weld mark cluster to be evaluated list, and output the result of the previous non-target uniformity abnormal weld mark cluster, which is no weld mark defect.
[0069] It should be noted that the average Euclidean distances of all the weld mark pixel brightness clusters in the updated weld mark cluster to be evaluated list are sorted in descending order, and the average of all the average Euclidean distances is calculated, and the update threshold r is set according to the average value;
[0070] The updated weld mark cluster to be evaluated list is selected from the weld mark pixel point brightness cluster of the second average Euclidean distance to determine whether it is greater than the update threshold r. If it is greater than the update threshold r, the weld mark pixel point brightness cluster of the second average Euclidean distance is used as the uniformity abnormal weld mark cluster to be verified; and the pixel seed point growth of the uniformity abnormal weld mark cluster to be verified is performed by the regional growing algorithm. If it still cannot be fully grown, the average Euclidean distance in the weld mark cluster to be evaluated list is continuously selected for updating, and compared to see whether it is greater than the update threshold r, until the average Euclidean distance of the Nth weld mark pixel point brightness cluster is updated as the uniformity abnormal weld mark cluster to be verified, and the pixel seed point growth of the regional growing algorithm is performed to obtain the target uniformity abnormal weld mark cluster;
[0071] If in the process of updating the average Euclidean distance of the Nth weld mark pixel point brightness cluster, the average Euclidean distance of a certain weld mark pixel point brightness cluster is less than or equal to the update threshold r, then the growth result of the pixel seed point of the weld mark cluster with abnormal uniformity to be verified is output; if the pixel seed point of the weld mark cluster with abnormal uniformity to be verified is completely grown, it is determined to be the target weld mark cluster with abnormal uniformity, and the target weld mark cluster with abnormal uniformity is a weld mark defect; if the pixel seed point of the weld mark cluster with abnormal uniformity to be verified cannot be completely grown, then the result of the weld mark cluster with abnormal uniformity to be verified is a non-target weld mark cluster with abnormal uniformity, and there is no weld mark defect in the non-target weld mark cluster with abnormal uniformity.
[0072] In summary, the present invention proposes a method for detecting and processing weld marks of workpieces based on visual image detection. The method calculates the grayscale value of each pixel of the grayscale image to be detected, determines the brightness of the pixel by the grayscale value of the pixel, and determines which welding areas of the welding image of the workpiece to be detected may have abnormal conditions or no abnormal conditions by the brightness of the pixel; and forms a number of abnormal pixel brightness clusters by clustering the brightness of the pixel, and determines whether there are welding areas or positions of the welding areas on the grayscale image to be detected by the abnormal pixel brightness clusters; and forms a number of weld mark pixel brightness clusters by clustering the abnormal pixel brightness clusters again, determines which welding areas have weld mark conditions, determines whether the weld mark is uniform by the weld mark conditions, and determines whether the weld mark image of the workpiece to be detected has a risk of fracture by the uniformity of the weld mark;
[0073] Furthermore, the Euclidean distances of adjacent high-brightness pixels are calculated through the high-brightness pixels inside the weld mark pixel brightness cluster, and the average Euclidean distance is obtained by calculating the brightness Euclidean distances of all two adjacent high-brightness pixels. In this way, the pixel distribution of the weld mark condition of the weld mark pixel brightness cluster can be determined, and the larger the average Euclidean distance of the high-brightness pixels of the weld mark pixel brightness cluster is, the greater the possibility that the weld mark of the weld mark pixel brightness cluster in the welding area has defects, and the smaller the average Euclidean distance of the high-brightness pixels of the weld mark pixel brightness cluster is, the smaller the possibility that the weld mark of the weld mark pixel brightness cluster in the welding area has defects.
[0074] Furthermore, the average Euclidean distance of all high-brightness pixel points in several groups of current weld mark pixel brightness clusters is obtained to obtain a distance set of the average Euclidean distance of all high-brightness pixel points in all weld mark pixel brightness clusters, and record it as the average Euclidean distance of all weld mark pixel brightness clusters; the average Euclidean distances of all weld mark pixel brightness clusters in the distance set are sorted in descending order to construct a list of weld mark clusters to be evaluated; the uniformity abnormal weld mark cluster is determined from the average Euclidean distances of all weld mark pixel brightness clusters in the weld mark cluster to be evaluated. That is, by selecting the weld mark pixel brightness cluster with the largest average Euclidean distance as the weld mark cluster with abnormal uniformity to be verified, and selecting the pixel point with the minimum brightness from the pixel points inside the weld mark cluster with abnormal uniformity to be verified for the growth of the pixel seed point of the regional growing algorithm, when the brightness of the pixel seed point is less than or equal to the brightness of the adjacent pixel point, the growth is stopped, and the average Euclidean distance of the weld mark pixel brightness cluster is deleted, and the list of weld mark clusters to be evaluated after the deletion is updated; and the weld mark pixel brightness cluster with the average Euclidean distance in the updated list of weld mark clusters to be evaluated is reselected in descending order as the weld mark cluster with abnormal uniformity to be verified; if the pixel seed point of the brightness of the pixel point with the minimum brightness in the reselected weld mark cluster with abnormal uniformity is completely grown, the weld mark cluster with abnormal uniformity to be verified of the weld mark pixel brightness cluster is determined to be the target weld mark cluster with abnormal uniformity, and the weld mark defect is determined to be present in the weld image of the workpiece to be detected according to the target weld mark cluster with abnormal uniformity; if the pixel seed point of the brightness of the pixel point with the minimum brightness still cannot be completely grown, the weld image of the workpiece to be detected has no weld mark defect.
[0075] In summary, the above-mentioned workpiece weld mark detection and processing system and method can systematically and accurately detect the uniformity of the weld mark of the workpiece, determine whether there is a defect of uneven welding texture, and ultimately ensure the inspection quality of the workpiece.
[0076] Embodiment 2
[0077] like Figure 6 As shown, accordingly, the present invention also proposes a workpiece gap detection and processing system based on visual image detection, comprising: a sample collection module 10, a weld mark detection module 20, and a weld mark determination module 30;
[0078] The sample acquisition module 10 is used to acquire the welding image of the workpiece to be detected, perform grayscale processing, and obtain the grayscale image to be detected;
[0079] The welding mark detection module 20 is used to calculate the brightness of each pixel and the brightness of the adjacent domain pixels of each pixel based on the gray value of each pixel of the grayscale image to be detected, and obtain a welding mark pixel brightness cluster; obtain a uniform abnormal welding mark cluster of the brightness of each pixel in the welding mark pixel brightness cluster; and perform a pixel brightness growth of a regional growing algorithm based on the uniform abnormal welding mark cluster to determine whether a target uniform abnormal welding mark cluster is obtained;
[0080] The weld mark determination module 30 is used to determine whether there are weld mark defects in the welding image of the workpiece to be detected according to the target uniformity abnormal weld mark cluster.
[0081] In a specific solution of this embodiment, the weld mark detection module specifically includes a clustering processing module and a uniformity determination module;
[0082] The clustering processing module is used to traverse and calculate the grayscale value of each pixel point of the grayscale image to be detected, and determine the brightness of the pixel point by the grayscale value of the pixel point; cluster the brightness of the same pixel points in adjacent domains by the brightness of the pixel point to obtain a number of abnormal pixel brightness clusters with the same brightness; cluster the abnormal pixel brightness clusters with the same brightness in adjacent domains again to obtain a number of different types of weld mark pixel brightness clusters;
[0083] The uniformity determination module is used to calculate the average Euclidean distance of all adjacent high-brightness pixels within the plurality of weld mark pixel brightness clusters, and determine the uniformity abnormal weld mark cluster according to the average Euclidean distance of all adjacent high-brightness pixels.
[0084] In a specific solution of this embodiment, the uniformity determination module specifically includes a first processing module, a first calculation module and a second processing module;
[0085] The first processing module is used to correspond the preset pixel brightness threshold q to the different types of the weld mark pixel brightness clusters; if the brightness of each pixel in the weld mark pixel brightness cluster is greater than the corresponding preset pixel brightness threshold q, the pixel brightness is a high-brightness pixel; if the brightness of each pixel in the weld mark pixel brightness cluster is less than or equal to the corresponding preset pixel brightness threshold q, the pixel brightness is a low-brightness pixel;
[0086] The first calculation module is used to calculate the Euclidean distance between two adjacent high-brightness pixels in the current weld mark pixel brightness cluster, and calculate the average Euclidean distance of all high-brightness pixels in the current weld mark pixel brightness cluster;
[0087] The second processing module is used to obtain the average Euclidean distance of all high-brightness pixel points in several groups of current weld mark pixel brightness clusters, obtain a distance set of the average Euclidean distance of all high-brightness pixel points in all weld mark pixel brightness clusters, and record it as the average Euclidean distance of all weld mark pixel brightness clusters; descend the average Euclidean distances of all weld mark pixel brightness clusters in the distance set to construct a list of weld mark clusters to be evaluated; determine the uniformity abnormal weld mark cluster from the average Euclidean distances of all weld mark pixel brightness clusters in the list of weld mark clusters to be evaluated.
[0088] Among them, the uniformity determination module specifically also includes a third processing module; the third processing module is used to further determine that the weld mark pixel brightness cluster with the largest average Euclidean distance that is first in the arrangement order of the weld mark clusters to be evaluated is the uniformity abnormal weld mark cluster to be verified; the pixel seed point growth of the regional growing algorithm is performed through the minimum pixel brightness value inside the weld mark cluster to be verified; if the corresponding pixel seed point can diffuse and cover all the pixel points inside the weld mark pixel brightness cluster after growth, the target uniformity abnormal weld mark cluster is obtained; if the corresponding pixel seed point does not diffuse to all the pixel points inside after growth and stops growing, it is determined that the current uniformity abnormal weld mark cluster to be verified is a non-target uniformity abnormal weld mark cluster; starting from this, the weld mark pixel brightness clusters in the list to be evaluated are continuously determined one by one as uniformity abnormal weld mark clusters to be verified according to the list arrangement order.
[0089] The third processing module further includes a diffusion submodule, a growth processing submodule, an iterative update processing submodule and a determination submodule:
[0090] The diffusion submodule is used to obtain a target uniformity abnormal weld pattern cluster if the corresponding pixel seed point can diffuse and cover all the pixel points inside the weld pattern pixel point brightness cluster after growth; if the corresponding pixel seed point stops growing without diffusing to all the pixel points inside, the uniformity abnormal weld pattern cluster to be verified is determined to be a non-target uniformity abnormal weld pattern cluster;
[0091] The growth processing submodule is used to grow the brightness of each pixel in the uniformity abnormal weld pattern cluster to be verified by the regional growing algorithm; calculate the brightness value of the pixel brightness, select the brightness value of the pixel with the minimum brightness as the pixel seed point, and grow the adjacent domain of the pixel seed point; compare the brightness value of the adjacent domain pixel by the minimum pixel brightness value; if the brightness value of the pixel in the adjacent domain is greater than the pixel seed point, then grow and diffuse the brightness of the pixel in the adjacent domain, and use the brightness of the pixel in the adjacent domain that grows and diffuses as the growth pixel;
[0092] The iterative update processing submodule is used to determine that the pixel seed point stops growing if the brightness value of the pixel point in the adjacent domain is equal to the pixel seed point, and remove the weld pattern pixel brightness cluster of the uniformity abnormal weld pattern cluster to be verified, and determine the deleted uniformity abnormal weld pattern cluster to be verified as a non-target uniformity abnormal weld pattern cluster; update the list of weld pattern clusters to be evaluated, and reselect the uniformity abnormal weld pattern clusters in descending order from the list of weld pattern clusters to be evaluated, and grow the pixel seed points of the reselected uniformity abnormal weld pattern clusters;
[0093] The determination submodule is used to further compare whether the brightness of the growing pixel point is less than the brightness value of the adjacent domain pixel point. If the brightness of the growing pixel point is less than the brightness value of the adjacent domain pixel point, the growing pixel point continues to grow until it can diffuse to all the pixel points inside the weld mark pixel point brightness cluster after M growths. It is then determined that after the pixel seed point grows, it can diffuse and cover all the pixel points inside the weld mark pixel point brightness cluster to obtain a target uniformity abnormal weld mark cluster; the target uniformity abnormal weld mark cluster is used to determine whether the weld mark image of the workpiece to be inspected has a weld mark defect.
[0094] In the specific scheme of this embodiment, the iterative update processing submodule further includes an updating unit and a determining unit when executing "updating the list of weld pattern clusters to be evaluated, and reselecting the weld pattern clusters with abnormal uniformity in descending order from the list of weld pattern clusters to be evaluated, and growing pixel seed points for the reselected weld pattern clusters with abnormal uniformity":
[0095] The updating unit is used to obtain an updated list of weld pattern clusters to be evaluated by deleting the weld pattern clusters with abnormal uniformity to be verified from the original list of weld pattern clusters to be evaluated; calculating the average value of the average Euclidean distances of the average Euclidean distances of all weld pattern pixel brightness clusters in the updated list of weld pattern clusters to be evaluated, and setting the average value as the update threshold r;
[0096] The determination unit is used to determine whether the average Euclidean distances of the brightness clusters of the weld mark pixels in the updated list of weld mark clusters to be evaluated are greater than an update threshold value r one by one in descending order;
[0097] If the average Euclidean distance of the second in the descending order of the list of weld pattern clusters to be evaluated is greater than the update threshold r, then select the weld pattern pixel brightness cluster with the average Euclidean distance of the second in the list of weld pattern clusters to be evaluated as the weld pattern cluster with uniformity abnormality to be verified, and perform pixel seed point growth of the region growing algorithm on the weld pattern cluster with uniformity abnormality to be verified; select the pixel with the smallest brightness value as the pixel seed point, perform adjacent domain growth on the pixel seed point, and if the pixel brightness value of the adjacent domain is greater than the pixel seed point, then perform growth diffusion on the pixel brightness of the adjacent domain;
[0098] If the brightness value of the pixel point in the adjacent domain is equal to the pixel seed point, the pixel seed point stops growing, and the weld pattern pixel brightness cluster of the uniformity abnormal weld pattern cluster to be verified is removed, and the deleted uniformity abnormal weld pattern cluster to be verified is determined as a non-target uniformity abnormal weld pattern cluster; and return to the above step, update the updated list of weld pattern clusters to be evaluated again, and continue to select subsequent average Euclidean distances in descending order from the updated list of weld pattern clusters to be evaluated, until the pixel seed point of the uniformity abnormal weld pattern cluster to be verified is grown M times by the regional growing algorithm to obtain the target uniformity abnormal weld pattern cluster;
[0099] If the pixel seed point of the region growing algorithm for the uniformity abnormal weld pattern cluster to be verified is still a non-target uniformity abnormal weld pattern cluster, the subsequent average Euclidean distances are continuously selected in descending order from the list of weld pattern clusters to be evaluated after being updated again, until the average Euclidean distance of the Nth weld pattern pixel brightness cluster is selected as the pixel seed point of the region growing algorithm for the uniformity abnormal weld pattern cluster to be verified, and the target uniformity abnormal weld pattern cluster is obtained;
[0100] If the average Euclidean distance of the weld mark pixel brightness cluster is less than or equal to the update threshold r in the subsequent average Euclidean distances selected in descending order from the updated weld mark cluster to be evaluated list, stop selecting the average Euclidean distance of the weld mark pixel brightness cluster in the updated weld mark cluster to be evaluated list, and output the result of the previous non-target uniformity abnormal weld mark cluster, which is no weld mark defect.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. A person skilled in the art may modify the technical solutions described in the above embodiments, or replace part or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting and processing weld lines of a workpiece based on visual image detection, characterized in that: The steps are as follows: Acquire the welding image of the workpiece to be inspected, perform grayscale processing, and obtain the grayscale image to be inspected; Calculate the brightness of each pixel and the brightness of the adjacent pixel of each pixel according to the gray value of each pixel in the gray image to be detected, and obtain a weld mark pixel brightness cluster; obtain a weld mark cluster with abnormal uniformity of the brightness of each pixel in the weld mark pixel brightness cluster; Based on the uniform abnormal weld mark cluster, the pixel brightness growth of the regional growing algorithm is performed to determine whether a target uniform abnormal weld mark cluster is obtained; Determining that the welding image of the workpiece to be inspected has a welding line defect according to the target uniformity abnormal welding line cluster; According to the gray value of each pixel of the gray image to be detected, the brightness of each pixel and the brightness of the adjacent pixel of each pixel are calculated to obtain the brightness cluster of the weld mark pixel. The specific operation steps are as follows: The grayscale values of each pixel of the grayscale image to be detected are traversed and calculated, and the brightness of the pixel is determined by the grayscale value of the pixel; the brightness of the same pixel in the adjacent domain is clustered by the brightness of the pixel to obtain a number of abnormal pixel brightness clusters with the same brightness; the abnormal pixel brightness clusters are clustered again with the abnormal pixel brightness clusters with the same brightness in the adjacent domain to obtain a number of different types of weld mark pixel brightness clusters; Obtaining the uniformity abnormal welding pattern cluster of each pixel brightness in the welding pattern pixel brightness cluster, the specific operation steps are as follows: Calculating the average Euclidean distance of all adjacent high-brightness pixel points within the plurality of weld mark pixel point brightness clusters, and determining the weld mark cluster with abnormal uniformity according to the average Euclidean distance of all adjacent high-brightness pixel points; Calculate the average Euclidean distance of all adjacent high-brightness pixels within the plurality of weld pixel brightness clusters, and determine the uniformity abnormal weld cluster according to the average Euclidean distance of all adjacent high-brightness pixels. The specific operation steps are as follows: A preset pixel brightness threshold q is set corresponding to each of the different types of weld pixel brightness clusters; If the brightness of each pixel in the weld mark pixel brightness cluster is greater than the corresponding preset pixel brightness threshold q, the brightness of the pixel is a high-brightness pixel; if the brightness of each pixel in the weld mark pixel brightness cluster is less than or equal to the corresponding preset pixel brightness threshold q, the brightness of the pixel is a low-brightness pixel; Calculate the Euclidean distance between two adjacent high-brightness pixels in the current weld mark pixel brightness cluster, and calculate the average Euclidean distance of all high-brightness pixels in the current weld mark pixel brightness cluster; According to the calculation formula of the average Euclidean distance of all high-brightness pixel points in the current weld mark pixel point brightness cluster, the average Euclidean distance of all weld mark pixel point brightness clusters is calculated; the average Euclidean distance of all weld mark pixel point brightness clusters obtained is determined, and the average Euclidean distance of all weld mark pixel point brightness clusters is sorted in descending order to construct a list of weld mark clusters to be evaluated; The uniformity abnormal weld mark cluster is determined from the average Euclidean distance of all weld mark pixel brightness clusters in the weld mark cluster to be evaluated list.
2. According to the method for detecting weld lines of a workpiece based on visual image detection according to claim 1, it is characterized in that: After determining the uniformity abnormal weld pattern cluster, the method further includes: Further determining the weld mark pixel brightness cluster with the largest average Euclidean distance that is first in the weld mark cluster to be evaluated list as the weld mark cluster with abnormal uniformity to be verified; Performing pixel seed point growth of a regional growing algorithm through the minimum pixel brightness value inside the uniformity abnormal weld pattern cluster to be verified; If the corresponding pixel seed point can diffuse and cover all the pixel points inside the weld mark pixel brightness cluster after growth, the target uniformity abnormal weld mark cluster is obtained; If the corresponding pixel seed point stops growing without spreading to all the internal pixels after growth, the current uniformity abnormal weld pattern cluster to be verified is determined to be a non-target uniformity abnormal weld pattern cluster; from then on, the weld pattern pixel point brightness clusters in the evaluation list are determined one by one as uniformity abnormal weld pattern clusters to be verified in the order of the list arrangement.
3. According to the method for detecting weld lines of a workpiece based on visual image detection according to claim 2, it is characterized in that: The average Euclidean distance of all high-brightness pixel points in the current weld pixel brightness cluster is calculated as follows: ; In the formula, is the average Euclidean distance between all two adjacent high-brightness pixels in the ith weld pixel brightness cluster, Wi represents the number of high-brightness pixels in the ith weld pixel brightness cluster, represents the Euclidean distance between the Wi-th high-brightness pixel and its adjacent high-brightness pixel, It represents the sum of the Euclidean distances of all two adjacent high-brightness pixels, and exp{} represents a function with a natural constant as the base.
4. According to claim 3, a method for detecting weld lines of a workpiece based on visual image detection is characterized in that: The pixel seed point growth of the regional growing algorithm is performed through the minimum pixel brightness value inside the uniform abnormal weld pattern cluster to be verified. The specific operation steps are as follows: If the corresponding pixel seed point can diffuse and cover all the pixel points inside the weld mark pixel brightness cluster after growth, the target uniformity abnormal weld mark cluster is obtained; If the corresponding pixel seed point stops growing after not spreading to all the internal pixel points, then the uniformity abnormal weld pattern cluster to be verified is determined to be a non-target uniformity abnormal weld pattern cluster; Performing a regional growing algorithm on the brightness of each pixel in the uniformity abnormal weld pattern cluster to be verified; calculating the brightness value of the pixel brightness, selecting the minimum brightness value of the pixel brightness as the pixel seed point, and performing adjacent domain growth on the pixel seed point; comparing the brightness values of the pixels in the adjacent domain by the minimum pixel brightness value, if the brightness value of the pixel in the adjacent domain is greater than the pixel seed point, then performing growth diffusion on the pixel brightness in the adjacent domain, and using the brightness of the pixels in the adjacent domain that grows and diffuses as the growth pixel point; If the pixel brightness value of the adjacent domain is equal to the pixel seed point, it is determined that the pixel seed point stops growing, and the weld pattern pixel brightness cluster of the uniformity abnormal weld pattern cluster to be verified is removed, and the deleted uniformity abnormal weld pattern cluster to be verified is determined as a non-target uniformity abnormal weld pattern cluster; Updating the list of weld pattern clusters to be evaluated, and reselecting weld pattern clusters with abnormal uniformity in descending order from the list of weld pattern clusters to be evaluated, and growing pixel seed points for the reselected weld pattern clusters with abnormal uniformity; Further compare the brightness of the growing pixel to see if it is less than the brightness of the adjacent domain pixel. If the brightness of the growing pixel is less than the brightness of the adjacent domain pixel, the growing pixel continues to grow until it can diffuse to all the pixels inside the weld mark pixel brightness cluster after M growths. It is determined that the pixel seed point can diffuse and cover all the pixels inside the weld mark pixel brightness cluster after growth, and the target uniformity abnormal weld mark cluster is obtained. The target uniformity abnormal weld mark cluster is used to determine whether a weld mark defect exists in the weld mark image of the workpiece to be inspected.
5. The method for detecting weld lines of a workpiece based on visual image detection according to claim 4, characterized in that: The list of weld pattern clusters to be evaluated is updated, and weld pattern clusters with abnormal uniformity are reselected in descending order from the list of weld pattern clusters to be evaluated, and pixel seed points are grown for the reselected weld pattern clusters with abnormal uniformity. The specific operation steps are as follows: In the original list of weld mark clusters to be evaluated, the weld mark clusters with abnormal uniformity to be verified are deleted to obtain an updated list of weld mark clusters to be evaluated; the average value of the average Euclidean distances of the average Euclidean distances of all weld mark pixel brightness clusters in the updated list of weld mark clusters to be evaluated is calculated, and the average value is set as the update threshold r; Determine one by one in descending order whether the average Euclidean distances of the brightness clusters of the weld mark pixels in the updated list of weld mark clusters to be evaluated are greater than an update threshold r; If the average Euclidean distance of the second weld mark cluster in the descending order of the list of weld mark clusters to be evaluated is greater than the update threshold r, then the weld mark pixel brightness cluster with the average Euclidean distance of the second weld mark cluster in the list of weld mark clusters to be evaluated is selected as the weld mark cluster with uniformity abnormality to be verified, and the pixel seed point growth of the weld mark cluster with uniformity abnormality to be verified is re-performed on the growth of the pixel seed points of the region growing algorithm; Select the pixel with the smallest brightness value as the pixel seed point, and perform adjacent domain growth on the pixel seed point. If the brightness value of the pixel in the adjacent domain is greater than the pixel seed point, then grow and diffuse the brightness of the pixel in the adjacent domain. If the brightness value of the pixel point in the adjacent domain is equal to the pixel seed point, the pixel seed point stops growing, and the weld pattern pixel brightness cluster of the uniformity abnormal weld pattern cluster to be verified is removed, and the deleted uniformity abnormal weld pattern cluster to be verified is determined as a non-target uniformity abnormal weld pattern cluster; and return to the above step, update the updated list of weld pattern clusters to be evaluated again, and continue to select subsequent average Euclidean distances in descending order from the updated list of weld pattern clusters to be evaluated, until the pixel seed point of the uniformity abnormal weld pattern cluster to be verified is grown M times by the regional growing algorithm to obtain the target uniformity abnormal weld pattern cluster; If the pixel seed point of the region growing algorithm for the uniformity abnormal weld pattern cluster to be verified is still a non-target uniformity abnormal weld pattern cluster, the subsequent average Euclidean distances are continuously selected in descending order from the list of weld pattern clusters to be evaluated after being updated again, until the average Euclidean distance of the Nth weld pattern pixel brightness cluster is selected as the pixel seed point of the region growing algorithm for the uniformity abnormal weld pattern cluster to be verified, and the target uniformity abnormal weld pattern cluster is obtained; If the average Euclidean distance of the weld mark pixel brightness cluster is less than or equal to the update threshold r in the subsequent average Euclidean distances selected in descending order from the updated weld mark cluster to be evaluated list, stop selecting the average Euclidean distance of the weld mark pixel brightness cluster in the updated weld mark cluster to be evaluated list, and output the result of the previous non-target uniformity abnormal weld mark cluster, which is no weld mark defect.
6. A workpiece gap detection and processing system based on visual image detection, characterized in that: include: Sample collection module, weld mark detection module, weld mark determination module; The sample acquisition module is used to obtain the welding image of the workpiece to be detected, perform grayscale processing, and obtain the grayscale image to be detected; The welding mark detection module is used to calculate the brightness of each pixel and the brightness of the adjacent domain pixels of each pixel according to the gray value of each pixel of the gray image to be detected, and obtain a welding mark pixel brightness cluster; obtain a welding mark cluster with abnormal uniformity of the brightness of each pixel in the welding mark pixel brightness cluster; Based on the uniform abnormal weld mark cluster, the pixel brightness growth of the regional growing algorithm is performed to determine whether a target uniform abnormal weld mark cluster is obtained; The weld mark determination module is used to determine whether the weld mark defect exists in the weld image of the workpiece to be detected according to the target uniformity abnormal weld mark cluster; The weld mark detection module includes a cluster processing module and a uniformity determination module; The cluster processing module traverses each pixel of the grayscale image to be detected to calculate the grayscale value, and determines the brightness of the pixel by the grayscale value of the pixel; Clustering the brightness of pixels with the same brightness in adjacent domains through the brightness of the pixels to obtain a number of abnormal pixel brightness clusters with the same brightness; clustering the brightness clusters of abnormal pixels with the same brightness in adjacent domains again to obtain a number of different types of weld mark pixel brightness clusters; The uniformity determination module is used to calculate the average Euclidean distance of all adjacent high-brightness pixel points within the plurality of weld mark pixel point brightness clusters, and determine the weld mark cluster with abnormal uniformity according to the average Euclidean distance of all adjacent high-brightness pixel points; The uniformity determination module includes a first processing module, a first calculation module, and a second processing module; The first processing module is used to set a preset pixel brightness threshold q corresponding to the different types of weld mark pixel brightness clusters; If the brightness of each pixel in the weld mark pixel brightness cluster is greater than the corresponding preset pixel brightness threshold q, the brightness of the pixel is a high-brightness pixel; if the brightness of each pixel in the weld mark pixel brightness cluster is less than or equal to the corresponding preset pixel brightness threshold q, the brightness of the pixel is a low-brightness pixel; The first calculation module is used to calculate the Euclidean distance between two adjacent high-brightness pixels in the current weld mark pixel brightness cluster, and calculate the average Euclidean distance of all high-brightness pixels in the current weld mark pixel brightness cluster; The second processing module is used to calculate the average Euclidean distance of all weld mark pixel brightness clusters according to the average Euclidean distance of all high-brightness pixel points in the above-mentioned current weld mark pixel brightness cluster; determine the average Euclidean distance of all acquired weld mark pixel brightness clusters, descend the average Euclidean distance of all weld mark pixel brightness clusters, and construct a list of weld mark clusters to be evaluated; determine the uniformity abnormal weld mark cluster from the average Euclidean distance of all weld mark pixel brightness clusters in the list of weld mark clusters to be evaluated.
Citation Information
Patent Citations
Automatic detection method and system for weak and small targets in welding defects
CN111667462A
Bearing outer ring surface defect area detection method
CN112862760A
Strip steel surface defect detection method and system based on image processing
CN115311292A
Data clustering analysis method based on mobile grid density
CN115374856A
Deaerator welding quality detection method based on image processing
CN115439481A
