An electronic component package defect detection method and system based on image acquisition
Patent Information
- Application Number
- CN202611002508.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-07
- Publication Date
- 2026-09-18
AI Technical Summary
[0004]本发明的目的就是为了弥补现有技术的不足,提供了一种基于图像采集的电子元器件封装缺陷检测方法及检测系统,以解决现有封装缺陷检测方案中图像配准易受基准区域工艺缺陷干扰、无法补偿塑封局部成型形变,进而导致封装边缘区域配准精度不足、微小缺陷误报率偏高的问题
一、本发明通过构建分级固有基准特征库并对提取的基准特征执行可用性筛选,能够提前剔除受溢料、缺胶等工艺缺陷干扰的异常基准特征,避免异常基准参与全局配准计算,从源头提升配准过程的抗干扰能力;同时采用全局刚体粗配准结合局部形变精校正的两级配准架构,可针对性补偿塑封成型产生的局部微形变,有效提升封装边缘及形变区域的图像配准精度,进而降低配准偏差引发的微小缺陷误判概率,显著提升封装表面缺陷检测结果的准确性与可靠性。
Smart Images

Figure CN122780263A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic component packaging appearance inspection technology, specifically to a method and system for detecting defects in electronic component packaging based on image acquisition. Background Technology
[0002] Electronic component packaging is a core final step in the semiconductor manufacturing process, responsible for the physical protection of the chip, the extraction of electrical signals, and heat dissipation. Surface defects such as scratches, excess material, and insufficient adhesive on the package directly affect the insulation performance and long-term reliability of the device. As semiconductor devices become increasingly miniaturized and highly integrated, the accuracy requirements for packaging defect detection continue to rise. Traditional manual visual inspection methods, limited by human eye resolution and efficiency, can no longer meet the full inspection needs of mass production lines. Machine vision inspection technology based on image acquisition offers advantages such as non-contact operation, high speed, and adaptability to online mass production, and is currently widely used in the inspection of surface defects in the packaging of various electronic components.
[0003] Existing image-based methods for detecting defects in electronic component packaging typically involve first registering and aligning the acquired image to be inspected with a pre-stored standard template, and then using image differencing or deep learning models to locate and identify the defects. Current registration techniques often select fixed features such as the outer contour of the package and diagonal vertices as registration references, achieving spatial alignment of the entire image through global rigid body transformation. While this type of registration method has a simple implementation logic, it has significant shortcomings in actual mass production scenarios: overflow and insufficient adhesive are prone to occur in the corner areas of the package, causing distortion in the extraction of reference features and leading to a decrease in global registration accuracy; simultaneously, unavoidable local micro-deformations occur during the molding process, and a single global transformation cannot differentiate the deformation of each region, resulting in significantly higher alignment errors at the package edges compared to the center, ultimately leading to misjudgments of minor defects in the edge areas and affecting the accuracy and stability of the detection results. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and system for detecting defects in electronic component packaging based on image acquisition. This solves the problems in existing packaging defect detection schemes, such as image registration being easily affected by process defects in the reference area and the inability to compensate for local molding deformation of the plastic package, which leads to insufficient registration accuracy in the packaging edge area and a high false alarm rate for minor defects.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: On one hand, a method for detecting defects in electronic component packaging based on image acquisition includes acquiring a surface image of the electronic component packaging to be inspected; performing preprocessing on the acquired image and then identifying defects; pre-constructing a hierarchical inherent reference feature library for the corresponding model packaging; extracting multi-level reference features from the image to be inspected online; performing usability screening on the extracted reference features to obtain an effective reference feature set; solving the global affine transformation matrix based on the effective reference feature set to complete global rigid body coarse registration; calculating the registration residuals of each grid region in the entire image; performing local deformation fine correction on grid regions with excessive registration residuals; dynamically adjusting the defect judgment threshold of the corresponding region based on the final registration residuals of each region; and completing the detection of surface defects in the packaging based on the adjusted judgment thresholds.
[0006] Furthermore, the construction steps of the hierarchical inherent reference feature library include: acquiring multiple bright-field images of standard defect-free packages of the same model, averaging them to generate standard template images, defining three levels of inherent reference features on the standard template images and labeling the corresponding standard coordinates and priority weights, recording the normal offset standard deviation of each level of reference feature, and generating a reference feature template library for the corresponding model. The first level reference is the root right angle point where the pins meet the molded body, the second level reference is the middle straight edge segment of the four outer contour edges of the molded body, and the third level reference is the fixed corner point of the laser marking area and the diagonal vertex of the molded body.
[0007] Furthermore, the steps for benchmark feature availability screening include: performing coarse matching of all extracted candidate benchmark features with the corresponding benchmark of the standard template to obtain initial matching point pairs, and calculating the offset of each matching point pair using the following formula: In the formula, Let be the offset of the i-th reference feature. Let x be the actual x-coordinate of the i-th reference feature. Let be the actual ordinate of the i-th reference feature. Let x be the standard x-coordinate of the i-th reference feature. Let be the standard ordinate of the i-th reference feature. Calculate the average offset and standard deviation of all matching point pairs at the same level. Eliminate candidate features whose offset exceeds three times the standard deviation of the average offset. Count the number of remaining valid references. Select the references of the corresponding level to participate in the global registration calculation based on the number of valid references.
[0008] Furthermore, the execution steps of global rigid body coarse registration include: when the number of first-level effective references reaches a set proportion, the first-level effective reference point pairs are used to solve the global affine transformation matrix containing three degrees of freedom (translation, rotation, and uniform scaling) using the least squares method to complete the global alignment of the image to be detected to the standard template; when the number of first-level effective references does not reach the set proportion, the slope and intercept parameters of the second-level straight edge references are used to calculate the global transformation parameters to complete the global coarse alignment.
[0009] Furthermore, the steps for performing fine local deformation correction include dividing the entire image uniformly into grid cells of a set size, and calculating the average registration residual for each grid cell using the following formula: In the formula, Let j be the average registration residual of the j-th grid cell. Let k be the number of valid reference features contained in the j-th grid cell, and k be the index of the reference feature within the grid. For the registration residual of the k-th reference feature, for the grid cell whose average registration residual exceeds the standard, the third-level reference feature of the grid and the surrounding set range is extracted. The local displacement vector field of the corresponding area is calculated by using the thin plate spline interpolation algorithm. Pixel-by-pixel local correction is performed on the pixels in the grid to compensate for the alignment error caused by the micro deformation of the molding process.
[0010] Furthermore, the execution steps for dynamically adjusting the defect judgment threshold include: inputting the final registration residual of each grid cell as a weight parameter into the defect detection module, and calculating the defect judgment threshold for the corresponding grid region using the following formula: In the formula, The defect determination threshold for the j-th grid region is... The standard defect determination threshold. This is the threshold adjustment coefficient. For the final registration residual of the j-th grid region, the gray-level difference judgment threshold and area judgment threshold of the corresponding grid region are adjusted synchronously according to the calculated threshold to offset the gray-level difference caused by the registration deviation.
[0011] Furthermore, the image preprocessing steps include performing Gaussian filtering on the acquired packaging surface image to remove image noise, using a sub-pixel edge extraction algorithm to obtain the edge contours of the entire image with sub-pixel precision, and extracting candidate benchmark features at each level according to the three-level feature types of the hierarchical intrinsic benchmark feature library based on the obtained edge contours.
[0012] On the other hand, an image acquisition-based electronic component packaging defect detection system, applicable to an image acquisition-based electronic component packaging defect detection method, includes an image acquisition module, a preprocessing module, a reference storage module, a registration calculation module, and a defect detection module. The image acquisition module is used to acquire surface images of electronic component packages and transmit them to the preprocessing module. The preprocessing module is used to perform filtering and edge extraction processing on the received images. The reference storage module is used to store a hierarchical inherent reference feature library for the corresponding package model. The registration calculation module is used to call the reference feature library to complete multi-level reference extraction, availability screening, two-level registration calculation, and residual output. The defect detection module is used to receive registration residual data and dynamically adjust the judgment threshold to complete the identification and output of surface defects of the package.
[0013] Furthermore, the registration calculation module includes a reference screening unit, a global registration unit, and a local correction unit. The reference screening unit is used to extract, match, and filter multi-level reference features and output an effective reference feature set. The global registration unit is used to solve the global affine transformation matrix based on the effective reference feature set and complete the global coarse alignment of the image. The local correction unit is used to divide the image into grids and calculate the registration residuals of each grid, perform local deformation fine correction on areas with excessive residuals, and output the final registered image and residual data of each region.
[0014] Furthermore, the defect detection module includes a threshold adaptation unit and a defect identification unit. The threshold adaptation unit is used to receive the registration residual data of each grid area and dynamically calculate the gray-scale difference judgment threshold and area judgment threshold of the corresponding area based on the residual value. The defect identification unit is used to locate, classify and output the detection results of the packaging surface defects based on the dynamically adjusted judgment thresholds of each area.
[0015] Compared with existing technologies, this method and system for detecting defects in electronic component packaging based on image acquisition has the following advantages: I. This invention constructs a hierarchical inherent reference feature library and performs usability screening on the extracted reference features. This allows for the early removal of abnormal reference features that are affected by process defects such as overflow and insufficient adhesive, thus preventing abnormal references from participating in the global registration calculation and improving the anti-interference capability of the registration process from the source. At the same time, the invention adopts a two-level registration architecture that combines global rigid coarse registration with local deformation fine correction. This architecture can specifically compensate for local micro-deformations caused by molding, effectively improving the image registration accuracy of the package edge and deformation area. This reduces the probability of misjudging minor defects caused by registration deviation and significantly improves the accuracy and reliability of the package surface defect detection results.
[0016] Second, this invention dynamically adjusts the defect judgment threshold of the corresponding region based on the final registration residual of each region, which can achieve adaptive matching between the judgment threshold and the registration accuracy. In regions with high registration accuracy, a lower detection threshold is maintained to ensure the detection capability of minor defects, while in regions with large registration deviations, the threshold is appropriately increased to offset pseudo-differential grayscale interference. At the same time, a hierarchical adaptation global registration strategy is adopted, which can still complete effective global alignment under the condition that some references fail, avoid the interruption of the detection process due to local reference anomalies, and improve the operational stability and working condition adaptability in mass production detection scenarios.
[0017] Other advantages, objectives and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination or study, or may be learned from the practice of the invention. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0019] Figure 1 This is an overall flowchart of the detection method of the present invention; Figure 2 This is a schematic diagram illustrating the hierarchical benchmark features and their application strategies of the present invention; Figure 3 This is a schematic diagram of the module composition and data flow of the detection system of the present invention. Detailed Implementation
[0020] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0021] As attached Figure 1-3 As shown, an image acquisition-based method for detecting defects in electronic component packaging consists of two main stages: offline benchmark library construction and online detection. The online detection stage includes five core steps: image acquisition and preprocessing, multi-level benchmark screening, global rigid body coarse registration, local deformation fine correction, and dynamic threshold defect detection.
[0022] I. Offline Construction of Hierarchical Inherent Benchmark Feature Library The hierarchical inherent reference feature library is independently constructed according to the electronic component package model. Different package models correspond to independent reference library files. During testing, the model can be switched by calling the corresponding reference library according to the model of the workpiece to be tested.
[0023] Specifically, the benchmark library construction process first involves acquiring multiple bright-field images of standard, defect-free packages of the same model. The illumination parameters, camera parameters, and object distance parameters during image acquisition are kept completely consistent with those of the online inspection station to ensure the template matches the online imaging conditions. Pixel-level grayscale averaging is then performed on the acquired bright-field images to generate standard template images for the corresponding model. Grayscale averaging suppresses random noise and minor process fluctuations in individual images, improving the universality and stability of the standard templates.
[0024] Three levels of inherent reference features are defined on the standard template image. The standard coordinates and priority weights corresponding to each reference feature are labeled. At the same time, the standard deviation of the offset of each level of reference feature within the normal process range is statistically recorded, and finally, the reference feature template library of the corresponding model is generated.
[0025] The first-level reference is the right-angle point at the root where the pin meets the molded package. This type of reference is located at the junction of the pin and the molded package, and is least affected by molding deformation, exhibiting the highest positional stability; therefore, it is given the highest priority weight. A single package contains multiple pins, corresponding to multiple first-level reference points, and all first-level reference points together constitute the first-level reference set.
[0026] The second-level reference is the straight segment in the middle of the four outer contour edges of the molding compound. This type of reference selects the straight segment in the middle area of each contour edge of the molding compound, avoiding the corner positions. This can reduce the interference of corner overflow or insufficient glue on the reference extraction. Positional stability is secondary, and the priority weight is lower than the first-level reference. The four contour edges correspond to four second-level references, which together constitute the second-level reference set.
[0027] The third-level reference points are the fixed corner points of the laser-marked area and the opposite vertices of the molding compound. These reference points are distributed across the surface area and corners of the molding compound, covering a wide range but are significantly affected by molding deformation and process defects, exhibiting the lowest positional stability and the lowest priority weight. Multiple third-level reference points together constitute a set of third-level reference points.
[0028] It is understandable that the priority division of the three-level reference is directly related to the location stability. The higher the stability of the reference, the higher the priority and the greater the weight in the registration calculation, which can effectively improve the anti-interference ability of the registration process.
[0029] II. Online Image Acquisition and Preprocessing During the online inspection phase, the surface image of the packaged electronic component to be inspected is first acquired by the image acquisition unit of the inspection station, and the acquired image is then transmitted to the preprocessing module for preprocessing.
[0030] Specifically, the preprocessing first performs Gaussian filtering on the acquired packaging surface image to remove random noise introduced during image acquisition and transmission, improving the image signal-to-noise ratio and preventing noise interference with subsequent edge extraction and reference feature recognition. After filtering, a sub-pixel edge extraction algorithm is used to obtain the edge contours of the entire image with sub-pixel precision. Sub-pixel level edge extraction can improve the edge positioning accuracy to below the pixel level, ensuring the accuracy of subsequent reference feature extraction and providing a data foundation for high-precision registration.
[0031] After edge extraction, based on the obtained full-image edge contour, candidate reference features at each level are extracted according to the three-level feature types defined in the hierarchical intrinsic reference feature library. The first-level candidate reference is the right-angle feature point at the root of the extracted pin; the second-level candidate reference is the straight line feature in the middle section of the extracted molding body contour; and the third-level candidate reference is the corner point of the extracted marking area and the diagonal vertex feature of the molding body. The corresponding image coordinates of all extracted candidate reference features are recorded for subsequent matching and filtering.
[0032] III. Availability Screening of Multi-Level Benchmark Features After extracting all candidate benchmark features, coarse matching is performed between all candidate benchmark features and the corresponding benchmarks in the standard template to obtain initial matching point pairs. The coarse matching adopts a feature type correspondence matching method, that is, the first-level candidate features are only matched with the first-level benchmarks in the standard template, and the second and third levels are matched in the same way. This can avoid mismatches of features at different levels and improve matching efficiency and accuracy.
[0033] After matching is complete, calculate the offset of each matching point pair using the following formula: In the formula, Let be the offset of the i-th reference feature matching point pair. Let be the actual x-coordinate of the i-th reference feature in the image to be detected. Let be the actual ordinate of the i-th reference feature in the image to be detected. Let x be the standard x-coordinate of the i-th reference feature in the standard template. Let be the standard ordinate of the i-th reference feature in the standard template.
[0034] After calculating the offsets of all matching point pairs, the average offset and standard deviation of the offset for all matching point pairs at each level are calculated. A screening threshold of three times the standard deviation is used to eliminate candidate features at the same level whose offsets exceed three times the average offset. This screening logic is based on the statistical properties of the normal distribution; the baseline offset under normal process fluctuations conforms to a normal distribution. Features exceeding three times the standard deviation can be identified as abnormal features affected by defects and are therefore eliminated.
[0035] After screening, the number of remaining valid references at each level is counted, and references at the corresponding level are selected for subsequent global registration calculations based on the number of valid references. It can be understood that availability screening can preemptively eliminate abnormal references affected by defects such as overflow or insufficient adhesive, preventing abnormal references from impacting global registration accuracy and improving the robustness of the registration process.
[0036] IV. Global Rigid Body Coarse Registration Global rigid body coarse registration is performed based on the selected effective reference features. It adopts a hierarchical adaptation strategy, prioritizing the use of the first-level reference with higher accuracy. If the number of first-level references is insufficient, the second-level reference is used instead, ensuring that effective global alignment can be completed under different working conditions.
[0037] Specifically, when the number of first-level effective references reaches a set proportion, the first-level effective reference point pairs are used to solve the global affine transformation matrix using the least squares method. This affine transformation matrix contains three degrees of freedom: translation, rotation, and uniform scaling, which can compensate for the overall dimensional changes caused by the positional offset, angular deflection, and small fluctuations in object distance of the workpiece at the workstation. After obtaining the global affine transformation matrix, a global affine transformation is performed on the entire image to be inspected, completing the global alignment of the image to be inspected to the standard template.
[0038] When the number of effective references at the first level does not reach the set ratio, it indicates that there are many process abnormalities in the pin area causing the first-level references to fail. In this case, the second-level straight-edge reference is used for global registration. The slope and intercept parameters of the straight line corresponding to the second-level effective reference are extracted. The global rotation, translation, and scaling parameters are calculated based on the deviation of the slope and intercept of the four sides to complete the global coarse alignment.
[0039] It is understandable that the hierarchical adaptation global registration strategy can still ensure the effective execution of global registration when some benchmarks fail due to defect interference, thus avoiding the interruption of the overall detection process due to the failure of local benchmarks and improving the detection stability in mass production scenarios.
[0040] V. Mesh Residual Calculation and Fine Correction of Local Deformation After global coarse registration is completed, the entire image is uniformly divided into grid cells of a set size. The average registration residual of each grid cell is calculated one by one, and the calculation formula is as follows: In the formula, Let j be the average registration residual of the j-th grid cell. Let k be the number of valid reference features contained in the j-th grid cell, and k be the index of the reference feature within the grid. Let be the registration residual of the k-th reference feature.
[0041] After calculating the average registration residual of all grids, a residual judgment threshold is set, and local deformation fine correction is performed on grid cells whose average registration residual exceeds the judgment threshold.
[0042] Specifically, the local correction process first extracts all third-level reference features within the target mesh and its surrounding defined range. Using these third-level reference features as control points, a thin-plate spline interpolation algorithm is employed to calculate the local displacement vector field of the corresponding region. The thin-plate spline interpolation algorithm can fit nonlinear local deformations, accurately describing the distribution of micro-deformations generated during the molding process. After obtaining the local displacement vector field, pixel-by-pixel local correction is performed on all pixels within the mesh to compensate for alignment errors caused by micro-deformations during molding.
[0043] After local correction of all grids with excessive residuals, the final registered image is obtained. At the same time, the final registration residual of each grid region is recorded for dynamic adjustment of the subsequent defect judgment threshold.
[0044] It is understandable that the two-level registration architecture of global coarse registration plus local fine correction not only ensures the efficiency and stability of overall alignment, but also can specifically compensate for the alignment error caused by local micro-deformation, significantly improving the registration accuracy of edge areas and deformed areas.
[0045] VI. Dynamic Threshold Adaptation and Defect Detection After image registration is completed, the final registration residual of each grid cell is passed to the defect detection module as a weight parameter. The defect judgment threshold of the corresponding grid area is dynamically adjusted according to the registration residual to achieve adaptive matching between the judgment threshold and the registration accuracy.
[0046] The formula for calculating the defect judgment threshold is as follows: In the formula, The defect determination threshold for the j-th grid region is... The standard defect determination threshold. This is the threshold adjustment coefficient. This represents the final registration residual for the j-th grid region.
[0047] Based on the calculated region judgment threshold, the grayscale difference judgment threshold and area judgment threshold for the corresponding grid region are adjusted synchronously. For regions with larger registration residuals, the pseudo-differential grayscale values caused by alignment errors are higher. Increasing the judgment threshold accordingly can offset the grayscale differences caused by registration deviations, preventing normal alignment errors from being misjudged as defects. For regions with smaller registration residuals, the alignment accuracy is higher, and the judgment threshold remains at a lower level, ensuring the detection capability of minor defects.
[0048] After the threshold adjustment is completed, the image to be detected and the standard template image are subjected to difference operation. Based on the dynamically adjusted judgment threshold of each grid region, the difference result is binarized and connected component analysis is performed to complete the location, identification and result output of the packaging surface defects.
[0049] In some optional implementations, defect detection can simultaneously identify a variety of common packaging appearance defects such as scratches, overflow, missing glue, and dirt. Different standard thresholds and adjustment coefficients can be set for different types of defects to further improve detection accuracy.
[0050] This embodiment also provides an electronic component packaging defect detection system based on image acquisition, which is applicable to the above detection method and includes five core components: an image acquisition module, a preprocessing module, a reference storage module, a registration calculation module, and a defect detection module.
[0051] The image acquisition module is installed at the inspection station on the production line to acquire surface images of electronic component packages and transmit the acquired image data to the preprocessing module. The image acquisition module may include an industrial area scan camera, an optical lens, and a bright-field illumination unit to ensure image clarity and illumination uniformity.
[0052] The preprocessing module receives image data transmitted from the image acquisition module, performs filtering and edge extraction on the image, and outputs the preprocessed image and the extracted candidate reference feature data.
[0053] The benchmark storage module stores the hierarchical inherent benchmark feature library for the corresponding model package, including standard template images, standard coordinates of each level of benchmark, priority weights, and normal offset standard deviation data. When changing the detection model, the model switching can be completed by directly calling the benchmark feature library of the corresponding model.
[0054] The registration calculation module is used to call the benchmark feature library in the benchmark storage module to complete multi-level benchmark extraction and matching, availability filtering, two-level registration calculation and residual data output.
[0055] Specifically, the registration calculation module includes three sub-units: a reference selection unit, a global registration unit, and a local correction unit.
[0056] The benchmark filtering unit is used to extract and match multi-level benchmark features and perform availability filtering, eliminate abnormal benchmark features, and output a set of valid benchmark features.
[0057] The global registration unit is used to solve the global affine transformation matrix based on the effective reference feature set, complete the global coarse alignment of the image to be detected, and output the globally registered image data.
[0058] The local correction unit is used to divide the entire image into a uniform grid, calculate the registration residual of each grid, perform local deformation fine correction on areas with excessive residuals, and output the final registered image and the final residual data of each area.
[0059] The defect detection module receives the registration residual data output by the registration calculation module, dynamically adjusts the judgment threshold of each region, and completes the identification and detection results of defects on the packaging surface.
[0060] Specifically, the defect detection module includes two sub-units: a threshold adaptation unit and a defect identification unit.
[0061] The threshold adaptation unit is used to receive the registration residual data of each grid region, dynamically calculate the gray-scale difference judgment threshold and area judgment threshold of the corresponding region based on the residual value, and output the threshold parameters of each region.
[0062] The defect identification unit is used to perform differential detection on the registered image based on the dynamically adjusted judgment thresholds for each region, thereby completing the location, classification, and output of detection results for defects on the packaging surface.
[0063] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for detecting defects in electronic component packaging based on image acquisition, comprising acquiring a surface image of the electronic component packaging to be inspected, performing preprocessing on the acquired image, and then identifying defects, characterized in that, A hierarchical intrinsic reference feature library corresponding to the package model is pre-constructed. Multi-level reference features of the image to be detected are extracted online. The extracted reference features are screened for availability to obtain an effective reference feature set. The global affine transformation matrix is solved based on the effective reference feature set to complete global rigid body coarse registration. The registration residual of each grid region in the whole image is calculated. Local deformation fine correction is performed on the grid regions with excessive registration residuals. The defect judgment threshold of the corresponding region is dynamically adjusted according to the final registration residual of each region. The package surface defect detection is completed based on the adjusted judgment threshold.
2. The method for detecting defects in electronic component packaging based on image acquisition according to claim 1, characterized in that, The construction steps of the hierarchical intrinsic reference feature library include: acquiring multiple bright-field images of standard defect-free packages of the same model, averaging them to generate standard template images, defining three levels of intrinsic reference features on the standard template images and labeling the corresponding standard coordinates and priority weights, recording the normal offset standard deviation of each level of reference feature, and generating a reference feature template library for the corresponding model. The first level reference is the root right angle point where the pins meet the molded body, the second level reference is the middle straight edge segment of the four outer contour edges of the molded body, and the third level reference is the fixed corner point of the laser marking area and the diagonal vertex of the molded body.
3. The method for detecting defects in electronic component packaging based on image acquisition according to claim 2, characterized in that, The steps for benchmark feature availability screening include: performing coarse matching of all extracted candidate benchmark features with the corresponding benchmarks of the standard template to obtain initial matching point pairs; and calculating the offset of each matching point pair using the following formula: In the formula, Let be the offset of the i-th reference feature. Let x be the actual x-coordinate of the i-th reference feature. Let be the actual ordinate of the i-th reference feature. Let x be the standard x-coordinate of the i-th reference feature. Let be the standard ordinate of the i-th reference feature. Calculate the average offset and standard deviation of all matching point pairs at the same level. Eliminate candidate features whose offset exceeds three times the standard deviation of the average offset. Count the number of remaining valid references. Select the references of the corresponding level to participate in the global registration calculation based on the number of valid references.
4. The method for detecting defects in electronic component packaging based on image acquisition according to claim 3, characterized in that, The execution steps of global rigid body coarse registration include: when the number of first-level effective references reaches a set proportion, the first-level effective reference point pairs are used to solve the global affine transformation matrix containing three degrees of freedom (translation, rotation, and uniform scaling) using the least squares method to complete the global alignment of the image to be detected to the standard template; when the number of first-level effective references does not reach the set proportion, the slope and intercept parameters of the second-level straight edge references are used to calculate the global transformation parameters to complete the global coarse alignment.
5. The method for detecting defects in electronic component packaging based on image acquisition according to claim 4, characterized in that, The steps for performing fine correction of local deformation include dividing the entire image into grid cells of a set size, and calculating the average registration residual of each grid cell using the following formula: In the formula, Let j be the average registration residual of the j-th grid cell. Let k be the number of valid reference features contained in the j-th grid cell, and k be the index of the reference feature within the grid. For the registration residual of the k-th reference feature, for the grid cell whose average registration residual exceeds the standard, the third-level reference feature of the grid and the surrounding set range is extracted. The local displacement vector field of the corresponding area is calculated by using the thin plate spline interpolation algorithm. Pixel-by-pixel local correction is performed on the pixels in the grid to compensate for the alignment error caused by the micro deformation of the molding process.
6. The method for detecting defects in electronic component packaging based on image acquisition according to claim 5, characterized in that, The execution steps for dynamically adjusting the defect judgment threshold include: inputting the final registration residual of each grid cell as a weight parameter into the defect detection module, and calculating the defect judgment threshold for the corresponding grid region using the following formula: In the formula, The defect determination threshold for the j-th grid region is... The standard defect determination threshold. This is the threshold adjustment coefficient. For the final registration residual of the j-th grid region, the gray-level difference judgment threshold and area judgment threshold of the corresponding grid region are adjusted synchronously according to the calculated threshold to offset the gray-level difference caused by the registration deviation.
7. The method for detecting defects in electronic component packaging based on image acquisition according to claim 1, characterized in that, The image preprocessing steps include performing Gaussian filtering on the acquired packaging surface image to remove image noise, using a sub-pixel edge extraction algorithm to obtain the edge contours of the entire image with sub-pixel precision, and extracting candidate benchmark features at each level according to the three-level feature types of the hierarchical intrinsic benchmark feature library based on the obtained edge contours.
8. An image acquisition-based electronic component packaging defect detection system, applicable to the image acquisition-based electronic component packaging defect detection method according to any one of claims 1 to 7, characterized in that, It includes an image acquisition module, a preprocessing module, a reference storage module, a registration calculation module, and a defect detection module. The image acquisition module is used to acquire surface images of electronic component packages and transmit them to the preprocessing module. The preprocessing module is used to perform filtering and edge extraction processing on the received images. The reference storage module is used to store the hierarchical inherent reference feature library of the corresponding package model. The registration calculation module is used to call the reference feature library to complete multi-level reference extraction, availability screening, two-level registration calculation, and residual output. The defect detection module is used to receive registration residual data and dynamically adjust the judgment threshold to complete the identification and output of surface defects of the package.
9. The electronic component packaging defect detection system based on image acquisition according to claim 8, characterized in that, The registration calculation module includes a reference screening unit, a global registration unit, and a local correction unit. The reference screening unit is used to extract, match, and filter multi-level reference features and output an effective reference feature set. The global registration unit is used to solve the global affine transformation matrix based on the effective reference feature set and complete the global coarse alignment of the image. The local correction unit is used to divide the image into grids and calculate the registration residuals of each grid. It performs local deformation fine correction on areas with excessive residuals and outputs the final registered image and residual data of each region.
10. The electronic component packaging defect detection system based on image acquisition according to claim 8, characterized in that, The defect detection module includes a threshold adaptation unit and a defect identification unit. The threshold adaptation unit is used to receive the registration residual data of each grid area and dynamically calculate the gray-scale difference judgment threshold and area judgment threshold of the corresponding area based on the residual value. The defect identification unit is used to locate, classify and output the detection results of the package surface defects based on the dynamically adjusted judgment thresholds of each area.