PCB board golden finger plug external size detection method and system
By using an iterative threshold segmentation method, the grayscale value and illumination characteristics of the bright connected regions are analyzed to screen out the complete gold finger region, which solves the problem of insufficient detection accuracy in traditional methods and realizes high-precision detection of the shape and size of the PCB board gold finger plug.
Patent Information
- Application Number
- CN202511562961.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-10-30
AI Technical Summary
Traditional segmentation methods using a single threshold are insufficient to completely segment the gold finger connector area of a PCB board, resulting in inadequate detection accuracy.
An iterative threshold segmentation method is adopted. By analyzing the gray value, contour features, illumination attenuation normality factor and volatility of the bright connected region of a single threshold, complete segmentation factors and coefficients are obtained, and complete connected regions of the gold finger are screened out.
This improves the accuracy and reliability of PCB board gold finger plug dimensional inspection, ensuring electrical connection compatibility and product reliability.
Smart Images

Figure CN121033129B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, specifically to a method and system for detecting the external dimensions of a PCB board gold finger plug. Background Technology
[0002] The gold finger pins on a PCB board refer to a row of metal contacts arranged at the plug-in end of the circuit board. Their function is equivalent to an electrical connection interface, enabling high-speed signal transmission, power supply and grounding, and functional signal interaction between the PCB and external devices. To ensure the compatibility between the PCB gold fingers and the slots, avoid insertion / removal difficulties or poor contact, guarantee electrical performance and product reliability, and promptly detect dimensional deviations or defects caused by manufacturing processes, it is necessary to inspect the external dimensions of the PCB gold finger plugs. Accurate inspection of the PCB gold finger plug dimensions requires completely segmenting the gold finger area on the PCB board. However, during PCB board image acquisition, external lighting often affects the image, causing the gold fingers at different locations on the PCB board to exhibit different grayscale representations. This makes it difficult for traditional single-threshold segmentation methods to completely segment all gold finger areas. Summary of the Invention
[0003] This invention provides a method and system for detecting the external dimensions of gold finger plugs on PCB boards, in order to solve the existing problem: traditional segmentation methods based on a single threshold are difficult to completely segment all gold finger areas.
[0004] The present invention provides a method and system for detecting the external dimensions of a PCB board gold finger connector, which adopts the following technical solution:
[0005] One embodiment of the present invention provides a method for detecting the external dimensions of a PCB board gold finger connector, the method comprising the following steps:
[0006] Acquire images of the connector area on the PCB board;
[0007] Iterative thresholding is performed on the plug region image to obtain several bright connected regions for each threshold. Based on the gray value and contour of the single bright connected region of a single threshold, the complete segmentation factor of the single bright connected region of a single threshold is obtained. Based on the area and spatial position of the multiple bright connected regions of a single threshold, the illumination attenuation normalization factor of the single bright connected region of a single threshold is obtained. Combined with the complete segmentation factor of the single bright connected region of a single threshold, the complete segmentation coefficient of the single bright connected region of a single threshold is obtained.
[0008] Based on the changes in the area and spatial position of the highlighted connected regions between adjacent thresholds, the volatility of each highlighted connected region at each threshold is obtained; based on the volatility of each highlighted connected region at each threshold and the complete segmentation coefficient, the degree of complete segmentation of each highlighted connected region at each threshold is obtained.
[0009] The complete gold finger connected region is obtained based on the degree of complete segmentation of each highlighted connected region at each threshold; the outer dimensions of the PCB board gold finger plug are detected based on the complete gold finger connected region.
[0010] Preferably, the specific method for iteratively thresholding the plug region image to obtain each highlighted connected component for each threshold is as follows:
[0011] Preset an initial segmentation threshold Termination Segmentation Threshold With threshold iteration step size The plug region image is segmented based on the threshold descent iteration order to obtain the segmentation result of the plug region image under each threshold. For any segmentation result of the plug region image under any threshold, the connected component formed by the pixels with gray values greater than the threshold in the segmentation result of the plug region image under the threshold is denoted as the highlighted connected component of the threshold.
[0012] Preferably, the method for obtaining the complete segmentation factor of a single highlighted connected region based on the grayscale value and its contour within a single highlighted connected region of a single threshold is as follows:
[0013] For the The threshold of the first Any pixel in the nth highlighted connected component will be the first pixel. The threshold of the first The average of the absolute values of the differences in grayscale values between a pixel in a bright connected region and each pixel in its eight neighboring regions is used as the first... The threshold of the first The prominence of the pixels in the bright connected components; obtain the first The threshold of the first The chain code of the highlighted connected component edge, for the th The threshold of the first Perform a first-order difference operation on the chain code of the highlighted connected component edges to obtain the first... The threshold of the first A first-order difference sequence of chain codes for the highlighted edges of connected components;
[0014] For the The threshold of the first The average of the prominence of all pixels in the first highlighted connected region, multiplied by the first... The threshold of the first The product of the means of all elements in the first-order difference sequence of the chain code of the highlighted connected component edges is negatively correlated and normalized. The result of the negative correlation normalization is used as the first... The threshold of the first The complete splitting factor of a highlighted connected component.
[0015] Preferably, the method for obtaining the illumination attenuation normalization factor of a single bright connected region for a single threshold based on the area and spatial location of multiple bright connected regions for a single threshold includes:
[0016] For the The threshold of the first The highlighted connected component will be the first... The highlighted connected component with the largest area at the threshold is denoted as the i-th threshold. Near-optical connected regions with a threshold value; according to the first threshold value... The threshold of the first The area of the first highlighted connected component and the other highlighted connected components, combined with the area of the first highlighted connected component. The threshold of the first The highlighted connected component and other highlighted connected components are respectively connected to the first highlighted connected component. The distance between near-optical connected components at the threshold is obtained to obtain the first threshold. The threshold of the first A normal factor for illumination attenuation in a bright connected domain.
[0017] Preferably, the acquisition of the first The threshold of the first The illumination attenuation normalization factor for each bright connected region includes the following specific methods:
[0018] ;
[0019] In the formula, Indicates the first The threshold of the first A normal factor for illumination attenuation of a bright connected domain; Indicates the first The number of highlighted connected components for each threshold; Indicates the first The threshold of the first The area of each highlighted connected region; Indicates the first The threshold of the first The area of each highlighted connected region; Indicates the first The threshold of the first The highlighted connected component and the first The distance between near-optical connected regions at each threshold; Indicates the first The threshold of the first The highlighted connected component and the first The distance between near-optical connected regions at each threshold; This represents the sign-resetting function.
[0020] Preferably, the specific method for obtaining the complete segmentation coefficient of a single highlighted connected component for a single threshold is as follows:
[0021] For the The threshold of the first The highlighted connected component will be the first... The threshold of the first The illumination attenuation normality factor of the bright connected domain is the same as that of the first bright connected domain. The threshold of the first The product of the complete partitioning factors of the nth highlighted connected components, as the nth The threshold of the first The complete segmentation coefficients of the highlighted connected components.
[0022] Preferably, the method for obtaining the volatility of each highlighted connected region for each threshold based on the changes in the area and spatial position of the highlighted connected regions between adjacent thresholds includes:
[0023] For the The threshold of the first The highlighted connected component will be the first... The threshold of the first The coordinates of all pixels in the first highlighted connected component are used as the reference coordinates. The highlighted connected component containing the reference coordinate in the threshold is denoted as the i-th threshold. The threshold of the first The corresponding connected component of the highlighted connected component; obtain the first connected component. The threshold of the first Each highlighted connected component and its corresponding centroid coordinates; the first... The threshold of the first The absolute value of the difference in area between the i-th highlighted connected component and its corresponding connected component is denoted as the i-th... The threshold of the first The area change of the highlighted connected component will affect the first... The threshold of the first The area change of the highlighted connected component is related to the first... The mean of the absolute values of the differences between the area changes of each highlighted connected region at each threshold is used as the first threshold. The threshold of the first Area fluctuation of a highlighted connected region;
[0024] The first The threshold of the first The area fluctuation of the highlighted connected components, multiplied by the first... The threshold of the first The centroid coordinates of the highlighted connected component and the first... The threshold of the first The product of the distances between the centroid coordinates of the corresponding connected components of the first highlighted connected component is normalized, and the normalized result is used as the first... The threshold of the first Fluctuations of a highlighted connected domain.
[0025] Preferably, the specific method for obtaining the complete segmentation degree of each highlighted connected component for each threshold is as follows:
[0026] For the The threshold of the first The highlighted connected component will be the first... The threshold of the first The complete segmentation coefficient of the highlighted connected component and the first The threshold of the first The ratio of the volatility of the first highlighted connected component, as the first... The threshold of the first The complete segmentation degree of each highlighted connected component.
[0027] Preferably, the method for obtaining the complete connected component of the gold finger based on the complete segmentation degree of each highlighted connected component at each threshold is as follows:
[0028] Any highlighted connected component of the first threshold is denoted as the predecessor connected component, and the corresponding connected component of the predecessor connected component is denoted as the successor connected component. If the complete segmentation degree of the predecessor connected component is greater than that of the successor connected component, then the predecessor connected component is regarded as the complete golden finger connected component.
[0029] If the complete segmentation degree of the predecessor connected domain is less than or equal to the complete segmentation degree of the successor connected domain, then the successor connected domain and its corresponding connected domain are re-used as the predecessor and successor connected domains, and the comparison of the complete segmentation degree of the predecessor and successor connected domains continues; this process continues until the complete segmentation degree of the predecessor connected domain is greater than the complete segmentation degree of the successor connected domain, thus obtaining the complete golden finger connected domain.
[0030] Another embodiment of the present invention provides a PCB board gold finger plug external dimension detection system, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of any of the above-described PCB board gold finger plug external dimension detection methods.
[0031] The beneficial effects of the technical solution of this invention are as follows: This application acquires images of the plug region, performs iterative threshold segmentation on the plug region images, and obtains each bright connected region of each threshold; the shape of the gold finger in the PCB board is a regular rectangle, and the internal material of the gold finger in the PCB board is consistent. Therefore, by analyzing the grayscale and contour features of the single bright connected region of a single threshold, the complete segmentation factor of the single bright connected region of a single threshold is obtained; since the illumination attenuation normal factor of the bright connected region of the threshold reflects the rationality of the connected region under the overall illumination distribution; if the area change of the bright connected region and its spatial position conform to the distribution trend determined by the illumination attenuation law, it indicates that the formation of the connected region is consistent with the natural reflection characteristics under the light source incident conditions, rather than the contour distortion caused by the threshold setting deviation. Furthermore, combined with the complete segmentation factor of the bright connected region of the threshold, the complete segmentation coefficient of the bright connected region of the threshold is obtained to further accurately evaluate whether the bright connected region of the threshold completely segments the gold finger region.
[0032] It should be further explained that during the iterative threshold segmentation process to obtain the bright connected regions at each threshold, the connected regions corresponding to the actual gold finger metal pins typically exhibit a smooth area change and stable centroid position at adjacent thresholds. However, pseudo connected regions generated by illumination are extremely sensitive to threshold changes, easily exhibiting sudden area changes or positional drift. Therefore, the volatility of the bright connected regions at each threshold is obtained by combining the complete segmentation coefficient of the bright connected regions at each threshold with the complete segmentation coefficient of the bright connected regions at each threshold. After obtaining the complete segmentation coefficient of the bright connected regions at each threshold, the analysis can begin from the segmentation result of the first threshold. By analyzing the change in the complete segmentation coefficient of the bright connected regions at each threshold with the complete segmentation coefficient of the bright connected regions at the next threshold, the complete segmentation coefficient of the bright connected regions at each threshold can be evaluated to determine whether the bright connected regions at each threshold completely segment the gold finger area in the PCB board. This yields each complete gold finger connected region, which is used to accurately detect the external dimensions of the gold finger plug on the PCB board. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a flowchart illustrating the steps of a method for detecting the external dimensions of a PCB board gold finger plug according to the present invention. Detailed Implementation
[0035] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a PCB board gold finger connector external dimension detection method and system proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0036] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0037] The following description, in conjunction with the accompanying drawings, details the specific solution of the PCB board gold finger plug external dimension detection method and system provided by the present invention.
[0038] Please see Figure 1 The diagram illustrates a flowchart of a method for detecting the external dimensions of a PCB board gold finger connector according to an embodiment of the present invention. The method includes the following steps:
[0039] Step S001: Acquire an image of the plug area on the PCB board.
[0040] It should be noted that the gold fingers in a PCB board refer to a row of metal pins arranged at the plug-in end of the PCB board. Their function is equivalent to an electrical connection interface. In order to ensure the compatibility between the PCB board gold fingers and the slot, avoid difficulties in plugging and unplugging or poor contact, and at the same time ensure electrical performance and product reliability, and promptly detect dimensional deviations or defects caused by the manufacturing process, this embodiment proposes a method for detecting the external dimensions of PCB board gold finger plugs. Specifically, it involves acquiring an image of the plug area in the PCB board and analyzing the image of the plug area in the PCB board to detect the dimensions of the PCB board gold fingers.
[0041] Specifically, a high-definition industrial camera is installed on the PCB production line to capture images of the plug area in the PCB, and the plug area in the PCB is grayscale processed to obtain the plug area image (the plug area in the PCB is the part where the PCB is inserted into the slot, and the plug area in the PCB includes the gold finger metal pin part and the substrate between the gold finger metal pins).
[0042] Step S002: Perform iterative threshold segmentation on the plug region image to obtain several bright connected components for each threshold; based on the gray value and contour of a single bright connected component of a single threshold, obtain the complete segmentation factor of a single bright connected component of a single threshold; based on the area and spatial position of multiple bright connected components of a single threshold, obtain the illumination attenuation normalization factor of a single bright connected component of a single threshold; and combine the complete segmentation factor of a single bright connected component of a single threshold to obtain the complete segmentation coefficient of a single bright connected component of a single threshold.
[0043] It should be noted that the plug area image acquired in step S001 includes not only the gold finger metal pins in the PCB board, but also the substrate between the gold finger metal pins. This embodiment, as a method for detecting the external dimensions of a PCB board gold finger plug, requires segmenting the portion corresponding to the gold finger metal pins in the plug area image to detect the PCB board gold finger size. However, when acquiring images of the plug area in the PCB board, the external lighting environment often affects the image, causing the gold finger metal pins at different locations in the PCB board to have different grayscale representations in the plug area image. Consequently, a single threshold cannot completely segment all the portions corresponding to the gold finger metal pins in the plug area image. Therefore, this embodiment proposes a method for detecting the external dimensions of a PCB board gold finger plug. Specifically, it uses iterative threshold segmentation, analyzing whether each connected component in the segmentation results of the plug area under each threshold completely segments the gold finger area in the PCB board. This allows for the selection of connected components from the segmentation results of the plug area under each threshold that segment the gold finger area in the PCB board, thus enabling the detection of the PCB board gold finger size.
[0044] Preferably, in a specific embodiment of the present invention, a preset initial segmentation threshold is provided. Termination Segmentation Threshold With threshold iteration step size The , and The specific value can be set according to the actual situation. This embodiment does not make a hard requirement. In this embodiment, the value is taken as... , , Taking the example of threshold descent iteration, the plug region image is segmented based on threshold descent to obtain the segmentation result of the plug region image under each threshold. For any segmentation result of the plug region image under any threshold, the connected component formed by the pixels with gray values greater than the threshold in the segmentation result of the plug region image under the threshold is denoted as the highlighted connected component of the threshold.
[0045] It should be noted that the gold finger metal pin portion in the plug area image has stronger reflectivity than the substrate portion between the gold finger metal pins. Therefore, under the same lighting conditions, the grayscale value of the gold finger metal pin portion in the plug area image is larger, meaning that the high-brightness connected region of the threshold includes the gold finger region in the PCB board.
[0046] It should be further explained that the gold fingers in the PCB board are regular rectangles, and the internal material of the gold fingers in the PCB board is uniform. Even when affected by external light, the gray values of adjacent pixels inside the gold fingers in the plug area image will not change abruptly. That is, the gray distribution inside the bright connected region that completely segments the gold finger area is uniform. Therefore, based on the gray features of the pixels inside the bright connected region of the threshold and the regularity of its outline, the complete segmentation factor of each bright connected region of each threshold can be obtained, which can be used to evaluate the degree to which each bright connected region of each threshold completely segments the gold finger area in the PCB board.
[0047] Preferably, in a specific embodiment of the present invention, for the first The threshold of the first Any pixel in the nth highlighted connected component will be the first pixel. The threshold of the first The average of the absolute values of the differences in grayscale values between a pixel in a bright connected region and each pixel in its eight neighboring regions is used as the first... The threshold of the first The prominence of the pixels in the bright connected components; obtain the first The threshold of the first The chain code of the highlighted connected component edge, for the th The threshold of the first Perform a first-order difference operation on the chain code of the highlighted connected component edges to obtain the first... The threshold of the first The first-order difference sequence of the chain code of the highlighted connected domain edge is not described in detail in this embodiment, since chain codes are a well-known prior art.
[0048] Furthermore, regarding the first The threshold of the first The average of the prominence of all pixels in the first highlighted connected region, multiplied by the first... The threshold of the first The product of the means of all elements in the first-order difference sequence of the chain code of the highlighted connected component edges is negatively correlated and normalized (using...). The function is normalized for negative correlation, where This represents an exponential function with the natural constant as its base. As input to the model, the implementer can set a negative correlation normalization function according to the actual situation, and use the result of the negative correlation normalization as the first... The threshold of the first The complete splitting factor of a highlighted connected component.
[0049] As an example, obtaining the first The threshold of the first The specific formula for calculating the complete segmentation factor of a highlighted connected component is as follows:
[0050] ;
[0051] In the formula, Indicates the first The threshold of the first The complete segmentation factor of a highlighted connected component; Indicates the first The threshold of the first The average prominence of all pixels in a bright connected region; Indicates the first The threshold of the first The mean of all elements in the first-order difference sequence of the chain code of a highlighted connected component edge; This embodiment uses an exponential function with the natural constant as the base. The model is used to represent the negative correlation normalization process. As input to the model, implementers can set the negative correlation function according to the actual situation.
[0052] It should be noted that the less prominent all pixels are in the highlighted connected region of the threshold, the more uniform the gray-level distribution within the highlighted connected region. Since the gray-level distribution is uniform within the highlighted connected region that completely segments the gold finger region, therefore... The larger the value, the more... The threshold of the first The more a bright connected region is, the better it can represent the grayscale features inside the gold finger region. Since the shape of the gold finger in the PCB board is a regular rectangle, most adjacent elements in the chain code of the gold finger edge are consistent. Therefore, the smaller the mean of all elements in the first-order difference sequence of the chain code of the bright connected region edge of the threshold, the more regular the edge of the bright connected region of the threshold is, and the better it can represent the contour features of the gold finger region. Therefore, the larger the complete segmentation factor of the bright connected region of the threshold is, the better the threshold can completely segment the gold finger region corresponding to the connected region. Furthermore, by using the features of multiple bright connected regions of a single threshold, the illumination attenuation normal factor of the bright connected region of the threshold can be constructed in combination with the complete segmentation factor of the bright connected region of the threshold to further accurately evaluate whether the bright connected region of the threshold completely segments the gold finger region.
[0053] Preferably, in a specific embodiment of the present invention, for the first The threshold of the first The highlighted connected component will be the first... The highlighted connected component with the largest area at the threshold is denoted as the i-th threshold. Near-optical connected regions with a threshold value; according to the first threshold value... The threshold of the first The area of the first highlighted connected component and the other highlighted connected components, combined with the area of the first highlighted connected component. The threshold of the first The highlighted connected component and other highlighted connected components are respectively connected to the first highlighted connected component. The distance between near-optical connected components at the threshold is obtained to obtain the first threshold. The threshold of the first The specific formula for calculating the illumination attenuation normality factor of a bright connected region is as follows:
[0054] ;
[0055] In the formula, Indicates the first The threshold of the first A normal factor for illumination attenuation of a bright connected domain; Indicates the first The number of highlighted connected components for each threshold; Indicates the first The threshold of the first The area of each highlighted connected region; Indicates the first The threshold of the first The area of each highlighted connected region; Indicates the first The threshold of the first The highlighted connected component and the first The distance between near-optical connected regions at each threshold; Indicates the first The threshold of the first The highlighted connected component and the first The distance between near-optical connected regions at each threshold; This represents the sign-resetting function.
[0056] It should be noted that the illumination attenuation normalization factor of the bright connected region at the threshold reflects the rationality of the connected region under the overall illumination distribution. If the area variation of the bright connected region and its spatial position conform to the distribution trend determined by the illumination attenuation law, that is, the connected region with a larger area relatively close to the light source and a smaller area relatively far from the light source, it indicates that the formation of the connected region is consistent with the natural reflection characteristics under the incident light conditions, rather than the contour distortion caused by the threshold setting deviation. Therefore, the larger the illumination attenuation normalization factor of the bright connected region at the threshold, the more its area and position conform to the normal illumination attenuation relationship, and its contour is more likely to correspond to the actual existing gold finger metal pin. By further combining the complete segmentation factor of the bright connected region at the threshold, the complete segmentation coefficient of the bright connected region at the threshold can be obtained, so as to further accurately evaluate whether the bright connected region at the threshold completely segments the gold finger region.
[0057] Specifically, for the first The threshold of the first The highlighted connected component will be the first... The threshold of the first The illumination attenuation normality factor of the bright connected domain is the same as that of the first bright connected domain. The threshold of the first The product of the complete partitioning factors of the nth highlighted connected components, as the nth The threshold of the first The complete segmentation coefficients of the highlighted connected components.
[0058] At this point, the complete segmentation coefficients for each highlighted connected component at each threshold are obtained.
[0059] Step S003: Based on the changes in the area and spatial position of the highlighted connected regions between adjacent thresholds, obtain the volatility of each highlighted connected region for each threshold; based on the volatility of each highlighted connected region for each threshold and the complete segmentation coefficient, obtain the complete segmentation degree of each highlighted connected region for each threshold.
[0060] It should be noted that this implementation obtains the bright connected regions at each threshold through iterative threshold segmentation. In this process, the connected regions corresponding to the actual gold finger metal pins usually exhibit the characteristics of gradual area change and stable centroid position at adjacent thresholds. However, pseudo-connected regions generated by illumination are extremely sensitive to threshold changes and are prone to sudden area changes or position drift. Therefore, by constructing an "area fluctuation" quantification of the sensitivity of the shape to the threshold and combining it with "centroid offset" to measure spatial positioning stability, the fluctuation index of each connected region is obtained. Then, it is combined with the complete segmentation coefficient reflecting the consistency of shape and illumination to calculate the complete segmentation degree used for final evaluation. In this way, connected regions that can completely and stably characterize the gold finger region are screened from all segmentation results, providing a reliable basis for the accurate detection of gold finger size.
[0061] Preferably, in a specific embodiment of the present invention, for the first The threshold of the first The highlighted connected component will be the first... The threshold of the first The coordinates of all pixels in the first highlighted connected component are used as the reference coordinates. The highlighted connected component containing the reference coordinate in the threshold is denoted as the i-th threshold. The threshold of the first The corresponding connected component of the highlighted connected component; obtain the first connected component. The threshold of the first Each highlighted connected component and its corresponding centroid coordinates; the first... The threshold of the first The absolute value of the difference in area between the i-th highlighted connected component and its corresponding connected component is denoted as the i-th... The threshold of the first The area change of the highlighted connected component will affect the first... The threshold of the first The area change of the highlighted connected component is related to the first... The mean of the absolute values of the differences between the area changes of each highlighted connected region at each threshold is used as the first threshold. The threshold of the first Area fluctuation of a highlighted connected region;
[0062] Furthermore, the first The threshold of the first The area fluctuation of the highlighted connected components, multiplied by the first... The threshold of the first The centroid coordinates of the highlighted connected component and the first... The threshold of the first Normalize the product of the distances between the centroid coordinates of the corresponding highlighted connected components (using...). (Normalize the function), and use the normalization result as the first... The threshold of the first Fluctuations of a highlighted connected domain.
[0063] As an example, obtaining the first The threshold of the first The specific formula for calculating the volatility of a highlighted connected component is as follows:
[0064] ;
[0065] In the formula, Indicates the first The threshold of the first Fluctuations in a highlighted connected component; Indicates the first The threshold of the first Area fluctuation of a highlighted connected region; Indicates the first The threshold of the first The centroid coordinates of the highlighted connected component and the first... The threshold of the first The distance between the centroid coordinates of the corresponding connected components of each highlighted connected component; This represents the sigmoid function, which is used for normalization in this embodiment.
[0066] It should be noted that pseudo-connected regions caused by illumination are extremely sensitive to threshold changes, and are prone to sudden changes in area or positional drift. Therefore, the greater the area fluctuation of the highlighted connected region of the threshold, and the greater the distance between the centroid coordinates of the highlighted connected region of the threshold and the centroid coordinates of the corresponding connected region of the same threshold, the more likely the highlighted connected region of the threshold is a pseudo-connected region caused by illumination, and the less likely it is to represent the characteristics of the complete gold finger region. Furthermore, by combining the complete segmentation coefficient of the highlighted connected region of the threshold, the complete segmentation degree of the highlighted connected region of the threshold can be obtained, which is used to filter out the connected regions that segment the gold finger region in the PCB board from the segmentation results of the plug region under each threshold, and accurately detect the shape and size of the gold finger plug on the PCB board.
[0067] Specifically, for the first The threshold of the first The highlighted connected component will be the first... The threshold of the first The complete segmentation coefficient of the highlighted connected component and the first The threshold of the first The ratio of the volatility of the first highlighted connected component, as the first... The threshold of the first The complete segmentation degree of each highlighted connected component.
[0068] At this point, the complete segmentation degree of each highlighted connected component for each threshold is obtained.
[0069] Step S004: Obtain the complete gold finger connected region based on the complete segmentation degree of each highlighted connected region of each threshold; detect the outer dimensions of the PCB board gold finger plug based on the complete gold finger connected region.
[0070] It should be noted that after obtaining the complete segmentation degree of each highlighted connected region of each threshold through step S003, the analysis can start from the segmentation result of the first threshold. By analyzing the change in the complete segmentation degree of each highlighted connected region of the threshold with the complete segmentation degree of each highlighted connected region of the next threshold, it is evaluated whether each highlighted connected region of each threshold completely segments the gold finger area in the PCB board, thereby obtaining each complete gold finger connected region, which is used to accurately detect the shape and size of the gold finger plug on the PCB board.
[0071] Preferably, in a specific embodiment of the present invention, any highlighted connected component of the first threshold is recorded as the predecessor connected component, and the corresponding connected component of the predecessor connected component is recorded as the successor connected component. If the complete segmentation degree of the predecessor connected component is greater than that of the successor connected component, then the predecessor connected component is regarded as the complete gold finger connected component.
[0072] If the complete segmentation degree of the predecessor connected domain is less than or equal to the complete segmentation degree of the successor connected domain, then the successor connected domain and its corresponding connected domain are re-used as the predecessor and successor connected domains, and the comparison of the complete segmentation degree of the predecessor and successor connected domains continues; this process continues until the complete segmentation degree of the predecessor connected domain is greater than the complete segmentation degree of the successor connected domain, thus obtaining the complete golden finger connected domain.
[0073] It should be noted that after obtaining the complete connected domain of the gold finger, the shape and size of the gold finger plug on the PCB board can be detected by comparing the gold finger area in the normal PCB board with the complete connected domain of the gold finger through mask comparison. In this embodiment, the gold finger area at different positions is completely segmented by iterative threshold segmentation, which improves the accuracy of detecting the size of the gold finger.
[0074] Another embodiment of the present invention provides a PCB board gold finger plug shape and size detection system, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a PCB board gold finger plug shape and size detection method in steps S001 to S004.
[0075] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for detecting the external dimensions of a PCB board gold finger connector, characterized in that, The method includes the following steps: Acquire images of the connector area on the PCB board; Iterative threshold segmentation is performed on the plug region image, and connected component extraction is performed on the segmentation results of each threshold to obtain several highlighted connected components for each threshold; based on the gray value and contour of a single highlighted connected component of a single threshold, the complete segmentation factor of a single highlighted connected component of a single threshold is obtained. The method for obtaining the complete segmentation factor of a single highlighted connected region based on the grayscale value and contour of a single highlighted connected region at a single threshold is as follows: For the The threshold of the first Any pixel in the nth highlighted connected component will be the first pixel. The threshold of the first The mean of the absolute values of the differences in grayscale values between a pixel in a bright connected region and each pixel in its eight neighboring regions is used as the first... The threshold of the first The prominence of the pixels in the bright connected components; obtain the first The threshold of the first The chain code of the highlighted connected component edge, for the th The threshold of the first Perform a first-order difference operation on the chain code of the highlighted connected component edges to obtain the first... The threshold of the first A first-order difference sequence of chain codes for the highlighted edges of connected components; For the The threshold of the first The average of the prominence of all pixels in the first highlighted connected region, multiplied by the first... The threshold of the first The product of the means of all elements in the first-order difference sequence of the chain code of the highlighted connected component edges is negatively correlated and normalized. The result of the negative correlation normalization is used as the first... The threshold of the first The complete segmentation factor of a highlighted connected component; Based on the area and spatial location of multiple bright connected regions of a single threshold, the illumination attenuation normal factor of a single bright connected region of a single threshold is obtained. Combined with the complete segmentation factor of a single bright connected region of a single threshold, the complete segmentation coefficient of a single bright connected region of a single threshold is obtained. The specific method for obtaining the complete segmentation coefficient of a single highlighted connected component for a single threshold is as follows: For the The threshold of the first The highlighted connected component will be the first... The threshold of the first The illumination attenuation normality factor of the bright connected domain is the same as that of the first bright connected domain. The threshold of the first The product of the complete partitioning factors of the nth highlighted connected components, as the nth The threshold of the first The complete segmentation coefficients of each highlighted connected component; Based on the changes in the area and spatial position of the highlighted connected regions between adjacent thresholds, the volatility of each highlighted connected region at each threshold is obtained; based on the volatility of each highlighted connected region at each threshold and the complete segmentation coefficient, the degree of complete segmentation of each highlighted connected region at each threshold is obtained. The specific method for obtaining the complete segmentation degree of each highlighted connected component at each threshold is as follows: For the The threshold of the first The highlighted connected component will be the first... The threshold of the first The complete segmentation coefficient of the highlighted connected component and the first The threshold of the first The ratio of the volatility of the first highlighted connected component, as the first... The threshold of the first The degree of complete segmentation of each highlighted connected component; The complete gold finger connected region is obtained based on the degree of complete segmentation of each highlighted connected region at each threshold; the outer dimensions of the PCB board gold finger plug are detected based on the complete gold finger connected region.
2. The method for detecting the external dimensions of a PCB board gold finger connector according to claim 1, characterized in that, The specific method for iteratively thresholding the plug region image and extracting connected components from the segmentation results at each threshold to obtain each highlighted connected component for each threshold is as follows: Preset an initial segmentation threshold Termination Segmentation Threshold With threshold iteration step size ; Threshold segmentation is performed on the plug region image based on the threshold descent iteration order to obtain the segmentation result of the plug region image under each threshold. For any segmentation result of the plug region image under the threshold, the connected component formed by the pixels with gray values greater than the threshold in the segmentation result of the plug region image under the threshold is denoted as the highlighted connected component of the threshold.
3. The method for detecting the external dimensions of a PCB board gold finger connector according to claim 1, characterized in that, The method for obtaining the illumination attenuation normalization factor of a single bright connected region based on the area and spatial location of multiple bright connected regions of a single threshold is as follows: For the The threshold of the first The highlighted connected component will be the first... The highlighted connected component with the largest area at the threshold is denoted as the i-th threshold. Near-optical connected regions with a threshold value; according to the first threshold value... The threshold of the first The area of the first highlighted connected component and the other highlighted connected components, combined with the area of the first highlighted connected component. The threshold of the first The highlighted connected component and other highlighted connected components are respectively connected to the first highlighted connected component. The distance between near-optical connected components at the threshold is obtained to obtain the first threshold. The threshold of the first A normal factor for illumination attenuation in a bright connected domain.
4. The method for detecting the external dimensions of a PCB board gold finger connector according to claim 3, characterized in that, The acquisition of the first The threshold of the first The illumination attenuation normalization factor for each bright connected region includes the following specific methods: ; In the formula, Indicates the first The threshold of the first A normal factor for illumination attenuation of a bright connected domain; Indicates the first The number of highlighted connected components for each threshold; Indicates the first The threshold of the first The area of each highlighted connected region; Indicates the first The threshold of the first The area of each highlighted connected region; Indicates the first The threshold of the first The highlighted connected component and the first The distance between near-optical connected regions at each threshold; Indicates the first The threshold of the first The highlighted connected component and the first The distance between near-optical connected regions at each threshold; This represents the sign-resetting function.
5. The method for detecting the external dimensions of a PCB board gold finger connector according to claim 1, characterized in that, The method for obtaining the volatility of each highlighted connected region at each threshold based on the changes in the area and spatial position of the highlighted connected regions between adjacent thresholds includes the following specific methods: For the The threshold of the first The highlighted connected component will be the first... The threshold of the first The coordinates of all pixels in the first highlighted connected component are used as the reference coordinates. The highlighted connected component containing the reference coordinate in the threshold is denoted as the i-th threshold. The threshold of the first The corresponding connected component of the highlighted connected component; obtain the first connected component. The threshold of the first Each highlighted connected component and its corresponding centroid coordinates; the first... The threshold of the first The absolute value of the difference in area between the i-th highlighted connected component and its corresponding connected component is denoted as the i-th... The threshold of the first The area change of the highlighted connected component will affect the first... The threshold of the first The area change of the highlighted connected component is related to the first... The mean of the absolute values of the differences between the area changes of each highlighted connected region at each threshold is used as the first threshold. The threshold of the first Area fluctuation of a highlighted connected region; The first The threshold of the first The area fluctuation of the highlighted connected components, multiplied by the first... The threshold of the first The centroid coordinates of the highlighted connected component and the first... The threshold of the first The product of the distances between the centroid coordinates of the corresponding connected components of the first highlighted connected component is normalized, and the normalized result is used as the first... The threshold of the first Fluctuations in a highlighted connected domain.
6. The method for detecting the external dimensions of a PCB board gold finger connector according to claim 5, characterized in that, The specific method for obtaining the complete connected component of the gold finger based on the complete segmentation degree of each highlighted connected component at each threshold is as follows: Any highlighted connected component of the first threshold is denoted as the predecessor connected component, and the corresponding connected component of the predecessor connected component is denoted as the successor connected component. If the complete segmentation degree of the predecessor connected component is greater than that of the successor connected component, then the predecessor connected component is regarded as the complete golden finger connected component. If the complete segmentation degree of the predecessor connected domain is less than or equal to the complete segmentation degree of the successor connected domain, then the successor connected domain and its corresponding connected domain are re-used as the predecessor and successor connected domains, and the comparison of the complete segmentation degree of the predecessor and successor connected domains continues; this process continues until the complete segmentation degree of the predecessor connected domain is greater than the complete segmentation degree of the successor connected domain, thus obtaining the complete golden finger connected domain.
7. A PCB board gold finger connector external dimension detection system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed by the processor, it implements the steps of the PCB board gold finger plug shape and size detection method as described in any one of claims 1-6.
Citation Information
Patent Citations
Fast detection method for overall size of photoelectric PCB golden finger plug
CN108981568A
Golden finger scratch detection method and device and electronic equipment
CN113362288A