Defect detection method based on image detection
By collecting images from different perspectives of the workpiece, area segmentation and edge feature fusion are performed, the defects to be detected in the workpiece are obtained, feature coding and comparison are performed, and the information is integrated to generate defect data forms is solved, which solves the problem of poor detection of the edge areas of the workpiece in the prior art, and comprehensive defect detection of the workpiece is achieved.
Patent Information
- Application Number
- CN202510169852.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2045-02-17
AI Technical Summary
When dealing with defect detection of workpieces, existing defect detection technologies usually ignore or detect workpiece edge areas with poor results, resulting in a large number of undetected defects and defects.
By setting up an image acquisition device, monocular view images from different perspectives of the workpiece are collected, area segmentation and edge feature fusion are performed, and the first and second defects of the workpiece are to be detected are obtained. Then, the defect feature code is encoded in the first defect to be detected to obtain defect information on the workpiece body; the edge feature comparison is performed on the second defect to be detected to obtain workpiece edge defect information. Finally, this information is integrated to generate a defective data form.
A comprehensive defect detection of the workpiece body and edge area is achieved, the accuracy and effect of defect detection is improved, and the defects and defects of the workpiece are fully detected.
Smart Images

Figure CN120107194A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and in particular to a defect detection method based on image detection. Background Art
[0002] In industrial production, the surface quality of workpieces has an important impact on the overall quality and performance of the product. Traditional defect detection methods mostly rely on manual inspection or simple mechanical inspection equipment. These methods are not only inefficient but also easily affected by human factors.
[0003] In recent years, image processing technology has been widely used in the field of automated inspection. However, when dealing with defect detection of workpieces, the existing technology often only considers the main part of the workpiece and ignores the detection of the edge area of the workpiece, or the detection effect is poor and rough. This leads to the fact that the detection effect of defect detection on workpieces is usually not ideal, and there are a large number of undetected defects and flaws. How to solve this problem is the problem and challenge currently faced by the field of defect detection. Summary of the invention
[0004] In order to solve the above problems, an object of the present invention is to provide a defect detection method based on image detection.
[0005] The purpose of the present invention can be achieved by the following technical solution: A defect detection method based on image detection comprises the following steps:
[0006] Step S1: Setting an image acquisition device, setting different light and shadow parameters and angle parameters for the image acquisition device, and then using the image acquisition device to acquire monocular view images of a plurality of workpieces corresponding to different viewing angles;
[0007] Step S2: performing regional segmentation on all monocular view images corresponding to each workpiece, thereby locating the first defect detection area corresponding to each monocular view image of each workpiece, extracting the edge image area of all monocular view images corresponding to each workpiece, and performing edge feature fusion on the edge image areas of all monocular view images, thereby obtaining the second defect detection area corresponding to each workpiece;
[0008] Step S3: performing defect feature coding on the first defect detection area of each workpiece, thereby obtaining workpiece main body defect information corresponding to each workpiece, and performing edge feature comparison on the second defect detection area of each workpiece, thereby obtaining workpiece edge defect information corresponding to each workpiece;
[0009] Step S4: Integrate the workpiece body defect information and workpiece edge defect information of each workpiece, and generate a defect data form corresponding to each workpiece.
[0010] Furthermore, the process of setting an image acquisition device, setting different light and shadow parameters and angle parameters for the image acquisition device, and then acquiring monocular view images of a plurality of workpieces corresponding to different viewing angles through the image acquisition device includes:
[0011] The light and shadow parameters set for the image acquisition device include different light source types, light source brightness and lighting angles. The light source types include ring light sources, backlight sources and uniform light sources. The angle parameters set for the image acquisition device are: taking the workpiece corresponding to the camera lens of the image acquisition device as the central object, shooting at an angle of 0-360° around the central object, and shooting the central object at a low angle;
[0012] Then, the image acquisition device collects the monocular view images corresponding to each workpiece under different viewing angles according to the light and shadow parameters and the angle parameters. The viewing angles of the monocular view images include a bird's-eye view, that is, shooting the workpiece from top to bottom to obtain a monocular view image of the top of the workpiece, and a surround view, that is, shooting the workpiece 360° to obtain the monocular view images corresponding to the front, side and rear of the workpiece.
[0013] Furthermore, the process of performing region segmentation on all monocular view images corresponding to each workpiece, and then locating the first defect detection region corresponding to each monocular view image of each workpiece includes:
[0014] The monocular view image corresponding to each workpiece is segmented into regions, and then the monocular view image of each workpiece is divided into a number of pixel set regions of equal area size, each pixel set region is composed of p×q pixel cells, and p and q are both natural numbers greater than 0;
[0015] Get the cell parameters corresponding to each pixel cell, including pixel texture gradient, RGB value, grayscale value and depth value, set the corresponding defect marking interval, and record them as Ω 1 ,Ω 2 ,Ω 3 and Ω 4 , the pixel texture gradient, RGB value, grayscale value and depth value are respectively denoted as D 纹理梯度 , D RGB , D 灰度 and D 深度 ;
[0016] Determine whether each pixel unit cell has a defect, and then integrate all the pixel units with defects in each pixel set area to locate the first defect to be detected area corresponding to the monocular view image of each workpiece at different viewing angles;
[0017] When the pixel cell corresponds to D 纹理梯度∈Ω 1 , D RGB ∈Ω 2 , D 灰度 ∈Ω 3 and D 深度 ∈Ω 4 When at least one of the conditions is met, it is determined that the pixel unit has a defect; otherwise, it is determined that the pixel unit does not have a defect.
[0018] Furthermore, the process of extracting edge image regions of all monocular view images corresponding to each workpiece, and performing edge feature fusion on the edge image regions of all monocular view images, and then obtaining the second defect detection region corresponding to each workpiece includes:
[0019] The edge image regions of the monocular view images corresponding to each workpiece at different viewing angles are extracted by edge image processing technology. The edge image regions include a first edge region and a second edge region. The first edge region is an edge region formed by the connection between the monocular view image corresponding to the top of the workpiece obtained by the overhead view and the monocular view images corresponding to the front, side and rear of the workpiece obtained by the surround view. The second edge region is an edge region formed by the connection between the front and side of the workpiece in the monocular view images corresponding to the front, side and rear of the workpiece obtained by the surround view, and an edge region formed by the connection between the rear and side of the workpiece;
[0020] In the first edge region, edge features of the edge region formed by the connection between the top of the workpiece and the front of the workpiece, the edge region formed by the connection between the top of the workpiece and the side of the workpiece, and the edge region formed by the connection between the top of the workpiece and the rear of the workpiece are respectively fused, thereby constructing corresponding top edge region 1 to be detected, top edge region 2 to be detected, and top edge region 3 to be detected;
[0021] In the second edge region, edge features of the edge region formed by the connection between the front of the workpiece and the side of the workpiece and the edge region formed by the connection between the rear of the workpiece and the side of the workpiece are respectively fused, thereby constructing a corresponding front edge region to be detected and a back edge region to be detected;
[0022] The top edge area 1 to be detected, the top edge area 2 to be detected, the top edge area 3 to be detected, the front edge area to be detected and the back edge area to be detected corresponding to each workpiece are integrated as the second defect detection area corresponding to each workpiece.
[0023] Furthermore, the process of edge feature fusion includes:
[0024] The monocular view image corresponding to the top of the workpiece in the first edge area is used as the main layer, and the monocular view images corresponding to the front, side and rear of the workpiece in the first edge area are used as the registration layers, and the layer features of the registration layers corresponding to the front, side and rear of the workpiece and the main layer corresponding to the top of the workpiece are merged and the number of layer channels are unified, so as to construct the corresponding top edge area 1 to be detected, the top edge area 2 to be detected and the top edge area 3 to be detected;
[0025] The content of the unified number of layer channels is: set an edge layer and record the number of channels of the edge layer as TD 基准 , the number of channels of the main layer is recorded as TD 主体 , the number of channels of the registration layer is recorded as TD 配准 ; When TD 主体 ≠TD 基准 When the number of channels of the main layer is increased or decreased, until TD 主体 =TD 基准 ; When TD 配准 ≠TD 基准 When , the number of channels of the registration layer is increased or decreased until TD 配准 =TD 基准 ; When TD 主体 =TD 基准 =TD 配准 When , the number of layer channels of the subject layer and the registration layer is unified;
[0026] The content of layer feature merging is: obtaining the edge direction, edge strength, edge width and edge curvature corresponding to the pixel cells of the main layer and the registration layer at different layer coordinates, merging the edge direction, edge strength, edge width and edge curvature of the main layer and the registration layer at the same layer coordinates, and then generating the cumulative edge direction, cumulative edge strength, cumulative edge width and cumulative edge curvature, and using the newly generated cumulative edge direction, cumulative edge strength, cumulative edge width and cumulative edge curvature as the edge feature information of the edge layer;
[0027] The edge feature fusion method for the first edge region is adopted to perform edge feature fusion on the second edge region, so as to obtain the front edge region to be detected and the back edge region to be detected included in the second edge region.
[0028] Furthermore, the process of encoding defect features of the first defect to-be-detected region of each workpiece and then acquiring workpiece main body defect information corresponding to each workpiece includes:
[0029] The first defect detection area of each workpiece is divided into different detection areas to be coded according to different viewing angles of the workpiece. Each detection area to be coded is composed of a number of pixel cells with defects. The feature code of the defect feature coding includes QX 1 , QX 2 , QX 3 and QX 4 , associate different feature codes with each defective pixel cell;
[0030] When its D 纹理梯度 ∈Ω 1 , D RGB ∈Ω 2 , D 灰度 ∈Ω 3 and D 深度 ∈Ω 4 If only one of the following holds true, then the defective pixel cell is associated with the characteristic code QX 1 ;
[0031] When its D 纹理梯度 ∈Ω 1 , D RGB ∈Ω 2 , D 灰度 ∈Ω 3 and D 深度 ∈Ω 4 If there are only two of them, then the defective pixel cell is associated with the characteristic code QX 2 ;
[0032] When its D 纹理梯度 ∈Ω 1 , D RGB ∈Ω 2 , D 灰度 ∈Ω 3 and D 深度 ∈Ω 4 If only three of the following are true, then the defective pixel cell is associated with the characteristic code QX 3 ;
[0033] When its D 纹理梯度 ∈Ω 1 , D RGB ∈Ω 2 , D 灰度 ∈Ω 3 and D 深度 ∈Ω 4 When all of the above are true, the pixel cell with the defect is associated with the characteristic code QX 4 ;
[0034] All feature codes corresponding to the defect feature coding of each detection area to be coded are summarized as the area code set corresponding to the detection area to be coded, and all area code sets of each workpiece are summarized as the workpiece main defect information corresponding to the workpiece.
[0035] Furthermore, the process of performing edge feature comparison on the second defect detection area of each workpiece to obtain workpiece edge defect information corresponding to each workpiece includes:
[0036] Setting edge standard information corresponding to each of the second defect to-be-detected area, including the first to-be-detected top edge area, the second to-be-detected top edge area, the third to-be-detected top edge area, the front edge area, and the back edge area;
[0037] Performing edge feature comparison between edge feature information and edge standard information;
[0038] The part of the edge feature information of the top edge area to be detected one, the top edge area to be detected two, the top edge area to be detected three, the front edge area to be detected and the back edge area to be detected that does not conform to the edge standard information is taken as the workpiece edge defect information of the workpiece, and then the workpiece edge defect information corresponding to each workpiece is obtained.
[0039] Furthermore, the process of integrating the workpiece main body defect information and the workpiece edge defect information of each workpiece and generating a defect data form corresponding to each workpiece includes:
[0040] The workpiece main body defect information and workpiece edge defect information corresponding to each workpiece are integrated as the workpiece defect information corresponding to each workpiece, and several blank data forms are set. The workpiece defect information of each workpiece is entered into the corresponding blank data form, and then the blank data form is converted into a corresponding defect data form, and the workpiece number corresponding to each workpiece is obtained. The workpiece number is a unique identity authentication identifier for each workpiece, and the workpiece number of each workpiece is used as a search index for the corresponding defect data form, and the defect data forms corresponding to all workpieces are stored in the set database.
[0041] Compared with the prior art, the beneficial effects of the present invention are as follows: monocular view images corresponding to different viewing angles of several workpieces are collected by an image acquisition device, and the monocular view images corresponding to each workpiece are region-segmented to locate the first defect detection area corresponding to the monocular view images of each workpiece, and the edge image areas of all monocular view images corresponding to each workpiece are extracted to perform edge feature fusion to obtain the second defect detection area corresponding to each workpiece, and the main defect information of each workpiece is obtained by processing the first defect detection area, and the edge defect information of each workpiece is obtained by processing the second defect detection area, and the defect detection of the main area and the edge area on the workpiece is comprehensively considered, so that the defects and flaws of the workpiece are fully detected, and the detection effect of defect detection is improved to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0043] like Figure 1 As shown, a defect detection method based on image detection includes the following steps:
[0044] Step S1: Setting an image acquisition device, setting different light and shadow parameters and angle parameters for the image acquisition device, and then using the image acquisition device to acquire monocular view images of a plurality of workpieces corresponding to different viewing angles;
[0045] Step S2: performing regional segmentation on all monocular view images corresponding to each workpiece, thereby locating the first defect detection area corresponding to each monocular view image of each workpiece, extracting the edge image area of all monocular view images corresponding to each workpiece, and performing edge feature fusion on the edge image areas of all monocular view images, thereby obtaining the second defect detection area corresponding to each workpiece;
[0046] Step S3: performing defect feature coding on the first defect detection area of each workpiece, thereby obtaining workpiece main body defect information corresponding to each workpiece, and performing edge feature comparison on the second defect detection area of each workpiece, thereby obtaining workpiece edge defect information corresponding to each workpiece;
[0047] Step S4: Integrate the workpiece body defect information and workpiece edge defect information of each workpiece, and generate a defect data form corresponding to each workpiece.
[0048] It should be further explained that, in a specific implementation, an image acquisition device is set, different light and shadow parameters and angle parameters are set for the image acquisition device, and then a process of acquiring monocular view images of a plurality of workpieces corresponding to different viewing angles by the image acquisition device includes:
[0049] The image acquisition device is used to photograph each workpiece, and the resolution, frame rate and focal length of the camera lens of the image acquisition device are adjusted when the image acquisition device photographs the workpiece, so that the image acquisition device can perform a clear imaging operation on the workpiece, and the image acquisition device is used to perform N test images to obtain N test images, and the number of test images in which the resolution, frame rate and focal length respectively meet the respective preset expected value ranges is recorded as M, and 0<M<N, M and N are integers;
[0050] Set the debugging threshold, denoted as γ, where 0<γ<1;
[0051] When M / N ≥ γ, the image acquisition device is set up successfully;
[0052] When M / N<γ, continue to adjust the resolution, frame rate and focal length of the camera lens corresponding to the image acquisition device until the image acquisition device is successfully set;
[0053] The light and shadow parameters set for the image acquisition device include different light source types, light source brightness and lighting angles, and the light source types include ring light sources, backlight sources and uniform light sources; the angle parameters set for the image acquisition device are: taking the workpiece corresponding to the camera lens of the image acquisition device as the central object, shooting at an angle of 0-360° around the central object, and shooting the central object at a low angle;
[0054] Then, the image acquisition device acquires the monocular view images corresponding to each workpiece at different viewing angles according to the set light and shadow parameters and angle parameters, wherein the viewing angles of the monocular view images include a bird's-eye view, that is, the workpiece is photographed from top to bottom to obtain a monocular view image of the top of the workpiece, and a surround view, that is, the workpiece is photographed 360° to obtain monocular view images corresponding to the front, side and rear of the workpiece;
[0055] The side includes the left side and the right side.
[0056] It should be further explained that, in a specific implementation manner, the process of performing region segmentation on all monocular view images corresponding to each workpiece, and then locating the first defect detection region corresponding to each monocular view image of each workpiece includes:
[0057] The monocular view image corresponding to each workpiece is segmented into regions, and then the monocular view image of each workpiece is divided into a number of pixel set regions of equal area size, each pixel set region is composed of p×q pixel cells, where p and q are both natural numbers greater than 0;
[0058] Get the cell parameters corresponding to each pixel cell, the cell parameters include pixel texture gradient, RGB value, gray value and depth value, set the defect marking intervals corresponding to the pixel texture gradient, RGB value, gray value and depth value, and record the respective defect marking intervals as Ω 1 ,Ω 2 ,Ω 3 and Ω 4 , the pixel texture gradient, RGB value, grayscale value and depth value are respectively denoted as D 纹理梯度 , D RGB , D 灰度 and D 深度 ;
[0059] Determine whether each pixel unit cell has defects, and then integrate all the pixel units with defects in each pixel set area to locate the first defect detection area corresponding to the monocular view image of each workpiece at different viewing angles. The first defect detection area represents the defect area on the workpiece formed by all the defective pixel units at different parts of the workpiece represented by the monocular view image at different viewing angles;
[0060] The contents for judging whether each pixel cell has defects are as follows:
[0061] When the pixel cell corresponds to D 纹理梯度 ∈Ω 1 , D RGB ∈Ω 2 , D 灰度 ∈Ω 3 and D 深度 ∈Ω 4 When at least one of the conditions is met, it is determined that the pixel unit has a defect; otherwise, it is determined that the pixel unit does not have a defect.
[0062] It should be further explained that, in a specific implementation manner, the process of extracting edge image areas of all monocular view images corresponding to each workpiece, and performing edge feature fusion on the edge image areas of all monocular view images, and then obtaining the second defect to-be-detected area corresponding to each workpiece includes:
[0063] Extracting edge image regions of the monocular view images corresponding to each workpiece at different viewing angles by edge image processing technology, wherein the edge image regions include a first edge region and a second edge region;
[0064] The first edge region is an edge region formed by the connection between the monocular view image corresponding to the top of the workpiece acquired through the overhead perspective and the monocular view images corresponding to the front, side and rear of the workpiece acquired through the surround perspective;
[0065] The second edge region is: an edge region formed by the connection between the front and side of the workpiece, and an edge region formed by the connection between the rear and side of the workpiece in the monocular view images corresponding to the front, side and rear of the workpiece acquired through the surround view;
[0066] Among them, for the first edge area, the edge area formed by the connection between the top of the workpiece and the front of the workpiece is subjected to edge feature fusion, and then the top edge area to be detected is constructed. Similarly, the edge area formed by the connection between the top of the workpiece and the side of the workpiece is subjected to edge feature fusion, and then the top edge area to be detected is constructed. The edge area formed by the connection between the top of the workpiece and the rear of the workpiece is subjected to edge feature fusion, and then the top edge area to be detected is constructed.
[0067] For the second edge region, edge features of the edge region formed by the connection between the front of the workpiece and the side of the workpiece are fused to construct the front edge region to be detected. Similarly, edge features of the edge region formed by the connection between the rear of the workpiece and the side of the workpiece are fused to construct the back edge region to be detected.
[0068] The edge feature fusion includes: using the monocular view image corresponding to the top of the workpiece in the first edge area as the main layer, using the monocular view images corresponding to the front, side and rear of the workpiece in the first edge area as the registration layer, merging the layer features of the registration layers corresponding to the front, side and rear of the workpiece and the main layer corresponding to the top of the workpiece respectively, and unifying the number of layer channels, thereby constructing the corresponding top edge area 1 to be detected, the top edge area 2 to be detected and the top edge area 3 to be detected;
[0069] The content of the unified number of layer channels is: set an edge layer, and record the number of channels of the edge layer as TD 基准 , the number of channels of the main layer is recorded as TD 主体 , the number of channels of the registration layer is recorded as TD 配准 ; When TD 主体 ≠TD 基准 When the number of channels of the main layer is increased or decreased, until TD 主体 =TD 基准 ; When TD 配准 ≠TD 基准 When , the number of channels of the registration layer is increased or decreased until TD 配准 =TD基准 ; When TD 主体 =TD 基准 =TD 配准 When , the number of layer channels of the subject layer and the registration layer is unified;
[0070] The content of the layer feature merging is: obtaining edge directions, edge strengths, edge widths and edge curvatures corresponding to pixel cells of the main layer and the registration layer at different layer coordinates, merging the edge directions, edge strengths, edge widths and edge curvatures of the main layer and the registration layer at the same layer coordinates, and then generating cumulative edge directions, cumulative edge strengths, cumulative edge widths and cumulative edge curvatures, and using the newly generated cumulative edge directions, cumulative edge strengths, cumulative edge widths and cumulative edge curvatures as edge feature information of the edge layer;
[0071] The method for fusing edge features of the first edge region is used to fuse edge features of the second edge region, so as to obtain a front edge region to be detected and a back edge region to be detected included in the second edge region;
[0072] The top edge area 1 to be detected, the top edge area 2 to be detected, the top edge area 3 to be detected, the front edge area to be detected and the back edge area to be detected corresponding to each workpiece are integrated as the second defect detection area corresponding to each workpiece.
[0073] It should be further explained that, in a specific implementation manner, the process of encoding defect features of the first defect to-be-detected region of each workpiece and then obtaining the workpiece main body defect information corresponding to each workpiece includes:
[0074] The first defect detection area of each workpiece is divided into different detection areas to be coded according to different viewing angles of the workpiece, that is, specifically divided into detection areas to be coded at the corresponding position of the top of the workpiece, and detection areas to be coded at the corresponding positions of the front, side and rear of the workpiece;
[0075] Each detection area to be coded consists of a number of pixel cells with defects. The feature code of the defect feature coding includes QX 1 , QX 2 , QX 3 and QX 4 , a different feature code is associated with each defective pixel cell, as follows:
[0076] For defective pixel cells;
[0077] When its D 纹理梯度 ∈Ω 1 , D RGB ∈Ω 2 , D灰度 ∈Ω 3 and D 深度 ∈Ω 4 If only one of the following holds true, then the defective pixel cell is associated with the characteristic code QX 1 ;
[0078] When its D 纹理梯度 ∈Ω 1 , D RGB ∈Ω 2 , D 灰度 ∈Ω 3 and D 深度 ∈Ω 4 If there are only two of them, then the defective pixel cell is associated with the characteristic code QX 2 ;
[0079] When its D 纹理梯度 ∈Ω 1 , D RGB ∈Ω 2 , D 灰度 ∈Ω 3 and D 深度 ∈Ω 4 If only three of the following are true, then the defective pixel cell is associated with the characteristic code QX 3 ;
[0080] When its D 纹理梯度 ∈Ω 1 , D RGB ∈Ω 2 , D 灰度 ∈Ω 3 and D 深度 ∈Ω 4 When all of the above are true, the pixel cell with the defect is associated with the characteristic code QX 4 ;
[0081] Among them, the defect feature code corresponds to the feature code QX 1 , QX 2 , QX 3 and QX 4 , used to correspond to different defect levels of workpieces, QX 1 To QX 4 As the defect level of the workpiece increases, the number of defect types corresponding to the workpiece increases accordingly. The defect types of the workpiece include defects in pixel texture gradient, defects in RGB value, defects in gray value and defects in depth value.
[0082] All feature codes corresponding to the defect feature coding of each detection area to be coded are summarized as the area code set corresponding to the detection area to be coded, and all area code sets of each workpiece are summarized as the workpiece main defect information corresponding to the workpiece.
[0083] It should be further explained that, in a specific implementation manner, the process of performing edge feature comparison on the second defect detection area of each workpiece to obtain workpiece edge defect information corresponding to each workpiece includes:
[0084] Setting edge standard information corresponding to each of the second defect to be detected area, including the first to be detected top edge area, the second to be detected top edge area, the third to be detected top edge area, the front edge area and the back edge area, wherein the edge standard information includes a standard edge direction, a standard edge strength, a standard edge width and a standard edge curvature;
[0085] Performing edge feature comparison between edge feature information and edge standard information;
[0086] The part of the edge feature information of the top edge area to be detected one, the top edge area to be detected two, the top edge area to be detected three, the front edge area to be detected and the back edge area to be detected that does not conform to the edge standard information is taken as the workpiece edge defect information of the workpiece, and then the workpiece edge defect information corresponding to each workpiece is obtained.
[0087] It should be noted that when any of the following conditions is true: the accumulated edge direction is inconsistent with the standard edge direction, the accumulated edge strength is inconsistent with the standard edge strength, the accumulated edge width is inconsistent with the standard edge width, and the accumulated edge curvature is inconsistent with the standard edge curvature, it means that the corresponding edge feature information is inconsistent with the edge standard information; otherwise, the edge feature information is consistent with the edge standard information.
[0088] It should be further explained that, in a specific implementation manner, the process of integrating the workpiece body defect information and the workpiece edge defect information of each workpiece and generating a defect data form corresponding to each workpiece includes:
[0089] Integrate the workpiece main body defect information and the workpiece edge defect information corresponding to each workpiece as the workpiece defect information corresponding to each workpiece, set a number of blank data forms, enter the workpiece defect information corresponding to each workpiece into the corresponding blank data forms, and then convert the blank data forms into corresponding defect data forms;
[0090] The workpiece number corresponding to each workpiece is obtained, and the workpiece number is a unique identity authentication identifier of each workpiece. The workpiece number of each workpiece is used as a search index for the corresponding defect data form, and the defect data forms corresponding to all workpieces are stored in a set database.
[0091] It should be noted that the search index of the defect data form corresponding to each workpiece is used for subsequent search of the workpiece.
[0092] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.
Claims
1. A defect detection method based on image detection, characterized in that: The following steps are involved: Step S1: Setting an image acquisition device, setting different light and shadow parameters and angle parameters for the image acquisition device, and then using the image acquisition device to acquire monocular view images of a plurality of workpieces corresponding to different viewing angles; Step S2: performing regional segmentation on all monocular view images corresponding to each workpiece, thereby locating the first defect detection area corresponding to each monocular view image of each workpiece, extracting the edge image area of all monocular view images corresponding to each workpiece, and performing edge feature fusion on the edge image areas of all monocular view images, thereby obtaining the second defect detection area corresponding to each workpiece; Step S3: performing defect feature coding on the first defect detection area of each workpiece, thereby obtaining workpiece main body defect information corresponding to each workpiece, and performing edge feature comparison on the second defect detection area of each workpiece, thereby obtaining workpiece edge defect information corresponding to each workpiece; Step S4: Integrate the workpiece body defect information and workpiece edge defect information of each workpiece, and generate a defect data form corresponding to each workpiece.
2. The defect detection method based on image detection according to claim 1, characterized in that: The process of setting an image acquisition device, setting different light and shadow parameters and angle parameters for the image acquisition device, and then acquiring monocular view images of a plurality of workpieces corresponding to different viewing angles through the image acquisition device includes: The light and shadow parameters set for the image acquisition device include different light source types, light source brightness and lighting angles. The light source types include ring light sources, backlight sources and uniform light sources. The angle parameters set for the image acquisition device are: taking the workpiece corresponding to the camera lens of the image acquisition device as the central object, shooting at an angle of 0-360° around the central object, and shooting the central object at a low angle; Then, the image acquisition device collects the monocular view images corresponding to each workpiece under different viewing angles according to the light and shadow parameters and the angle parameters. The viewing angles of the monocular view images include a bird's-eye view, that is, shooting the workpiece from top to bottom to obtain a monocular view image of the top of the workpiece, and a surround view, that is, shooting the workpiece 360° to obtain the monocular view images corresponding to the front, side and rear of the workpiece.
3. A defect detection method based on image detection according to claim 2, characterized in that: The process of performing region segmentation on all monocular view images corresponding to each workpiece, and then locating the first defect detection region corresponding to each monocular view image of each workpiece includes: The monocular view image corresponding to each workpiece is segmented into regions, and then the monocular view image of each workpiece is divided into a number of pixel set regions of equal area size, each pixel set region is composed of p×q pixel cells, and p and q are both natural numbers greater than 0; Get the cell parameters corresponding to each pixel cell, including pixel texture gradient, RGB value, grayscale value and depth value, set the corresponding defect labeling intervals, and record them as Ω1, Ω2, Ω3 and Ω4 respectively, and record the pixel texture gradient, RGB value, grayscale value and depth value as D 纹理梯度 , D RGB , D 灰度 and D 深度 ; Determine whether each pixel unit cell has a defect, and then integrate all the pixel units with defects in each pixel set area to locate the first defect to be detected area corresponding to the monocular view image of each workpiece at different viewing angles; When the pixel cell corresponds to D 纹理梯度 ∈Ω1,D RGB ∈Ω2,D 灰度 ∈Ω3 and D 深度 When at least one of the conditions in ∈Ω4 is met, it is determined that the pixel unit has a defect; otherwise, it is determined that the pixel unit does not have a defect.
4. The defect detection method based on image detection according to claim 3, characterized in that: The process of extracting edge image regions of all monocular view images corresponding to each workpiece, and performing edge feature fusion on the edge image regions of all monocular view images, and then obtaining the second defect detection region corresponding to each workpiece includes: The edge image regions of the monocular view images corresponding to each workpiece at different viewing angles are extracted by edge image processing technology. The edge image regions include a first edge region and a second edge region. The first edge region is an edge region formed by the connection between the monocular view image corresponding to the top of the workpiece obtained by the overhead view and the monocular view images corresponding to the front, side and rear of the workpiece obtained by the surround view. The second edge region is an edge region formed by the connection between the front and side of the workpiece in the monocular view images corresponding to the front, side and rear of the workpiece obtained by the surround view, and an edge region formed by the connection between the rear and side of the workpiece; In the first edge region, edge features of the edge region formed by the connection between the top of the workpiece and the front of the workpiece, the edge region formed by the connection between the top of the workpiece and the side of the workpiece, and the edge region formed by the connection between the top of the workpiece and the rear of the workpiece are respectively fused, thereby constructing corresponding top edge region 1 to be detected, top edge region 2 to be detected, and top edge region 3 to be detected; In the second edge region, edge features of the edge region formed by the connection between the front of the workpiece and the side of the workpiece and the edge region formed by the connection between the rear of the workpiece and the side of the workpiece are respectively fused, thereby constructing a corresponding front edge region to be detected and a back edge region to be detected; The top edge area 1 to be detected, the top edge area 2 to be detected, the top edge area 3 to be detected, the front edge area to be detected and the back edge area to be detected corresponding to each workpiece are integrated as the second defect detection area corresponding to each workpiece.
5. The defect detection method based on image detection according to claim 4, characterized in that: The process of edge feature fusion includes: The monocular view image corresponding to the top of the workpiece in the first edge area is used as the main layer, and the monocular view images corresponding to the front, side and rear of the workpiece in the first edge area are used as the registration layers, and the layer features of the registration layers corresponding to the front, side and rear of the workpiece and the main layer corresponding to the top of the workpiece are merged and the number of layer channels are unified, so as to construct the corresponding top edge area 1 to be detected, the top edge area 2 to be detected and the top edge area 3 to be detected; The content of the unified number of layer channels is: set an edge layer and record the number of channels of the edge layer as TD 基准 , the number of channels of the main layer is recorded as TD 主体 , the number of channels of the registration layer is recorded as TD 配准 ; When TD 主体 ≠TD 基准 When the number of channels of the main layer is increased or decreased, until TD 主体 =TD 基准 ; When TD 配准 ≠TD 基准 When , the number of channels of the registration layer is increased or decreased until TD 配准 =TD 基准 ; When TD 主体 =TD 基准 =TD 配准 When , the number of layer channels of the subject layer and the registration layer is unified; The content of layer feature merging is: obtaining the edge direction, edge strength, edge width and edge curvature corresponding to the pixel cells of the main layer and the registration layer at different layer coordinates, merging the edge direction, edge strength, edge width and edge curvature of the main layer and the registration layer at the same layer coordinates, and then generating the cumulative edge direction, cumulative edge strength, cumulative edge width and cumulative edge curvature, and using the newly generated cumulative edge direction, cumulative edge strength, cumulative edge width and cumulative edge curvature as the edge feature information of the edge layer; The edge feature fusion method for the first edge region is adopted to perform edge feature fusion on the second edge region, so as to obtain the front edge region to be detected and the back edge region to be detected included in the second edge region.
6. A defect detection method based on image detection according to claim 5, characterized in that: The process of encoding defect features of the first defect to be detected area of each workpiece and then obtaining the workpiece main defect information corresponding to each workpiece includes: The first defect detection area of each workpiece is divided into different detection areas to be coded according to different viewing angles of the workpiece, each detection area to be coded is composed of a number of pixel cells with defects, and the feature codes of the defect feature coding include QX1, QX2, QX3 and QX4, and a different feature code is associated with each pixel cell with defects; When its D 纹理梯度 ∈Ω1,D RGB ∈Ω2,D 灰度 ∈Ω3 and D 深度 When only one of ∈Ω4 holds true, the defective pixel cell is associated with the feature code QX1; When its D 纹理梯度 ∈Ω1,D RGB ∈Ω2,D 灰度 ∈Ω3 and D 深度 When there are only two of ∈Ω4, the defective pixel cell is associated with the feature code QX2; When its D 纹理梯度 ∈Ω1,D RGB ∈Ω2,D 灰度 ∈Ω3 and D 深度 When there are only three of ∈Ω4, the defective pixel cell is associated with the feature code QX3; When its D 纹理梯度 ∈Ω1,D RGB ∈Ω2,D 灰度 ∈Ω3 and D 深度 When all of ∈Ω4 hold true, the defective pixel cell is associated with the feature code QX4; All feature codes corresponding to the defect feature coding of each detection area to be coded are summarized as the area code set corresponding to the detection area to be coded, and all area code sets of each workpiece are summarized as the workpiece main defect information corresponding to the workpiece.
7. The defect detection method based on image detection according to claim 6, characterized in that: The process of performing edge feature comparison on the second defect detection area of each workpiece to obtain workpiece edge defect information corresponding to each workpiece includes: Setting edge standard information corresponding to each of the second defect to-be-detected area, including the first to-be-detected top edge area, the second to-be-detected top edge area, the third to-be-detected top edge area, the front edge area, and the back edge area; Performing edge feature comparison between edge feature information and edge standard information; The part of the edge feature information of the top edge area to be detected one, the top edge area to be detected two, the top edge area to be detected three, the front edge area to be detected and the back edge area to be detected that does not conform to the edge standard information is taken as the workpiece edge defect information of the workpiece, and then the workpiece edge defect information corresponding to each workpiece is obtained.
8. The defect detection method based on image detection according to claim 7, characterized in that: The process of integrating the workpiece body defect information and the workpiece edge defect information of each workpiece and generating a defect data form corresponding to each workpiece includes: The workpiece main body defect information and workpiece edge defect information corresponding to each workpiece are integrated as the workpiece defect information corresponding to each workpiece, and several blank data forms are set. The workpiece defect information of each workpiece is entered into the corresponding blank data form, and then the blank data form is converted into a corresponding defect data form, and the workpiece number corresponding to each workpiece is obtained. The workpiece number is a unique identity authentication identifier for each workpiece, and the workpiece number of each workpiece is used as a search index for the corresponding defect data form, and the defect data forms corresponding to all workpieces are stored in the set database.
Citation Information
Patent Citations
Textile defect detecting algorithm based on texture gradients
CN103413314A
Mechanical part surface defect detection method based on image processing
CN113538429A
Defect detection method and device, computer equipment and medium
CN116402781A
Surface defect detection method for weaving and forming of large prefabricated body
CN118429352A
Defect detection method and device of circuit board, storage medium and electronic equipment
CN118710586A