A defect detection method, device, electronic device and storage medium
By dividing areas according to connector functions and adopting highly targeted detection methods, the problem of low connector defect detection efficiency and accuracy in the prior art is solved, and a more efficient defect detection effect is achieved.
Patent Information
- Application Number
- CN202011111471.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-16
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2040-10-16
AI Technical Summary
In the prior art, connector defect detection has problems such as missed detection and/or over-test, and the detection efficiency and accuracy are relatively low.
The regions are divided according to the functional components of the connector, and defect detection is carried out using suitable detection methods for each region, including methods such as calculating the position relationship using affine matrix, Euro-type distance detection, Pearson's correlation coefficient detection and dynamic local threshold segmentation.
It improves the accuracy and efficiency of defect detection, avoids over-checking and missed inspection, and enhances the robustness of the detection system.
Smart Images

Figure CN114445318B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of wireless communication technology, and in particular to a defect detection method, device, electronic equipment and storage medium. Background Art
[0002] With the development of digital imaging technology, more and more modules need connectors to communicate with each other. For example, the camera module used in mobile phones needs to communicate with the mobile phone motherboard through the connector to complete data exchange. The quality of the connector directly affects the accuracy of data transmission. In the production process of the connector, it is easy to produce defects such as crushing, copper exposure, and misalignment. These defects will seriously affect the data exchange between the connected modules. Therefore, connector defect detection plays an important role.
[0003] In the related art, defects are usually located by grayscale matching, using a binary image to subtract from a binary image of a standard template, and then using morphological processing analysis to perform feature analysis to detect defects. However, this not only has poor positioning accuracy, but also simple binary processing is prone to problems such as missed detection and / or over-detection, resulting in low detection accuracy and efficiency. Summary of the invention
[0004] The present invention provides a defect detection method, device, electronic device and storage medium to solve the problems of missed detection and / or over-detection that are prone to occur during connector detection in the related art, as well as the problems of low detection efficiency and accuracy.
[0005] In a first aspect, an embodiment of the present application provides a defect detection method, the method comprising:
[0006] Dividing the image of the connector to be inspected into multiple areas according to the functional components in the connector;
[0007] The detection methods corresponding to each functional component are applied respectively to perform defect detection on the area corresponding to each functional component.
[0008] Since the functions of each area are different, if the same detection method is used for the entire area to be detected, the detection effect of the detection method in a certain area may be better, but the detection effect in another area may be poor. At this time, the detection result corresponding to this detection method is used as the connector defect detection result, which is easy to cause over-detection and / or missed detection problems, resulting in low detection efficiency and accuracy. In the embodiment of the present application, the area is divided according to the function of each component in the connector, and each area is detected using a detection method that conforms to the characteristics of the area, which is highly targeted, thereby avoiding the problem of over-detection and / or missed detection, and thus the detection efficiency and accuracy are higher.
[0009] In some exemplary embodiments, the image of the connector to be detected is divided into multiple areas according to the functions of each component in the connector, including: calculating an affine matrix based on the connector image to be detected and a standard connector image, wherein the affine matrix represents the pose relationship between the connector image to be detected and the standard connector image; dividing the connector image to be detected into multiple areas according to the pose relationship and the area division result of the standard connector image.
[0010] In this way, based on the regional division result of the standard connector image and the posture relationship between the connector image to be detected and the standard connector image, the image to be detected is rotated or translated to perform regional division on the connector image to be detected. Compared with directly applying the existing image processing method to directly perform regional division on the image to be detected, on the one hand, the regional division result is more accurate, and on the other hand, a certain deviation of the connector itself can be allowed, which can be corrected through the rotation or translation process, thereby enhancing the robustness of the detection system.
[0011] In some exemplary embodiments, the area includes a gold finger area to be detected; and the respectively applying the detection method corresponding to each function to perform defect detection on the area corresponding to each function includes: applying the Euclidean distance detection method to perform defect detection on the gold finger area to be detected.
[0012] Since the gold finger area has its own unique shape and arrangement characteristics, such as relative position relationship, and each gold finger has the same shape, shape defects may also affect the arrangement. Therefore, for the gold finger area to be detected, the Euclidean distance detection method is applied to detect the defects of each gold finger, and the gold finger detection will not be missed. In this way, the detection is more targeted, accurate and efficient.
[0013] In some exemplary embodiments, the area includes a first baffle area to be detected and a second baffle area to be detected, and the detection methods corresponding to each function are applied respectively to perform defect detection on the areas corresponding to each function, including: applying a Pearson correlation coefficient detection method to perform defect detection on the first baffle area to be detected and the second baffle area to be detected.
[0014] In this way, the baffle area includes the structural characteristics of the baffle, and the Pearson correlation coefficient detection method can calculate the correlation between the two variables. The variables here can be characteristic parameters of the baffle area, etc. Therefore, combined with the characteristics of the baffle area, a detection method suitable for the area is adopted, and the detection is more targeted, accurate and efficient.
[0015] In some exemplary embodiments, the area includes a reinforcement plate area; and the respectively applying a detection method corresponding to each function to perform defect detection on the area corresponding to each function includes: applying a dynamic local threshold segmentation method to perform defect detection on the reinforcement plate area.
[0016] The reinforcement plate area usually has a simple structure, and the focus is on whether a certain position in the area is too bright or too dark. Therefore, using gray value threshold to perform dynamic local threshold segmentation for defect detection can make the detection of this area more targeted.
[0017] In some exemplary embodiments, the application of the Euclidean distance detection method to perform defect detection on the gold finger area to be detected includes: if the absolute value of the distance difference between the Euclidean distance and the standard Euclidean distance is greater than a set distance difference threshold, it is determined that there is a defect in the gold finger area to be detected; wherein the Euclidean distance includes the Euclidean distance between adjacent gold fingers in the gold finger area to be detected; the standard Euclidean distance includes the average value of the Euclidean distances between adjacent gold fingers in corresponding directions in the standard gold finger area in the standard connector image.
[0018] In this way, the standard Euclidean distance is the average value of the Euclidean distances between adjacent golden fingers in the standard golden finger area, avoiding the influence caused by the accidental error in the distance between two golden fingers in the standard golden finger area; in addition, the distance between adjacent golden fingers to be detected is compared with the standard Euclidean distance, so as to realize the detection of golden finger defects more targetedly and with higher accuracy.
[0019] In some exemplary embodiments, the application of the Pearson correlation coefficient detection method to perform defect detection on the first baffle area to be detected includes: if at least one of the first Pearson correlation coefficient and the second Pearson correlation coefficient is less than a set correlation coefficient threshold, determining that the first baffle area to be detected has a defect; wherein the first Pearson correlation coefficient includes the Pearson correlation coefficient between the horizontal projection curve of the first baffle area to be detected and the horizontal projection curve of the standard first baffle area of the standard connector image; the second Pearson correlation coefficient includes the Pearson correlation coefficient between the vertical projection curve of the first baffle area to be detected and the vertical projection curve of the standard first baffle area of the standard connector image;
[0020] The method of applying the Pearson correlation coefficient detection method to perform defect detection on the second baffle area to be detected includes: if at least one of the third Pearson correlation coefficient and the fourth Pearson correlation coefficient is less than a set correlation coefficient threshold, determining that the second baffle area to be detected has a defect; wherein the third Pearson correlation coefficient includes the Pearson correlation coefficient between the horizontal projection curve of the second baffle area to be detected and the horizontal projection curve of the standard second baffle area of the standard connector image; and the fourth Pearson correlation coefficient includes the Pearson correlation coefficient between the vertical projection curve of the second baffle area to be detected and the vertical projection curve of the standard second baffle area of the standard connector image.
[0021] In this way, due to the unique characteristics of the baffle area, the horizontal projection curve and the vertical projection curve of the area image are obtained, and then according to the principle of the Pearson correlation coefficient method, the horizontal projection curve and the vertical projection curve are used as the parameters of the Pearson correlation coefficient method; each projection curve is respectively calculated with the projection curve of the corresponding standard baffle area. Therefore, the detection method conforms to the characteristics of the baffle area, making the detection efficiency and accuracy higher.
[0022] In some exemplary embodiments, the dynamic local threshold segmentation method is applied to perform defect detection on the reinforcement plate area to be detected, including: if the number of defective pixels in at least one sub-area in the reinforcement plate area to be detected is greater than a set number threshold, it is determined that there is a defect in the reinforcement plate area to be detected; wherein the grayscale difference between the grayscale value of the defective pixel and the average grayscale value of the corresponding preset reference pixel is greater than the set grayscale difference threshold, and the distance between the defective pixel and the corresponding reference pixel satisfies the set distance condition.
[0023] The average grayscale value of a preset reference pixel is used to determine whether the grayscale value of a certain pixel is too large or too small, indicating that the brightness of the pixel is significantly different from that of the reference pixel, and the pixel is then judged to be a defective pixel. The defect condition of the sub-region is then judged based on the number of defective pixels, and the defect condition of the entire reinforcement plate region is then judged. In this way, each pixel is judged, which will not result in missed detection and / or over-detection, and has high accuracy and efficiency. In a second aspect, an embodiment of the present application provides a defect detection device, which includes:
[0024] A region division module divides the image of the connector to be inspected into multiple regions according to the functional components in the connector;
[0025] The defect detection module is used to apply the detection method corresponding to each functional component respectively to perform defect detection on the area corresponding to each functional component.
[0026] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above methods when executing the computer program.
[0027] In a fourth aspect, an embodiment of the present application provides a computer storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the steps of any of the above methods are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0029] Figure 1 A flowchart of a defect detection method provided in an embodiment of the present application;
[0030] Figure 2 A flowchart of another defect detection method provided in an embodiment of the present application;
[0031] Figure 3 A schematic diagram of the area division of a standard connector applicable to an embodiment of the present application;
[0032] Figure 4 A schematic diagram of a defective connector applicable to an embodiment of the present application;
[0033] Figure 5 It is a schematic diagram of a golden finger Euclidean distance calculation applicable to the embodiment of the present application;
[0034] Figure 6 is a schematic diagram of a horizontal projection curve of a first baffle region of a standard connector image applicable in an embodiment of the present application;
[0035] Figure 7 is a schematic diagram of a vertical projection curve of a first baffle region of a standard connector image applicable in an embodiment of the present application;
[0036] Figure 8 It is a schematic diagram of a horizontal projection curve of a second baffle area of a connector image to be detected applicable to an embodiment of the present application;
[0037] Fig. 9 It is a schematic diagram of a vertical projection curve of a second baffle area of a connector image to be detected applicable in an embodiment of the present application;
[0038] Fig.10is a structural schematic diagram of a defect detection device applicable to an embodiment of the present application;
[0039] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all 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.
[0041] First, the applicable scenarios and related terms of the embodiments of the present application are explained.
[0042] A connector is an electronic connector, or circuit connector, which is a conductor device that bridges two conductors on a loop so that current or signal can flow from one conductor to another. In the embodiment of the present application, the defect detection process of a type of connector used between a camera module and a mobile phone motherboard can be used for illustration.
[0043] In the related art, the defect detection of connectors is manual detection or the application of a specific method to detect the entire image of the connector to be detected. Among them, when faced with a large number of connectors to be detected, manual detection is not only slow, but also may cause detection errors due to human fatigue, and waste manpower and material resources. The connector is composed of various functional components, and the structure of each functional component is different. Therefore, when a specific method is applied to detect the entire connector to be detected, the method may not be applicable to the defect detection of each functional component.
[0044] In the embodiment of the present application, the image of the connector to be inspected is divided into regions according to each functional component, for example, into a gold finger region, a baffle region, and a reinforcement plate region, and then for each region, a defect detection method matching the structure and / or function of the region is used for detection. During the detection process, a standard connector image with the same model as the connector to be inspected and without any defects is obtained in advance, and the standard connector image has been divided into regions according to the gold finger region, the baffle region, and the reinforcement plate region. Based on the standard connector image, the image of the connector to be inspected can be distinguished and divided.
[0045] Accordingly, the detection methods used for each area are as follows:
[0046] If the gold finger area is a plurality of gold fingers arranged according to certain rules, the area can be detected by using the Euclidean distance detection method, that is, the Euclidean distance between any two adjacent gold fingers to be detected is compared with the standard Euclidean distance calculated in the standard gold finger area to determine whether the gold finger to be detected has defects, and then determine whether the gold finger area to be detected has defects.
[0047] The baffle area includes an upper baffle area and a lower baffle area. Generally, the upper and lower baffles have the same structure and function. Therefore, the detection methods for the upper and lower baffle areas are the same. Here, only the detection process of the upper baffle area is described. For the convenience of description, the upper baffle area can be referred to as the first baffle area, and the lower baffle area can be referred to as the second baffle area.
[0048] Taking the first baffle area as an example, after the image of the baffle area is calculated according to the grayscale values of the pixels, a horizontal projection curve and a vertical projection curve can be obtained, wherein the horizontal coordinate of the horizontal projection curve is the number of each pixel point in the horizontal direction of the first baffle area, and the vertical coordinate is the sum of the grayscale values of the pixels with the same number in each horizontal direction.
[0049] The Pearson correlation coefficient is defined as the quotient of the covariance and standard deviation between two variables, which can characterize the correlation between the two variables. Taking the first baffle area to be inspected as an example, the two variables can be the horizontal projection curve of the first baffle area to be inspected and the horizontal projection curve of the standard first baffle area of the standard connector image. In this way, the calculated Pearson correlation coefficient can be used to determine the relationship between the grayscale values of the pixels in the first baffle area to be inspected and the standard first baffle area, and based on this relationship, it can be determined whether there is a defect in the first baffle area to be inspected.
[0050] Correspondingly, the defect detection method of the second baffle area to be detected is the same as the defect detection principle of the first baffle area to be detected and the calculation method of the Pearson coefficient, which will not be repeated here. The reinforcement plate mainly solves the flexibility problem of the flexible circuit board, improves the strength of the plug-in part, and facilitates the overall assembly of the product. The structure of the reinforcement plate is relatively simple, and the focus is on whether a certain position in the area is too bright or too dark, and the grayscale value is the direct influencing factor of the brightness of the pixel. Therefore, the grayscale value threshold is used for dynamic local threshold segmentation, and the grayscale difference between each pixel and the average grayscale value of its preset reference pixel is compared to determine whether there is a defect in the reinforcement plate area.
[0051] The following is an example of a connector used between a camera module and a mobile phone motherboard.
[0052] Figure 1 is a flowchart of a defect detection method provided in an embodiment of the present application, refer to Figure 1, specifically including the following steps:
[0053] S101 . Divide the image of the connector to be inspected into multiple areas according to functional components in the connector.
[0054] In the defect detection of connectors, testing the entire connector according to the same detection rule is likely to cause inaccurate detection results. However, the connector includes various functional components. According to the characteristics of different functional components, different detection methods can be used to improve the detection accuracy. Therefore, according to the various functional components in the connector, the acquired connector image to be detected is divided into multiple areas.
[0055] S102, respectively apply the detection methods corresponding to the functional components to perform defect detection on the areas corresponding to the functional components.
[0056] Specifically, different functional components correspond to different detection methods, and multiple areas are divided according to functions. Therefore, when presented on the image of the connector to be detected, the area corresponding to each functional component is detected using the detection method corresponding to the functional component.
[0057] In the embodiment of the present application, since the functions of each area are different, if the same detection method is used for the entire area to be inspected, it may cause the detection effect of this detection method to be better in a certain area, while the detection effect in another area is not good. At this time, the detection result corresponding to this detection method is used as the connector defect detection result, which is easy to cause over-inspection and / or missed detection problems, resulting in low detection efficiency and accuracy; whereas, in the embodiment of the present application, areas are divided according to the functions of each component in the connector, and each area is inspected using a detection method that conforms to the characteristics of the area, which is highly targeted, thereby avoiding the problem of over-inspection and / or missed detection, and thus achieving higher detection efficiency and accuracy.
[0058] Figure 2 is a flow chart of another defect detection method provided in an embodiment of the present application, which is a specific implementation of the above-mentioned defect detection method. Figure 2 , specifically including the following steps:
[0059] S201. Calculate an affine matrix according to the connector image to be detected and the standard connector image, wherein the affine matrix represents the position and posture relationship between the connector image to be detected and the standard connector image.
[0060] First, the definition of the affine matrix is explained. The affine matrix is also called the affine transformation matrix. It is geometrically defined as an affine transformation or affine mapping between two vector spaces, consisting of a non-singular transformation followed by a translation transformation. In addition, the standard connector image refers to an image of a defect-free standard connector that is consistent with the connector model to be inspected. In the image of the standard connector, the regions have been divided according to the functions of each component.
[0061] Specifically, an affine matrix between the two is calculated based on the image coordinate matrix of the center point of the gold finger of the connector image to be detected and the image coordinate matrix of the center point of the gold finger of the standard connector. Exemplarily, the posture relationship between the connector image to be detected and the standard connector image can be determined based on each element of the affine matrix. In a specific example, the posture relationship can refer to the deviation of the position and posture of device A in the connector image to be detected and device A in the standard connector image.
[0062] S202 , dividing the connector image to be detected into multiple regions according to the position and posture relationship and the region division result of the standard connector image.
[0063] Specifically, the connector image to be tested is divided into regions according to the positional relationship between the device in each connector image to be tested and the corresponding device of the standard connector. For example, the connector image to be tested is corrected according to the positional relationship so that it matches the position of the corresponding device in the standard connector image, so that the connector image to be tested is also divided into multiple regions according to the regions that have been divided in the standard connector image. In this way, a certain deviation of the connector itself can be allowed, which can enhance the robustness of the detection system.
[0064] S2031. Use the Euclidean distance detection method to perform defect detection on the gold finger area to be detected.
[0065] In a specific example, a connector that can be used between a camera and a mobile phone motherboard is used as an example. Figure 3 A schematic diagram of the area division of a standard connector is shown, referring to Figure 3 The connector is divided into a gold finger area 301, a baffle area 302 and a reinforcement plate area 303 according to functions. The baffle area 302 includes an upper baffle area and a lower baffle area. For the convenience of description, the upper baffle is called the first baffle and the lower baffle is called the second baffle. Figure 4 A schematic diagram of the area division of a defective connector is shown, referring to Figure 4 , gold finger area 401, baffle area 402 and reinforcement plate area 403, for example, there is a defective gold finger in the defective connector, as shown in 404. The upper baffle and the lower baffle have the same structure, so Figure 3 and Figure 4No distinction is made.
[0066] In addition, ROI (region of interest) is an area to be processed in the image being processed in the form of a box, circle, ellipse or irregular polygon in machine vision and image processing. In the embodiment of the present application, the gold finger area is the gold finger ROI area, the baffle area is the baffle ROI area, and the reinforcement plate area is the reinforcement plate ROI area. The processing of the ROI area can reduce the processing time and increase the processing accuracy.
[0067] Among them, Euclidean distance is a commonly used distance definition, which refers to the real distance between two points in multidimensional space, or the natural length of a vector. For example, the Euclidean distance in two-dimensional and three-dimensional space is the real distance between two points. Specifically, after intercepting the gold finger area to be detected, the grayscale threshold is segmented to obtain a binary image of the gold finger area to be detected. Based on the binary image, the Euclidean distance between adjacent gold fingers is detected and compared with the standard Euclidean distance calculated in the standard connector image to perform defect detection.
[0068] Optionally, the detection of the gold finger area can be specifically achieved in the following manner: if the absolute value of the distance difference between the Euclidean distance and the standard Euclidean distance is greater than a set distance difference threshold, it is determined that there is a defect in the gold finger area to be detected; wherein the Euclidean distance includes the Euclidean distance between adjacent gold fingers in the gold finger area to be detected; and the standard Euclidean distance includes the average value of the Euclidean distances between adjacent gold fingers in corresponding directions in the standard gold finger area in the standard connector image.
[0069] The image of the standard gold finger area in the standard connector image is also binarized using the same grayscale threshold to improve the defect detection accuracy.
[0070] In a specific example, the connector has 24 gold fingers distributed in two rows, with 12 in each row. The Euclidean distance between two adjacent gold fingers is calculated. The adjacent here includes the upper and lower adjacent and the left and right adjacent. The horizontal Euclidean distance is called the horizontal Euclidean distance, which is expressed as D h Indicates that the vertical Euclidean distance is called the vertical Euclidean distance, and D v In a specific example, Figure 5 A schematic diagram of golden finger Euclidean distance calculation is shown.
[0071] The standard Euclidean distance includes the horizontal standard Euclidean distance and the vertical standard Euclidean distance. The horizontal standard Euclidean distance is the average value of the Euclidean distances between adjacent golden fingers in the horizontal direction in the standard connector image. The vertical standard Euclidean distance is the average value of the Euclidean distances between adjacent golden fingers in the vertical direction in the standard connector image.
[0072] For example, the set distance difference distance may be a certain multiple of the corresponding standard Euclidean distance, and the multiple may be a number greater than 0.1. Specifically, the horizontal Euclidean distance and the vertical Euclidean distance between adjacent golden fingers in the connector image to be detected are calculated one by one. Taking the horizontal or vertical direction as an example, V is the Euclidean distance between any two adjacent golden fingers in the connector image to be detected, and V S is the standard Euclidean distance, T d is the judgment threshold, for example, a number greater than 0.1 can be used. The judgment condition can be expressed as abs(VV s )>T d *V s , if the condition is met, it is determined that the two gold fingers are defective, that is, the gold finger area to be detected is defective. In the actual application process, defect detection is performed on each gold finger, and the degree of defect in the gold finger area to be detected can also be determined by the number of defective gold fingers.
[0073] S2032, using a Pearson correlation coefficient detection method to perform defect detection on the first baffle area to be detected and the second baffle area to be detected.
[0074] Still refer to Figure 3 The baffle area 302 is divided into a first baffle area and a second baffle area, which correspond to the upper baffle area and the lower baffle area respectively. The structures of the upper baffle area and the lower baffle area are the same, so the detection method is also the same.
[0075] The Pearson correlation coefficient is defined as the quotient of the covariance and standard deviation between two variables, which can characterize the correlation between the two variables. Taking the first baffle area to be detected as an example, the two variables can be the horizontal projection curve of the first baffle area to be detected and the horizontal projection curve of the standard first baffle area of the standard connector image.
[0076] For example, Figure 6 A schematic diagram of a horizontal projection curve of a first baffle area of a standard connector image is shown; Figure 7 A schematic diagram of a vertical projection curve of the first baffle area of a standard connector image is shown; Figure 8 A schematic diagram of a horizontal projection curve of a second baffle area of a connector image to be detected is shown; Fig. 9 A schematic diagram of a vertical projection curve of the second baffle area of a connector image to be detected is shown. Specifically, Figure 6-Figure 9In the figure, the horizontal coordinate of the horizontal projection curve is the horizontal number of each pixel in the current baffle area, and the vertical coordinate of the horizontal projection curve is the sum of the grayscale values of the pixels with the same number in each horizontal direction; the horizontal coordinate of the vertical projection curve is the vertical number of each pixel in the current baffle area, and the vertical coordinate of the projection curve is the sum of the grayscale values of the pixels with the same number in each vertical direction. If it is a standard connector image, the current baffle area is the standard first baffle area; if it is a connector image to be detected, the current baffle area is the first baffle area to be detected, Figure 6-Figure 9 The horizontal axis px in the value is the number of the corresponding pixel point, and the vertical axis is the sum of the corresponding grayscale values.
[0077] Optionally, a Pearson correlation coefficient detection method is applied to perform defect detection on the first baffle area to be inspected, which can be specifically achieved in the following manner: if at least one of the first Pearson correlation coefficient and the second Pearson correlation coefficient is less than a set correlation coefficient threshold, it is determined that there is a defect in the first baffle area to be inspected; wherein the first Pearson correlation coefficient includes the Pearson correlation coefficient between the horizontal projection curve of the first baffle area to be inspected and the horizontal projection curve of the standard first baffle area of the standard connector image; and the second Pearson correlation coefficient includes the Pearson correlation coefficient between the vertical projection curve of the first baffle area to be inspected and the vertical projection curve of the standard first baffle area of the standard connector image.
[0078] Specifically, the image size of the first baffle area to be detected is m*n, m represents the number of row pixels, n represents the number of column pixels, the horizontal projection curve is represented by Hp, and the vertical projection curve is represented by Vp. The calculation methods are as follows:
[0079]
[0080]
[0081] Among them, i is an integer between 1 and m, j is an integer between 1 and n, Hp(i) is the sum of the grayscale values of the pixel points with abscissa i in the baffle area image, and Vp(j) is the sum of the grayscale values of the pixel points with abscissa j in the baffle area image.
[0082] Calculate the first Pearson correlation coefficient r between the horizontal projection curve of the first baffle area to be detected and the horizontal projection curve of the standard first baffle area of the standard connector image h1 The second Pearson correlation coefficient r between the vertical projection curve of the first baffle area to be detected and the vertical projection curve of the standard first baffle area of the standard connector image v1 The general calculation formula of Pearson correlation coefficient is:
[0083]
[0084] Wherein, r is a general term for the Pearson correlation coefficient. In the embodiment of the present application, taking the first baffle area as an example, x i is the value of the ordinate when the abscissa is i in the horizontal projection curve of the image of the first baffle area to be measured, and x is the average value of the ordinates when the abscissa is 1 to m in the horizontal projection curve of the image of the first baffle area to be measured; y i is the value of the ordinate when the abscissa is i in the horizontal projection curve of the image of the standard first baffle area, and y is the average value of each ordinate when the abscissa is 1 to m in the horizontal projection curve of the image of the standard first baffle area. It should be noted that by transforming the values of each variable in the formula, each Pearson correlation coefficient can be obtained.
[0085] In an embodiment of the present application, the Pearson correlation coefficient calculated by using the projection curve of the baffle area to be detected and the projection curve of the standard baffle area as variables characterizes the relationship between the grayscale values of the pixels of the baffle area to be detected and the grayscale values of the pixels of the standard baffle area. Therefore, it is possible to determine whether there is a defect in the baffle area to be detected by judging the size relationship between the obtained Pearson correlation coefficient and the set correlation coefficient threshold. Specifically, if at least one of the first Pearson correlation coefficient and the second Pearson correlation coefficient is less than the set correlation coefficient threshold, it is determined that there is a defect in the first baffle area to be detected. In a specific example, the set correlation coefficient threshold can be represented by Tr, for example, it can take any value between 0.7 and 0.9.
[0086] Optionally, a Pearson correlation coefficient detection method is applied to perform defect detection on the second baffle area to be inspected, which can be specifically achieved in the following manner: if at least one of the third Pearson correlation coefficient and the fourth Pearson correlation coefficient is less than a set correlation coefficient threshold, it is determined that there is a defect in the second baffle area to be inspected; wherein the third Pearson correlation coefficient includes the Pearson correlation coefficient between the horizontal projection curve of the second baffle area to be inspected and the horizontal projection curve of the standard second baffle area of the standard connector image; and the fourth Pearson correlation coefficient includes the Pearson correlation coefficient between the vertical projection curve of the second baffle area to be inspected and the vertical projection curve of the standard second baffle area of the standard connector image.
[0087] The third Pearson correlation coefficient between the horizontal projection curve of the second baffle area to be detected and the horizontal projection curve of the standard second baffle area of the standard connector image is expressed as r h2 The fourth Pearson correlation coefficient r between the vertical projection curve of the second baffle area to be detected and the vertical projection curve of the standard second baffle area of the standard connector image is: v2Correspondingly, the defect detection method of the second baffle area to be detected is the same as the defect detection principle of the first baffle area to be detected and the calculation method of the Pearson coefficient, which will not be repeated here.
[0088] S2033. Apply a dynamic local threshold segmentation method to perform defect detection on the reinforcement plate area.
[0089] Among them, the dynamic local threshold segmentation method refers to segmentation based on the grayscale value of each pixel within a local range according to the dynamic grayscale value threshold. Among them, for each pixel point, the method of determining whether it is a defective pixel point is to apply the average value of the grayscale values of its corresponding multiple reference pixels to judge, and the reference pixel point can be a plurality of pixels that meet the set distance condition from the pixel point, and the set distance condition is, for example, a distance of 5 pixels. In this way, the grayscale difference between the grayscale value of each pixel point and the average value of the grayscale values of each corresponding reference pixel point is calculated. If the grayscale difference is greater than the set grayscale difference threshold, it indicates that the pixel point is a defective pixel point. In a specific example, for example, if the grayscale value of the current pixel point is 10, the average grayscale value of the corresponding preset reference pixel point is 20, and the grayscale difference threshold is set to 5, then the pixel point is a defective pixel point.
[0090] Specifically, the reinforcement plate area to be detected is divided into several sub-areas, and if the number of defective pixels in at least one sub-area is greater than a set number threshold, it is determined that the reinforcement plate area to be detected has defects. In actual application, it is also possible to directly determine whether the reinforcement plate area has defects based on the number of defective pixels in the entire reinforcement plate area.
[0091] It should be noted that there is no obvious order of detection between the gold finger area, baffle area and reinforcement plate area. Figure 2 The above description is only used for illustration and does not constitute a specific limitation.
[0092] In the embodiment of the present application, the connector image to be inspected is first divided into regions according to the standard connector image with good region division, thus ensuring the accuracy of the region division; then, defect detection is performed by using the Euclidean distance detection method for the gold finger region to be inspected, the Pearson correlation coefficient detection method for the first baffle region to be inspected and the second baffle region to be inspected, and the dynamic threshold segmentation method for the reinforcement plate region. In this way, targeted detection methods are adopted according to different functional components, thereby improving the accuracy and efficiency of defect detection and avoiding the problems of missed detection and / or over-inspection.
[0093] In addition, based on the above technical solution, in the embodiment of the present application, if any of the gold finger area to be detected, the baffle area to be detected, and the reinforcement plate area to be detected has a defect, a "defective" prompt can be output by voice or text, such as "NG" so that the operation and maintenance personnel can handle it in time. If all areas are free of defects, a "normal detection" prompt can be output by voice or text, such as "OK".
[0094] Fig.10 1 is a schematic diagram of a defect detection device provided in an embodiment of the present application, which is used to execute the defect detection method provided in an embodiment of the present application. The defect detection device specifically includes a region division module 11 and a defect detection module 12.
[0095] The region division module 11 divides the connector image to be inspected into multiple regions according to the functional components in the connector; the defect detection module 12 is used to apply the detection method corresponding to each functional component respectively to perform defect detection on the region corresponding to each functional component.
[0096] In the embodiment of the present application, since the functions of each area are different, if the same detection method is used for the entire area to be inspected, it may cause the detection effect of this detection method to be better in a certain area, while the detection effect in another area is not good. At this time, the detection result corresponding to this detection method is used as the connector defect detection result, which is easy to cause over-inspection and / or missed detection problems, resulting in low detection efficiency and accuracy; whereas, in the embodiment of the present application, areas are divided according to the functions of each component in the connector, and each area is inspected using a detection method that conforms to the characteristics of the area, which is highly targeted, thereby avoiding the problem of over-inspection and / or missed detection, and thus achieving higher detection efficiency and accuracy.
[0097] Optionally, the area division module 11 is specifically used for:
[0098] Calculating an affine matrix according to the connector image to be detected and the standard connector image, wherein the affine matrix represents the positional relationship between the connector image to be detected and the standard connector image;
[0099] According to the posture relationship and the region division result of the standard connector image, the connector image to be detected is divided into multiple regions.
[0100] Optionally, the area includes a gold finger area to be detected, and the defect detection module 12 is specifically used for:
[0101] The Euclidean distance detection method is used to perform defect detection on the gold finger area to be detected.
[0102] Optionally, the region includes a first baffle region to be detected and a second baffle region to be detected, and the defect detection module is specifically used to:
[0103] The Pearson correlation coefficient detection method is used to perform defect detection on the first baffle area to be detected and the second baffle area to be detected.
[0104] Optionally, the region includes a reinforcement plate region; the defect detection module 12 is specifically used for:
[0105] The dynamic local threshold segmentation method is used to detect defects in the reinforcement plate area.
[0106] Optionally, the defect detection module 12 is specifically used for:
[0107] When the absolute value of the distance difference between the Euclidean distance and the standard Euclidean distance is greater than the set distance difference threshold, it is determined that there is a defect in the gold finger area to be detected;
[0108] The Euclidean distance includes the Euclidean distance between adjacent golden fingers in the golden finger area to be detected; the standard Euclidean distance includes the average value of the Euclidean distance between adjacent golden fingers in corresponding directions in the standard golden finger area in the standard connector image.
[0109] Optionally, the defect detection module 12 is specifically used for:
[0110] When at least one of the first Pearson correlation coefficient and the second Pearson correlation coefficient is less than a set correlation coefficient threshold, it is determined that there is a defect in the first baffle area to be inspected;
[0111] The first Pearson correlation coefficient includes the Pearson correlation coefficient between the horizontal projection curve of the first baffle area to be detected and the horizontal projection curve of the standard first baffle area of the standard connector image; the second Pearson correlation coefficient includes the Pearson correlation coefficient between the vertical projection curve of the first baffle area to be detected and the vertical projection curve of the standard first baffle area of the standard connector image;
[0112] When at least one of the third Pearson correlation coefficient and the fourth Pearson correlation coefficient is less than a set correlation coefficient threshold, it is determined that there is a defect in the second baffle area to be inspected;
[0113] Among them, the third Pearson correlation coefficient includes the Pearson correlation coefficient between the horizontal projection curve of the second baffle area to be detected and the horizontal projection curve of the standard second baffle area of the standard connector image; the fourth Pearson correlation coefficient includes the Pearson correlation coefficient between the vertical projection curve of the second baffle area to be detected and the vertical projection curve of the standard second baffle area of the standard connector image.
[0114] Optionally, the defect detection module 12 is specifically used for:
[0115] When the number of defective pixels in at least one sub-region of the reinforcement plate region to be detected is greater than a set number threshold, it is determined that there is a defect in the reinforcement plate region to be detected;
[0116] Among them, the grayscale difference between the grayscale value of the defective pixel and the average grayscale value of the corresponding preset reference pixel is greater than the set grayscale difference threshold, and the distance between the defective pixel and the corresponding reference pixel meets the set distance condition.
[0117] The defect detection device proposed in the embodiment of the present application adopts the same inventive concept and the same implementation means as the above-mentioned defect detection method, and can achieve the same beneficial effects, which will not be repeated here.
[0118] Based on the same inventive concept as the above-mentioned defect detection method, the embodiment of the present application also provides an electronic device, which can be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), a server, etc. Fig.11 As shown, the electronic device 110 may include a processor 1101 and a memory 1102 .
[0119] Processor 1101 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DigitalSignal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware processor to be executed, or a combination of hardware and software modules in the processor can be executed.
[0120] Memory 1102, as a non-volatile computer storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. Memory can include at least one type of storage medium, for example, can include flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), programmable read-only memory (Programmable Read Only Memory, PROM), read-only memory (Read Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic memory, disk, optical disk, etc. Memory is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 1102 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0121] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; the above computer storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to: mobile storage devices, random access memory (RAM, Random Access Memory), magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO)), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)) and other media that can store program codes.
[0122] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: a mobile storage device, a random access memory (RAM, Random Access Memory), a magnetic storage device (such as a floppy disk, a hard disk, a magnetic tape, a magneto-optical disk (MO), etc.), an optical storage device (such as CD, DVD, BD, HVD, etc.), and a semiconductor memory (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), a solid-state drive (SSD)) and other various media that can store program codes.
[0123] The above embodiments are only used to introduce the technical solutions of the present application in detail, but the description of the above embodiments is only used to help understand the methods of the embodiments of the present application and should not be understood as limiting the embodiments of the present application. Any changes or substitutions that can be easily thought of by technicians in this technical field should be included in the protection scope of the embodiments of the present application.
Claims
1. A defect detection method, characterized in that: The method includes: Dividing the image of the connector to be inspected into multiple areas according to the functional components in the connector; Apply the detection methods corresponding to each functional component respectively to perform defect detection on the area corresponding to each functional component; Wherein, the image of the connector to be inspected is divided into a plurality of regions according to the functions of the components in the connector, including: Calculating an affine matrix according to the connector image to be detected and the standard connector image, wherein the affine matrix represents the positional relationship between the connector image to be detected and the standard connector image; According to the posture relationship and the region division result of the standard connector image, the connector image to be detected is divided into multiple regions.
2. The method according to claim 1, characterized in that The area includes a gold finger area to be detected; The method of respectively applying the detection methods corresponding to the functions to perform defect detection on the areas corresponding to the functions includes: The defect detection is performed on the gold finger area to be detected by applying the Euclidean distance detection method.
3. The method according to claim 1, characterized in that The area includes a first baffle area to be detected and a second baffle area to be detected, The method of respectively applying the detection methods corresponding to the functions to perform defect detection on the areas corresponding to the functions includes: The Pearson correlation coefficient detection method is applied to perform defect detection on the first baffle area to be detected and the second baffle area to be detected.
4. The method according to claim 1, characterized in that: The area includes a reinforcement plate area; The method of respectively applying the detection methods corresponding to the functions to perform defect detection on the areas corresponding to the functions includes: A dynamic local threshold segmentation method is applied to perform defect detection on the reinforcement plate area.
5. The method according to claim 2, characterized in that: The method of applying the Euclidean distance detection method to perform defect detection on the gold finger area to be detected includes: If the absolute value of the distance difference between the Euclidean distance and the standard Euclidean distance is greater than the set distance difference threshold, it is determined that there is a defect in the gold finger area to be detected; The Euclidean distance includes the Euclidean distance between adjacent golden fingers in the golden finger area to be detected; and the standard Euclidean distance includes the average value of the Euclidean distances between adjacent golden fingers in corresponding directions in the standard golden finger area in the standard connector image.
6. The method according to claim 3, characterized in that: The method of applying the Pearson correlation coefficient detection method to perform defect detection on the first baffle area to be detected includes: If at least one of the first Pearson correlation coefficient and the second Pearson correlation coefficient is less than a set correlation coefficient threshold, it is determined that there is a defect in the first baffle area to be inspected; Wherein, the first Pearson correlation coefficient includes the Pearson correlation coefficient between the horizontal projection curve of the first baffle area to be detected and the horizontal projection curve of the standard first baffle area of the standard connector image; the second Pearson correlation coefficient includes the Pearson correlation coefficient between the vertical projection curve of the first baffle area to be detected and the vertical projection curve of the standard first baffle area of the standard connector image; The method of applying the Pearson correlation coefficient detection method to perform defect detection on the second baffle area to be detected includes: If at least one of the third Pearson correlation coefficient and the fourth Pearson correlation coefficient is less than the set correlation coefficient threshold, it is determined that there is a defect in the second baffle area to be inspected; Among them, the third Pearson correlation coefficient includes the Pearson correlation coefficient between the horizontal projection curve of the second baffle area to be detected and the horizontal projection curve of the standard second baffle area of the standard connector image; the fourth Pearson correlation coefficient includes the Pearson correlation coefficient between the vertical projection curve of the second baffle area to be detected and the vertical projection curve of the standard second baffle area of the standard connector image.
7. The method according to claim 4, characterized in that The method of applying a dynamic local threshold segmentation method to perform defect detection on the reinforcement plate area to be detected includes: If the number of defective pixels in at least one sub-region of the reinforcement plate region to be detected is greater than a set number threshold, it is determined that there is a defect in the reinforcement plate region to be detected; Among them, the defective pixel point represents a pixel point whose grayscale difference between the grayscale value of the target pixel point and the average grayscale value is greater than a set grayscale difference threshold, the average grayscale value is the average value of multiple preset reference pixel points corresponding to the target pixel point, the target pixel point is a pixel point in a sub-area of the reinforcement plate area to be detected, and the preset reference pixel point represents a pixel point whose distance to the target pixel point meets the set distance condition.
8. A defect detection device, characterized in that: include: A region division module, used for dividing the image of the connector to be inspected into multiple regions according to the functional components in the connector; A defect detection module is used to apply the detection method corresponding to each functional component to perform defect detection on the area corresponding to each functional component; The region division module is specifically used to calculate an affine matrix based on the connector image to be detected and the standard connector image, wherein the affine matrix represents the positional relationship between the connector image to be detected and the standard connector image; According to the posture relationship and the region division result of the standard connector image, the connector image to be detected is divided into multiple regions.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Flaw detection method and device of printed circuit board and detection equipment
CN105510348A