FPC golden finger surface defect detection method based on image analysis
By building a three-dimensional model and rendering to distinguish the main body and pins, combined with image scaling comparison and multi-dimensional parameter similarity analysis, accurate detection of FPC gold finger surface defects is achieved, solving the problem of non-targeted detection area in existing technologies and improving detection efficiency and reliability.
Patent Information
- Application Number
- CN202511177624.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-10-10
AI Technical Summary
In the existing technology, the defect detection of FPC gold fingers is often global, which lacks specificity. In particular, key areas such as the pin distribution area are easily interfered by global information, resulting in inaccurate detection results.
By constructing a 3D model of the circuit board, rendering and distinguishing the main body and pins, intelligently picking reference areas based on complexity, and combining image scaling comparison and multi-dimensional parameter similarity comparison, accurate detection of FPC gold finger surface defects can be achieved.
It improves the pertinence and accuracy of detection, reduces invalid detection, improves the accuracy and efficiency of defect identification, supports user-defined thresholds, adapts to different detection needs, and assists in production line quality control.
Smart Images

Figure CN120765635A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image analysis, and in particular to a method for detecting surface defects of FPC gold fingers based on image analysis. Background Art
[0002] FPC gold fingers are conductive contacts on the edge of flexible printed circuit boards (FPCs). They are often gold-plated to enhance conductivity and wear resistance. They connect to connectors through plugging and unplugging, enabling circuit signal and current transmission. They are widely used in portable devices such as mobile phones and cameras, offering both flexibility and high reliability.
[0003] The invention patent application with application number 202210568397.9 discloses a method for detecting defects in the gold finger area of a circuit board, comprising the following steps: photographing the circuit to be tested under blue light to obtain an image of the circuit to be tested; identifying the image of the circuit to be tested to obtain the coordinates of the target area, segmenting the image of the circuit to be tested according to the coordinates of the target area to obtain an image of the gold finger area; processing the image of the gold finger area to obtain image data; the processing of the image of the gold finger area comprises the following steps: graying the image of the gold finger area to obtain a gray image; filtering the gray image to obtain a second image; calculating the gray average value of the second image to obtain the Image data; the gold finger area image is an RGB image, and the grayscale processing of the gold finger area image includes the following steps: obtaining the R component and G component of the gold finger area image pixel: performing weighted calculation on the R component and the G component to obtain the pixel grayscale value; generating a grayscale image according to the pixel grayscale value; analyzing the image data to obtain the defect detection result; the analyzing the image data to obtain the defect detection result includes the following steps: comparing the second image data with the grayscale interval size of the standard image. If the second image data is not within the grayscale interval of the standard image, then the gold finger area image has defects. This application aims to solve the problem that "the current inspection of printed circuit boards is usually done by taking pictures using an AOI automatic optical inspection machine, and then classifying the defects by manual visual inspection. However, manual visual inspection is highly subjective, especially for the inspection of gold finger areas with relatively similar features. Long-term manual work will greatly affect the visual inspection results, resulting in inaccurate inspection results."
[0004] However, existing technologies for detecting defects in FPC gold fingers often focus on the entire FPC gold finger, resulting in poor targeting. For example, key areas (pin distribution areas) on the FPC gold finger may be affected by global information on the FPC gold finger.
[0005] Therefore, a detection method for FPC gold finger surface defects based on image analysis is proposed. Summary of the Invention
[0006] In view of the above-mentioned defects of the prior art, the present application provides a FPC gold finger surface defect detection method based on image analysis, which can effectively solve the problems of the prior art.
[0007] To achieve the above object, the present application is implemented by the following technical solutions:
[0008] The present application discloses a FPC gold finger surface defect detection method based on image analysis, comprising:
[0009] Upload the circuit board structure parameters and the edge pin size and distribution information, construct a circuit board three-dimensional model based on the circuit board structure parameters and the edge pin size and distribution information; select a reference surface on the circuit board three-dimensional model, perform reference area picking on the selected reference surface, and use the picked reference area for circuit board defect detection; collect the circuit board surface image output by the circuit board production line, perform background segmentation on the circuit board surface image to extract the to-be-detected circuit board image; scale the to-be-detected circuit board image, so that the longest side of the scaled to-be-detected circuit board image is equal to the longest side of the reference surface, compare the area of the scaled to-be-detected circuit board image with the area of the reference surface, and determine the circuit board pointed to by the to-be-detected circuit board image that is not equal to the area of the reference surface as unqualified circuit board; if the circuit board is determined as qualified, further perform the following detection steps; pick the to-be-detected area image in the to-be-detected circuit board image corresponding to the qualified circuit board, compare the similarity between the to-be-detected area image and the reference area, and finally determine whether the circuit board is qualified; if the circuit board is finally determined as qualified, refresh the steps and detect the newly output circuit board of the circuit board production line again; if the circuit board is finally determined as unqualified, output the defect area on the circuit board
[0010] Further, the edge pin distribution information includes the distance between each adjacent edge pin.
[0011] When selecting the reference surface on the circuit board three-dimensional model, the model surface containing the pin on the circuit board three-dimensional model is selected as the reference surface.
[0012] When performing reference area picking on the reference surface, the following is followed:
[0013] Based on the vertical relative viewing angle, the reference surface image is intercepted on the circuit board three-dimensional model, the reference surface image is subjected to background segmentation to extract the circuit board area image, a sliding recognition window is set, the sliding recognition window is applied to the circuit board area image surface to obtain a plurality of circuit board area local images, the complexity of each local image is analyzed, the picking threshold is set based on the complexity, the local image is picked through the comparison between the picking threshold and the complexity analysis result, and the center coordinates of the source sliding recognition window of the picked local image are marked synchronously.
[0014] The picked local image is the reference area, and the center coordinates of the sliding recognition window are determined with reference to the full image of the area where the circuit board is located. The construction ratio of the circuit board 3D model relative to the circuit board entity is 1:1.
[0015] Furthermore, after the circuit board 3D model is constructed, the circuit board 3D model is rendered to distinguish the main body and the pin part of the circuit board 3D model, and the rendering color is consistent with the color of the main body and the pin part of the circuit board entity;
[0016] The complexity analysis logic of the local image is:
[0017]
[0018] Where: X is the number of pins in the local image, which is determined by the rendering result; F s 、F d 、F k is the structural constraint factor, spatial correlation factor, and morphological distribution coupling factor; W avg is the average width of the pin; D avg is the average pin spacing;
[0019] Among them, the larger the calculated result of C is, the higher the complexity of the local image is. The local image is judged by formula (1), and the local image that meets the conditions in formula (1) is applied to the calculation of the complexity C in formula (2), and then compared with the picking threshold. The local image pointed to by C that is greater than or equal to the picking threshold is taken as the picking object.
[0020] Furthermore, the F s 、F d 、F k The value of is:
[0021]
[0022] Where: W avg is the average width, that is, the arithmetic mean of the pin width; D avg is the average spacing, that is, the arithmetic mean of the distance between the centers of two adjacent pins; C vw is the coefficient of variation of lead width; C vd is the coefficient of variation of the pin spacing; H m is the pin morphology entropy; H s is the spatial distribution entropy; S shapc is the morphological diversity index; D dist is the distribution dispersion;
[0023] in, σw , σ d Represents the standard deviation of all pin widths and the standard deviation of all adjacent pin spacings.
[0024] Furthermore, the pin morphology entropy H m The logic for obtaining is:
[0025] The curvature value of the pin edge point is discretized into 8 intervals, and the probability p of each interval is calculated. i ,according to The value range is [0, log28];
[0026] The spatial distribution entropy H s The logic for obtaining is:
[0027] Divide the image into 5×5 grids and count the probability q of the pin center falling on each grid i , The value range is [0, log225];
[0028] The morphological diversity index S shapc The logic for obtaining is:
[0029] Extract the morphological feature vector of each pin, which includes width, length, and mean value of contour curvature, and calculate the Euclidean distance matrix of all pin feature vectors.
[0030] The distribution dispersion D dist The logic for obtaining is:
[0031] Extract the center coordinates of all pins and calculate the standard deviation ellipse parameters of the coordinate set, including the major axis length a and the minor axis length b. A roi represents the square root of the area of the region of interest;
[0032] Where: M ij is the Euclidean distance between the morphological feature vectors of the i-th pin and the j-th pin; max(M ij ) is the maximum value of all off-diagonal elements in the Euclidean distance matrix, and the region of interest is the minimum rectangular area containing all pins.
[0033] Furthermore, when performing background segmentation on the circuit board surface image, the surface color of the transmission component used to output the circuit board on the circuit board production line is used as the segmentation target color to complete the background segmentation of the circuit board surface image and obtain the circuit board image to be inspected;
[0034] The image of the circuit board to be inspected that is determined to be qualified is determined by applying the size of the sliding recognition window and the center coordinates of the reference area to determine the image of the area to be inspected.
[0035] Furthermore, the image of the area to be detected and the reference area are matched based on the center coordinates to obtain several similarity comparison groups, and the similarity between the image of the area to be detected and the reference area is comprehensively calculated based on the similarity comparison groups:
[0036]
[0037] Where: Q is the total number of similarity comparison groups; sim(A s ,B s ) is the similarity between the image A of the region to be detected and the reference region B in the sth comparison group; ω s is the configuration weight of the sth alignment group; d i is the Euclidean distance between the center of the i-th pin in the image A of the detection area and the corresponding pin center in the reference area B; D max is the maximum possible distance between pins in the region, taking the maximum value of the distance between all pins in the reference region B; T topo is the topological structure matching degree; p is the total number of pixels in the region; g A,k 、g B,k is the grayscale value of the kth pixel in the image of the detection area A and the grayscale value of the kth pixel in the reference area B; E cntropy is the grayscale entropy ratio of the image A of the area to be detected and the reference area B, and takes the minimum value;
[0038] Among them, before calculating the similarity through the above formula, the spatial alignment of the image of the area to be detected and the reference area is performed based on image registration, and the topological structure matching degree T topo The calculation method is as follows: the pins in the image of the area to be detected A and the reference area B are connected as nodes to construct the topology respectively, and the overlap of the two topologies is used as T topo .
[0039] Furthermore, the configuration weight values are subject to:
[0040] NO1. All configuration weights are positive, and
[0041] NO2. In the sth comparison, the higher the proportion of the pin area in the image A of the area to be detected, the larger the value, and vice versa.
[0042] Furthermore, in the similarity comparison stage between the image of the area to be inspected and the reference area, a user-defined similarity threshold is applied to compare the similarity calculation result. If the similarity calculation result is less than the similarity threshold, the circuit board is judged to be unqualified; otherwise, the circuit board is judged to be qualified.
[0043] When the circuit board is ultimately judged to be unqualified, each similarity comparison group is used as an independent target for comparison with the similarity threshold. After obtaining the similarity between the image of the area to be inspected in the similarity comparison group and the reference area, the similarity threshold is compared. For comparison results less than the similarity threshold, the corresponding area on the circuit board of the image of the area to be inspected in the similarity comparison group is recorded as a defective area.
[0044] Furthermore, in the defect area output stage on the circuit board, the user-side preset receiving end is used as the output target, the image of the defect area pointing to the area to be detected is framed on the image of the circuit board to be detected, and the image of the circuit board to be detected with the frame marking is fed back to the output target as the transmission content.
[0045] Compared with the prior art, the technical solution provided by the present invention has the following beneficial effects:
[0046] The present invention provides a method for detecting surface defects of FPC gold fingers based on image analysis. During the execution of the method, a three-dimensional model is constructed and rendered to distinguish the main body and the pins. The reference area is intelligently picked up based on the complexity to ensure coverage of key areas and improve the targeted detection. The background segmentation is used to accurately extract the image to be detected. Unqualified products are preliminarily screened out through zoomed area comparison to reduce invalid detection. The method also uses similarity comparison to integrate multi-dimensional parameters such as Euclidean distance, topological matching, and grayscale entropy. The configuration weight is dynamically adjusted according to the pin ratio to improve the defect recognition accuracy. The application process supports user-defined thresholds and flexibly adapts to different detection needs. Unqualified products can be accurately marked with defective areas, thereby improving detection efficiency and reliability and facilitating production line quality control. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive effort.
[0048] Figure 1 The figure is a flow chart of a method for detecting surface defects of FPC gold fingers based on image analysis. DETAILED DESCRIPTION
[0049] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0050] The present invention will be further described below with reference to the embodiments.
[0051] Example:
[0052] This embodiment is a method for detecting surface defects of FPC gold fingers based on image analysis, such as Figure 1 Shown, including:
[0053] Upload the circuit board structural parameters and edge pin size and distribution information, and build a three-dimensional model of the circuit board based on the circuit board structural parameters and edge pin size and distribution information;
[0054] The edge pin distribution information includes the distance between adjacent edge pins;
[0055] When selecting a reference surface on the 3D model of the circuit board, the model surface containing the pins on the 3D model of the circuit board is used as the reference surface;
[0056] When performing reference area picking on a reference surface, the following applies:
[0057] Based on a vertical relative perspective, a reference surface image is captured on the three-dimensional model of the circuit board, background segmentation is performed on the reference surface image to extract an image of the area where the circuit board is located, a sliding recognition window is set, and the sliding recognition window is applied to the surface of the image of the area where the circuit board is located to obtain several local images of the area where the circuit board is located, the complexity of each local image is analyzed, a picking threshold is set based on the complexity, and a local image is picked by comparing the picking threshold with the complexity analysis result, and the picked local image is simultaneously marked by applying the center coordinates of the sliding recognition window from which it originated;
[0058] The picked local image is the reference area, and the center coordinates of the sliding recognition window are determined with reference to the full image of the area where the circuit board is located. The construction ratio of the circuit board 3D model to the circuit board entity is 1:1.
[0059] Select a reference surface on the PCB 3D model, perform reference area picking on the selected reference surface, and use the picked reference area for PCB defect detection;
[0060] After the PCB 3D model is built, it is rendered to distinguish the main body and pins on the PCB 3D model. The rendering color is consistent with the main body and pins of the PCB entity.
[0061] The logic for analyzing the complexity of a local image is:
[0062]
[0063] Where: X is the number of pins in the local image, which is determined by the rendering result; F s 、F d 、F k is the structural constraint factor, spatial correlation factor, and morphological distribution coupling factor; W avg is the average width of the pin; D avg is the average pin spacing;
[0064] The larger the calculated result of C is, the higher the complexity of the local image is. The local image is judged by formula (1), and the local image that meets the conditions in formula (1) is applied to the calculation of the complexity C in formula (2), and then compared with the picking threshold. The local image pointed to by C that is greater than or equal to the picking threshold is taken as the picking object;
[0065] The above formula integrates composite factors such as the number of pins in the local image and structural constraints, combined with the average width and average spacing of the pins. The multi-dimensional parameters work together. The greater the number of pins and the larger the composite factor value, the more accurately the calculation result can reflect the complexity of the local image. This provides a quantitative basis for picking the reference area and ensures that the selected area is representative for detection.
[0066] F s 、F d 、F k The value of is:
[0067]
[0068] Where: W avg is the average width, that is, the arithmetic mean of the pin width; D avg is the average spacing, that is, the arithmetic mean of the distance between the centers of two adjacent pins; C vw is the coefficient of variation of lead width; C vd is the coefficient of variation of the pin spacing; H m is the pin morphology entropy; H s is the spatial distribution entropy; S shapc is the morphological diversity index; D dist is the distribution dispersion;
[0069] in, σ w, σ d denotes the standard deviation of all pin widths, the standard deviation of all adjacent pin spacings;
[0070] The above formula integrates the coefficient of variation of pin width and spacing, morphological entropy, spatial distribution entropy, morphological diversity index and distribution dispersion, and quantifies the stability and distribution characteristics of the pin structure through multiple indexes. The smaller the coefficient of variation, the more reasonable the entropy value, and the lower the dispersion, the more the factor value reflects the structural normativity, which provides core parameter support for complexity calculation;
[0071] Pin morphological entropy H m The calculation logic is:
[0072] Discretize the pin edge point curvature value into 8 intervals, and count the probability p i of each interval, and take the value range as [0, log28];
[0073] Spatial distribution entropy H s The calculation logic is:
[0074] Divide the image into a 5x5 grid, and count the probability q i of the pin center falling on each grid. The value range is [0, log225];
[0075] Morphological diversity index S shapc The calculation logic is:
[0076] Extract the morphological feature vector of each pin, which includes width, length, and average contour curvature. Calculate the Euclidean distance matrix of all pin feature vectors, then
[0077] Distribution dispersion D dist The calculation logic is:
[0078] Extract all pin center coordinates, and calculate the standard deviation ellipse parameters of the coordinate set, including the major axis length a and the minor axis length b, then A roi denotes the square root of the area of the region of interest;
[0079] In the formula: M ij is the Euclidean distance between the morphological feature vector of the ith pin and the jth pin; max(M ij ) is the maximum value of all non-diagonal elements in the Euclidean distance matrix, and the region of interest is the smallest rectangular region containing all pins;
[0080] Collect the surface image of the circuit board output by the circuit board production line, and perform background segmentation on the circuit board surface image to extract the detected circuit board image;
[0081] When performing background segmentation on the circuit board surface image, the surface color of the transmission components used to output the circuit board on the circuit board production line is used as the segmentation target color to complete the background segmentation of the circuit board surface image and obtain the circuit board image to be inspected;
[0082] The image of the circuit board to be inspected that is determined to be qualified is used to determine the image of the area to be inspected by applying the size of the sliding recognition window and the center coordinates of the reference area;
[0083] Scaling the image of the circuit board to be inspected so that the longest side of the scaled image is equal to the longest side of the reference surface, comparing the area of the scaled image of the circuit board to be inspected with the area of the reference surface, and determining the circuit board pointed to by the image of the circuit board to be inspected whose area is not equal to the reference surface as an unqualified circuit board. For circuit boards determined to be qualified, further performing the following inspection steps;
[0084] Picking up an image of the area to be inspected from the image of the circuit board to be inspected corresponding to the circuit board determined to be qualified, performing a similarity comparison between the image of the area to be inspected and the reference area, and finally determining whether the circuit board is qualified;
[0085] The image of the area to be detected and the reference area are matched based on the center coordinates to obtain several similarity comparison groups. The similarity between the image of the area to be detected and the reference area is comprehensively calculated based on the similarity comparison groups:
[0086]
[0087] Where: Q is the total number of similarity comparison groups; sim(A s ,B s ) is the similarity between the image A of the region to be detected and the reference region B in the sth comparison group; ω s is the configuration weight of the sth alignment group; d i is the Euclidean distance between the center of the i-th pin in the image A of the detection area and the corresponding pin center in the reference area B; D max is the maximum possible distance between pins in the region, taking the maximum value of the distance between all pins in the reference region B; T topo is the topological structure matching degree; p is the total number of pixels in the region; g A,k 、g B,k is the grayscale value of the kth pixel in the image of the detection area A and the grayscale value of the kth pixel in the reference area B; E cntropy is the grayscale entropy ratio of the image A of the area to be detected and the reference area B, and takes the minimum value;
[0088] Among them, before calculating the similarity through the above formula, the spatial alignment of the image of the area to be detected and the reference area is performed based on image registration, and the topological structure matching degree T topoThe calculation method is as follows: the pins in the image of the area to be detected A and the reference area B are connected as nodes to construct the topology respectively, and the overlap of the two topologies is used as T topo ;
[0089] The above formula integrates the total number of comparison groups, the similarity of each comparison group, and the configuration weight, and incorporates the Euclidean distance between the pin centers, the topological structure matching degree, the pixel grayscale difference, and the grayscale entropy ratio. It quantifies the consistency between the test area and the reference area in a multi-dimensional collaborative manner. The smaller the distance, the higher the topological matching degree, and the smaller the grayscale difference, the higher the similarity, which fully guarantees the accuracy of the test results.
[0090] The configuration weight value follows:
[0091] NO1. All configuration weights are positive, and
[0092] NO2. In the sth comparison, the higher the proportion of the pin area in the image A of the area to be detected is, the larger the value is, and vice versa;
[0093] If the circuit board is finally judged to be qualified, the refresh step is executed to re-test the circuit board newly output from the circuit board production line. If the circuit board is finally judged to be unqualified, the defective area on the circuit board is output;
[0094] The configuration weight value follows:
[0095] NO1. All configuration weights are positive, and
[0096] NO2. In the sth comparison, the higher the proportion of the pin area in the image A of the area to be detected, the larger the value is, and vice versa;
[0097] In the defect area output stage on the circuit board, the user-side preset receiving end is used as the output target, and the image of the defect area pointing to the area to be inspected is framed on the image of the circuit board to be inspected, and the image of the circuit board to be inspected with the frame annotation is fed back to the output target as the transmission content.
[0098] In this embodiment, through three-dimensional model construction and precise reference area picking, combined with image scaling comparison and multi-factor similarity analysis, automatic detection of FPC gold finger surface defects is achieved, and circuit boards with unqualified dimensions can be quickly screened out. The defective area is accurately located by quantifying the complexity and topological matching, reducing manual missed detections and false detections, improving detection efficiency and accuracy, and providing real-time feedback of defect information to the production line, thereby facilitating closed-loop quality control.
[0099] According to the method in the above embodiment, an application example of the method is provided below:
[0100] To improve the efficiency of detecting surface defects on gold fingers of FPCs (flexible printed circuit boards), an electronics manufacturing company introduced a defect detection method based on image analysis and applied it to the quality inspection process at the end of the production line. The specific implementation process is as follows:
[0101] 1. Preliminary preparation and 3D model construction
[0102] The company first compiled the structural parameters of the FPC to be inspected, including the dimensions of the circuit board, the length, width, and distribution of the pins at the edge of the gold finger area (to clearly define the distance between adjacent pins), and uploaded these parameters to the inspection system. Based on these parameters, the system constructed a 3D model of the FPC at a 1:1 scale and simultaneously rendered the model—the circuit board's main body was rendered green (the same color as the physical FPC) and the pins were rendered gold (the same color as the physical gold finger pins) to clearly distinguish between the main body and the pins.
[0103] 2. Determination of reference surface and reference area
[0104] Within the constructed 3D model, the system automatically selects the model surface containing the gold finger pins as the reference surface. It then begins capturing the reference area: the system captures an image of the reference surface from a vertical perspective, segments the background, and retains only the PCB area. A sliding recognition window with a side length of 50 pixels is set to slide across the surface of this area, acquiring 100 partial images.
[0105] For each local image, the system analyzes its complexity: the number of pins in the local image is counted through rendering results, combined with the average pin width, average spacing, and the coefficient of variation of pin width (reflecting width consistency), the coefficient of variation of spacing (reflecting spacing stability), morphological entropy (calculated by dividing the pin edge curvature into 8 intervals and counting the probability of each interval; larger values indicate more diverse morphologies), spatial distribution entropy (calculated by dividing the image into 5×5 grids and counting the probability of pin center landing points; larger values indicate more dispersed distribution), morphological diversity index (calculated by calculating the Euclidean distance matrix of all pin morphological feature vectors and taking the ratio of average distance to maximum distance), distribution dispersion (calculated based on the ratio of the major and minor axis lengths of the standard deviation ellipse of the pin center coordinates to the square root of the area of the region of interest), and other parameters, to comprehensively calculate the complexity value of each local image.
[0106] The company set the picking threshold to 0.6, and finally selected 20 local images with complexity values not less than 0.6 as reference areas, and recorded the sliding window center coordinates corresponding to each reference area (with the full image of the circuit board area as a reference).
[0107] 3. Image Acquisition and Preprocessing
[0108] On the production line, FPCs are transported via a blue conveyor belt, and the inspection system's industrial camera captures real-time images of the circuit board surface. Using the blue conveyor belt as the target color, the system performs background segmentation on the captured image, removing the blue background and irrelevant interference areas to produce an image containing only the FPCs to be inspected.
[0109] The system then scales the image so that the longest side of the scaled image is equal to the longest side of the reference surface. The system then compares the area of the scaled image with the area of the reference surface. If the area difference exceeds a preset 5% (due to the allowable range of production errors), the FPC is directly judged as unqualified. If the area meets the requirements, the system proceeds to the next step of testing.
[0110] 4. Determination of the Area to be Detected and Similarity Comparison
[0111] For FPC images to be inspected with qualified areas, the system determines the corresponding 20 areas to be inspected in the image to be inspected based on the sliding recognition window size (50 pixels side length) and center coordinates of the reference area, forming 20 similarity comparison groups.
[0112] Before comparison, the system spatially aligns the reference area with the area to be inspected to ensure that their spatial positions match. The similarity of each comparison is then calculated, taking into account the following factors: the Euclidean distance between the center of the corresponding pin in the inspection area and the reference area (the ratio of the maximum distance to the pin in the reference area; the smaller the distance, the higher the similarity); the topological structure matching between the two (the topology is constructed with the pins as nodes; the higher the overlap, the higher the score); the pixel grayscale value difference (the percentage of pixels with inconsistent grayscale values in the total number of pixels; the lower the percentage, the better); and the grayscale entropy ratio (the minimum grayscale entropy value of the two is taken; the larger the value, the closer the grayscale distribution).
[0113] At the same time, the system assigns weights based on the proportion of pins in the target area in each comparison group: comparison groups with a pin proportion of more than 60% are given a weight of 0.06, those with a proportion between 40% and 60% are given a weight of 0.05, and those with a proportion below 40% are given a weight of 0.04. The sum of all group weights is 1. Finally, the comprehensive similarity of the 20 comparison groups is calculated through weighted calculation.
[0114] 5. Test result determination and output
[0115] Based on production quality requirements, the company customized a similarity threshold of 92%. If the overall similarity is ≥92%, the FPC is deemed qualified, and the system automatically refreshes the inspection process and begins testing the next FPC. If the overall similarity is less than 92%, the FPC is deemed unqualified.
[0116] For unqualified FPC, the system compares each group of similarities one by one, and marks the detection area corresponding to the comparison group with a similarity lower than 92% with a red square in the image to form an image with defect area annotation, and transmits it to the quality inspection terminal (preset receiving end) in real time for further confirmation of defect type (such as pin wear, stain, deformation, etc.) by quality inspection personnel.
[0117] Through this method, the defect detection efficiency of the FPC gold finger of the enterprise is improved from 300 pieces per hour in traditional manual detection to 1500 pieces per hour, the detection accuracy is 99.2%, and the miss rate and false detection rate are effectively reduced.
[0118] In summary, in the above-mentioned embodiments, the method in the execution process constructs a three-dimensional model and renders the main body and the pin, intelligently picks up the reference area based on the complexity, ensures the coverage of key areas, improves the detection pertinence, accurately extracts the image to be detected by background segmentation, preliminarily screens out unqualified products by area comparison after scaling, reduces invalid detection, and improves the defect recognition accuracy by comparing the similarity, configuring the weight to dynamically adjust the pin proportion, and integrating multi-dimensional parameters such as Euclidean distance, topological matching degree and gray entropy. The application process supports user-defined threshold, flexible adaptation to different detection needs, accurate defect area annotation for unqualified products, improved detection efficiency and reliability, and helps production line quality control.
[0119] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements will not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for detecting surface defects of FPC gold fingers based on image analysis, characterized in that: include: Upload the circuit board structural parameters and edge pin size and distribution information, and build a three-dimensional model of the circuit board based on the circuit board structural parameters and edge pin size and distribution information; Select a reference surface on the PCB 3D model, perform reference area picking on the selected reference surface, and use the picked reference area for PCB defect detection; Collect the circuit board surface image output by the circuit board production line, perform background segmentation on the circuit board surface image to extract the circuit board image to be inspected; Scaling the image of the circuit board to be inspected so that the longest side of the scaled image is equal to the longest side of the reference surface, comparing the area of the scaled image of the circuit board to be inspected with the area of the reference surface, and determining the circuit board pointed to by the image of the circuit board to be inspected whose area is not equal to the reference surface as an unqualified circuit board. For circuit boards determined to be qualified, further performing the following inspection steps; Picking up an image of the area to be inspected from the image of the circuit board to be inspected corresponding to the circuit board determined to be qualified, performing a similarity comparison between the image of the area to be inspected and the reference area, and finally determining whether the circuit board is qualified; If the circuit board is finally judged to be qualified, the refresh step is executed to re-test the circuit board newly output from the circuit board production line. If the circuit board is finally judged to be unqualified, the defective area on the circuit board is output.
2. The method for detecting surface defects of FPC gold fingers based on image analysis according to claim 1, characterized in that: The edge pin distribution information includes the distance between adjacent edge pins; When selecting a reference surface on the three-dimensional model of the circuit board, the model surface containing the pins on the three-dimensional model of the circuit board is used as the selected reference surface; When performing reference area picking on a reference surface, the following applies: Based on a vertical relative perspective, a reference surface image is captured on the three-dimensional model of the circuit board, background segmentation is performed on the reference surface image to extract an image of the area where the circuit board is located, a sliding recognition window is set, and the sliding recognition window is applied to the surface of the image of the area where the circuit board is located to obtain several local images of the area where the circuit board is located, the complexity of each local image is analyzed, a picking threshold is set based on the complexity, and a local image is picked by comparing the picking threshold with the complexity analysis result, and the picked local image is simultaneously marked by applying the center coordinates of the sliding recognition window from which it originated; The picked local image is the reference area, and the center coordinates of the sliding recognition window are determined with reference to the full image of the area where the circuit board is located. The construction ratio of the circuit board 3D model relative to the circuit board entity is 1:
1.
3. The method for detecting surface defects of FPC gold fingers based on image analysis according to claim 1, characterized in that: After the circuit board three-dimensional model is constructed, the circuit board three-dimensional model is rendered to distinguish the main body and the pin part of the circuit board three-dimensional model, and the rendering color is consistent with the color of the main body and the pin part of the circuit board entity; The complexity analysis logic of the local image is: Where: X is the number of pins in the local image, which is determined by the rendering result; F s 、F d 、F k is the structural constraint factor, spatial correlation factor, and morphological distribution coupling factor; W avg is the average width of the pin; D avg is the average pin spacing; Among them, the larger the calculated result of C is, the higher the complexity of the local image is. The local image is judged by formula (1), and the local image that meets the conditions in formula (1) is applied to the calculation of the complexity C in formula (2), and then compared with the picking threshold. The local image pointed to by C that is greater than or equal to the picking threshold is taken as the picking object.
4. The method for detecting surface defects of FPC gold fingers based on image analysis according to claim 3, characterized in that: The F s 、F d 、F k The value of is: Where: W avg is the average width, that is, the arithmetic mean of the pin width; D avg is the average spacing, that is, the arithmetic mean of the distance between the centers of two adjacent pins; C vw is the coefficient of variation of lead width; C vd is the coefficient of variation of the pin spacing; H m is the pin morphology entropy; H s is the spatial distribution entropy; S shapc is the morphological diversity index; D dist is the distribution dispersion; in, σ w , σ d Represents the standard deviation of all pin widths and the standard deviation of all adjacent pin spacings.
5. The method for detecting surface defects of FPC gold fingers based on image analysis according to claim 4, characterized in that: The pin morphology entropy H m The logic for obtaining is: The curvature value of the pin edge point is discretized into 8 intervals, and the probability p of each interval is calculated. i ,according to The value range is [0, log28]; The spatial distribution entropy H s The logic for obtaining is: Divide the image into 5×5 grids and count the probability q of the pin center falling on each grid i , The value range is [0, log225]; The morphological diversity index S shapc The logic for obtaining is: Extract the morphological feature vector of each pin, which includes width, length, and mean value of contour curvature, and calculate the Euclidean distance matrix of all pin feature vectors. The distribution dispersion D dist The logic for obtaining is: Extract the center coordinates of all pins and calculate the standard deviation ellipse parameters of the coordinate set, including the major axis length a and the minor axis length b. A roi represents the square root of the area of the region of interest; Where: M ij is the Euclidean distance between the morphological feature vectors of the i-th pin and the j-th pin; max(M ij ) is the maximum value of all off-diagonal elements in the Euclidean distance matrix, and the region of interest is the minimum rectangular area containing all pins.
6. The method for detecting surface defects of FPC gold fingers based on image analysis according to claim 1, characterized in that: When performing background segmentation on the circuit board surface image, the surface color of the transmission component used to output the circuit board on the circuit board production line is used as the segmentation target color to complete the background segmentation of the circuit board surface image and obtain the circuit board image to be inspected; The image of the circuit board to be inspected that is determined to be qualified is determined by applying the size of the sliding recognition window and the center coordinates of the reference area to determine the image of the area to be inspected.
7. The method for detecting surface defects of FPC gold fingers based on image analysis according to claim 1, characterized in that: The image of the area to be detected and the reference area are matched based on the center coordinates to obtain several similarity comparison groups, and the similarity between the image of the area to be detected and the reference area is comprehensively calculated based on the similarity comparison groups: Where: Q is the total number of similarity comparison groups; sim(A s ,B s ) is the similarity between the image A of the region to be detected and the reference region B in the sth comparison group; ω s is the configuration weight of the sth alignment group; d i is the Euclidean distance between the center of the i-th pin in the image A of the detection area and the corresponding pin center in the reference area B; D max is the maximum possible distance between pins in the region, taking the maximum value of the distance between all pins in the reference region B; T topo is the topological structure matching degree; p is the total number of pixels in the region; g A,k 、g B,k is the grayscale value of the kth pixel in the image of the detection area A and the grayscale value of the kth pixel in the reference area B; E cntropy is the grayscale entropy ratio of the image A of the area to be detected and the reference area B, and takes the minimum value; Among them, before calculating the similarity through the above formula, the spatial alignment of the image of the area to be detected and the reference area is performed based on image registration, and the topological structure matching degree T topo The calculation method is as follows: the pins in the image of the area to be detected A and the reference area B are connected as nodes to construct the topology respectively, and the overlap of the two topologies is used as T topo .
8. The method for detecting surface defects of FPC gold fingers based on image analysis according to claim 7, characterized in that: The configuration weight value is subject to: NO1. All configuration weights are positive, and NO2. In the sth comparison, the higher the proportion of the pin area in the image A of the area to be detected, the larger the value, and vice versa.
9. The method for detecting surface defects of FPC gold fingers based on image analysis according to claim 1, characterized in that: In the similarity comparison stage between the image of the area to be detected and the reference area, a user-defined similarity threshold is applied to compare the similarity calculation result. If the similarity calculation result is less than the similarity threshold, the circuit board is judged to be unqualified; otherwise, the circuit board is judged to be qualified. When the circuit board is ultimately judged to be unqualified, each similarity comparison group is used as an independent target for comparison with the similarity threshold. After obtaining the similarity between the image of the area to be inspected in the similarity comparison group and the reference area, the similarity threshold is compared. For comparison results less than the similarity threshold, the corresponding area on the circuit board of the image of the area to be inspected in the similarity comparison group is recorded as a defective area.
10. The method for detecting surface defects of FPC gold fingers based on image analysis according to claim 1, characterized in that: In the defect area output stage on the circuit board, the user-preset receiving end is used as the output target, the image of the defect area pointing to the area to be inspected is framed on the image of the circuit board to be inspected, and the image of the circuit board to be inspected with the frame marking is fed back to the output target as the transmission content.
Citation Information
Patent Citations
A method, system, device and medium for detecting defects in the gold finger area of a circuit board
CN114862817B
Cited By
FPC connector appearance defect detection system and method based on image generation
CN121860988A