Method and apparatus for detecting electronic components

CN122921933APending Publication Date: 2026-10-16PRIME TECH GUANGZHOU INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611089663.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

当生产对象为小批量、多品种的混合电子元器件时,不同电子元器件在尺寸、封装材料、表面标识形态和反光特性方面差异较大,频繁切换检测参数不仅增加调试工作量,而且容易因人工设定不一致造成检测结果波动

Benefits of technology

本发明提供了一种电子元器件的检测方法及装置,方法包括:获取待检测PCB板上待检测电子元器件的尺寸参数和表面材质类型;按照所述尺寸参数,调整工业相机的像素配置、拍摄视场及放大倍数,直至所述待检测电子元器件的表面文字信息和/或特征标记满足预设像素占比;根据所述表面材质类型,从候选光源中选取光源组合并进行参数调节,得到目标光源组合;利用所述目标光源组合,依次点亮各光源,在每一种光源状态下采集至少一张原始图像;计算各所述原始图像的图像质量权重,并按照所述图像质量权重对多张所述原始图像进行加权融合,得到目标检测图像;对所述目标检测图像进行文字信息、方向标记或特征图形识别,得到识别结果。通过根据电子元器件尺寸自动适配相机像素、拍摄视场和放大倍数,确保微型电子元器件表面微小文字和特征标记在图像中具有足够的像素表达能力;根据玻璃材质与非玻璃材质的不同反光特性,自适应选择同轴光、低角度侧向光、环形光等多光源组合,有效降低玻璃封装电子元器件的镜面反光和局部过曝干扰;对多角度照明采集的原始图像进行质量评价和加权融合,保留不同光照条件下的有效信息,从而显著提高电子元器件表面文字信息、方向标记及特征图形的成像清晰度和识别稳定性,解决微型电子元器件在自动光学检测中因尺寸过小和材质反光导致的识别困难问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122921933A_ABST
    Figure CN122921933A_ABST
Patent Text Reader

Abstract

The application provides a kind of electronic component detection method and device, by automatically adapting camera pixel according to electronic component size, shooting field of view and magnification, ensure that the surface of miniature electronic component is small character and feature mark in image has enough pixel expression ability;According to the different reflection characteristics of glass material and non-glass material, self-adaptive selection coaxial light, low-angle lateral light, annular light and other multi-light source combination, effectively reduce the specular reflection and local overexposure interference of glass packaging electronic component;The quality evaluation and weighted fusion of the original image collected by multi-angle illumination, retain the effective information under different lighting conditions, thereby significantly improve the imaging clarity and recognition stability of the character information, direction mark and feature pattern on the surface of electronic component, solve the identification difficulty problem of miniature electronic component in automatic optical detection due to small size and material reflection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automatic optical inspection technology for electronic components, and in particular to a method and apparatus for inspecting electronic components. Background Technology

[0002] As electronic products evolve towards miniaturization, high integration, and high reliability, microelectronic components, wafer-level packaged electronic components, and system-in-package (SISP) modules are increasingly widely used in consumer electronics, wearable devices, medical implants, and high-end industrial control. These electronic components typically feature small dimensions, fine pin pitch, and limited surface marking areas. The text markings, orientation marks, and characteristic graphics on their surfaces are crucial for material traceability, model identification, orientation verification, and quality assessment during manufacturing. Especially in the automated optical inspection stage after PCB mounting, the ability to reliably acquire high-resolution images of the electronic component surface directly impacts the accuracy of subsequent text recognition and feature mark detection.

[0003] Current surface inspection of electronic components mostly employs automated optical inspection methods using industrial cameras and fixed light sources. These methods typically use an industrial camera with fixed pixel specifications, a fixed field of view, and single or fixed combinations of light sources such as ring light, coaxial light, or side light to acquire images of the electronic component surface, and then use image processing algorithms or character recognition algorithms to complete the inspection. However, when dealing with micro-electronic components with dimensions of 1mm × 1mm or smaller, the extremely small size of the component means that surface text, directional markings, or feature graphics occupy a low percentage of pixels in the acquired image, easily leading to problems such as blurred edges, broken strokes, and missing features. This makes it difficult for subsequent recognition algorithms to extract stable and effective detection information. Furthermore, different electronic components have significant differences in surface materials and packaging forms. For example, some glass-packaged electronic components have strong specular reflection and transmission characteristics, which can easily cause local overexposure, reflective obstruction, or uneven brightness distribution under fixed-angle light source illumination, causing the text markings and directional markings on the electronic component surface to be covered by reflective areas. For non-glass electronic components, their surface reflectivity, roughness, and marking contrast differ from those of glass-encapsulated electronic components. Existing testing methods typically fail to adaptively match the light source angle, brightness, and combination of light sources according to the surface material type of the electronic component. This makes it difficult to ensure consistent imaging quality for electronic components made of different materials using the same set of lighting parameters. In existing testing processes, testing parameters such as camera pixels, lens magnification, field of view, exposure parameters, light source angle, and brightness rely heavily on manual presets based on experience. When producing small batches of mixed electronic components of various types, the differences in size, packaging materials, surface marking morphology, and reflectivity are significant. Frequent switching of testing parameters not only increases the workload of debugging but also easily leads to fluctuations in test results due to inconsistent manual settings. Especially for electronic components with weak surface text, significant reflective interference, or extremely small size, fixed-parameter testing methods cannot guarantee long-term stable high-definition imaging results. Furthermore, existing testing systems often rely on images acquired under single lighting conditions for recognition. When a light source at a certain angle causes localized reflections, shadows, or insufficient marking contrast, a single image often cannot fully reflect the effective surface features of the electronic component. Although multi-source illumination and image enhancement technologies have been applied in the field of machine vision, existing methods generally lack a coordinated control mechanism for the size characteristics and surface material differences of micro electronic components, making it difficult to optimize imaging parameters and light source parameters in conjunction with the size, material type, and image quality evaluation results of electronic components.

[0004] Therefore, existing technologies still have the following shortcomings in the surface inspection of micro electronic components: First, there is a lack of adaptive matching between camera resolution, shooting field of view and the actual size of electronic components, resulting in insufficient pixel proportion of tiny text and feature marks in the image; Second, the light source configuration fails to differentiate the reflective characteristics of glass and non-glass electronic components, easily leading to overexposure, reflective obstruction, or insufficient contrast; Third, the detection parameters mainly rely on manual setting, making it difficult to adapt to multi-variety, small-batch production scenarios; Fourth, a single illumination image cannot simultaneously ensure the clarity and uniformity of different areas, resulting in insufficient stability of surface marking recognition for electronic components. Summary of the Invention

[0005] This invention provides a method and apparatus for detecting electronic components. Based on the size parameters and surface material type of the electronic component to be detected, camera parameters and light source combinations are configured, and multi-angle image fusion is combined to improve the stability and accuracy of identification and detection.

[0006] In a first aspect, the present invention provides a method for testing electronic components, comprising: Obtain the dimensional parameters and surface material type of the electronic components to be tested on the PCB board; According to the size parameters, adjust the pixel configuration, shooting field of view and magnification of the industrial camera until the surface text information and / or feature marks of the electronic component to be inspected meet the preset pixel ratio; Based on the surface material type, a combination of light sources is selected from the candidate light sources and its parameters are adjusted to obtain the target light source combination; Using the target light source combination, each light source is lit sequentially, and at least one original image is captured under each light source condition; Calculate the image quality weight of each of the original images, and then perform weighted fusion of the multiple original images according to the image quality weight to obtain the target detection image; The target detection image is subjected to text information, direction markers, or feature graphic recognition to obtain the recognition result.

[0007] Optionally, according to the size parameters, the pixel configuration, field of view, and magnification of the industrial camera are adjusted until the surface text information and / or feature markings of the electronic component to be inspected meet the preset pixel ratio, including: Determine whether the size parameter of the electronic component to be tested is smaller than the preset size. If so, select an industrial camera with no less than 20 million pixels and determine the magnification of the industrial camera according to the size parameter. Calculate the pixel percentage of the electronic component under test in the image captured by the industrial camera. When the pixel percentage is less than the preset pixel percentage, adjust the shooting field of view or the magnification so that the minimum text stroke width or minimum feature line width of the electronic component under test occupies no less than the preset minimum number of pixels in the image. The preset minimum number of pixels is determined based on the preset pixel percentage.

[0008] Optionally, based on the surface material type, a combination of light sources is selected from the candidate light sources and its parameters are adjusted to obtain a target light source combination, including: When the surface material of the electronic component to be tested is glass or highly reflective transparent material, at least two light sources with different angles are selected from the candidate light sources and stacked together to form a multi-light source stacked combination as the target light source combination. When the surface material of the electronic component to be tested is a non-glass material, a single light source or a combination of two light sources is selected from the candidate light sources as the target light source combination.

[0009] Optionally, after selecting a combination of light sources from the candidate light sources and adjusting its parameters to obtain the target light source combination, the process further includes: Pre-acquisition is performed according to the target light source combination, and the local overexposure ratio of the electronic component detection area is calculated using the pre-acquisition image. When the local overexposure ratio is greater than a preset ratio threshold, the brightness of the coaxial light or high-brightness forward light source in the target light source combination is reduced, and the brightness of the low-angle side light source or compensation light source in the target light source combination is increased.

[0010] Optionally, an image quality weight is calculated for each of the original images, and the multiple original images are weighted and fused according to the image quality weights to obtain a target detection image, including: Calculate the local overexposure suppression index, local contrast index, and edge sharpness index of the original image; The local overexposure suppression index, the local contrast index, and the edge sharpness index are weighted and summed to obtain the comprehensive image quality evaluation value of each original image, so as to obtain the corresponding image quality weight. After spatial registration of each of the original images, pixel-by-pixel fusion is performed on each of the original images according to the image quality weights to obtain the target detection image.

[0011] Optionally, based on the image quality weights, each of the original images is fused pixel-by-pixel to obtain the target detection image, including: For each pixel position in each of the original images, calculate the image quality evaluation value of each original image in the local region, and determine the local fusion weight of each original image based on the image quality evaluation value of each original image in the local region; The original images are weighted and fused pixel by pixel using the local fusion weights to generate a target detection image after region-level fusion.

[0012] Optionally, the target detection image is subjected to text information, direction markers, or feature pattern recognition to obtain a recognition result, including: Extract text regions, direction marker regions, or feature graphic regions from the target detection image; The text region is input into the character recognition model to obtain the character recognition confidence score; The direction mark region or feature graphic region is compared with a preset standard template to obtain the template similarity. Defect detection is performed on the text region, the direction mark region, or the feature graphic region to obtain the defect area ratio; The recognition result is output when the character recognition confidence is greater than or equal to a preset confidence threshold, and / or the template similarity is greater than or equal to a preset similarity threshold, and / or the defect area ratio is less than or equal to a preset defect threshold. Secondly, the present invention provides a testing device for electronic components, comprising: The acquisition module is used to acquire the size parameters and surface material type of the electronic components to be tested on the PCB board. The adjustment module is used to adjust the pixel configuration, shooting field of view and magnification of the industrial camera according to the size parameters until the surface text information and / or feature marks of the electronic component to be inspected meet the preset pixel ratio. The light source combination determination module is used to select a light source combination from the candidate light sources and adjust the parameters according to the surface material type to obtain the target light source combination; The original image acquisition module is used to sequentially illuminate each light source using the target light source combination, and acquire at least one original image under each light source condition; The target detection image acquisition module is used to calculate the image quality weight of each of the original images, and to perform weighted fusion of multiple original images according to the image quality weight to obtain the target detection image; The recognition module is used to recognize text information, direction markers, or feature graphics in the target detection image to obtain recognition results.

[0013] Thirdly, the present invention provides an electronic device including a processor and a memory, the memory storing computer-readable instructions that, when executed by the processor, perform the steps of the method provided in the first aspect above.

[0014] Fourthly, the present invention provides a storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the method provided in the first aspect above.

[0015] Fifthly, the present invention provides a computer program product comprising a computer program that, when executed by a processor, performs the steps of the method provided in the first aspect above.

[0016] As can be seen from the above technical solutions, the present invention has the following advantages: This invention provides a method and apparatus for detecting electronic components. The method includes: acquiring the size parameters and surface material type of the electronic component to be detected on a PCB board; adjusting the pixel configuration, field of view, and magnification of an industrial camera according to the size parameters until the surface text information and / or feature markings of the electronic component to be detected meet a preset pixel ratio; selecting a combination of light sources from candidate light sources according to the surface material type and adjusting the parameters to obtain a target light source combination; using the target light source combination, sequentially illuminating each light source and acquiring at least one original image under each light source condition; calculating the image quality weight of each original image and performing weighted fusion of multiple original images according to the image quality weight to obtain a target detection image; and performing text information, direction markings, or feature pattern recognition on the target detection image to obtain a recognition result. By automatically adapting camera pixels, shooting field of view, and magnification according to the size of electronic components, it ensures that the tiny text and feature markings on the surface of micro-electronic components have sufficient pixel representation capability in the image. Based on the different reflective characteristics of glass and non-glass materials, it adaptively selects multiple light source combinations such as coaxial light, low-angle side light, and ring light to effectively reduce specular reflection and local overexposure interference of glass-encapsulated electronic components. The original images acquired by multi-angle illumination are quality evaluated and weighted fusion to retain effective information under different lighting conditions, thereby significantly improving the imaging clarity and recognition stability of text information, directional markings, and feature graphics on the surface of electronic components, solving the problem of recognition difficulties caused by the small size and material reflectivity of micro-electronic components in automatic optical inspection. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the steps of a method for detecting electronic components according to the present invention. Figure 2 This is a flowchart illustrating the steps of a second embodiment of the detection method for electronic components according to the present invention. Figure 3 This is a structural block diagram of an embodiment of an electronic component testing device according to the present invention. Detailed Implementation

[0019] This invention provides a method and apparatus for detecting electronic components. Based on the size parameters and surface material type of the electronic component to be detected, camera parameters and light source combinations are configured, and multi-angle image fusion is combined to improve the stability and accuracy of recognition and detection.

[0020] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0021] Example 1 Please see Figure 1 , Figure 1 This is a flowchart illustrating the steps of a method for detecting electronic components according to an embodiment of the present invention. The method includes: Step S101: Obtain the size parameters and surface material type of the electronic components to be tested on the PCB board; In this embodiment, the dimensional parameters include the length, width, and height of the electronic components; the surface material type includes glass, highly reflective transparent materials, and non-glass materials, such as resin encapsulation, ceramic encapsulation, and reflective metal materials, which can be obtained through production work orders, material information databases, or PCB mounting coordinate files.

[0022] Step S102: According to the size parameters, adjust the pixel configuration, shooting field of view and magnification of the industrial camera until the surface text information and / or feature marks of the electronic component to be inspected meet the preset pixel ratio. In this embodiment of the application, when the size of the electronic component is less than or equal to 1mm×1mm, an industrial camera with no less than 20 million pixels is selected, the pixel ratio of the electronic component in the image is calculated, and when the ratio is less than a preset threshold, the shooting field of view or magnification is adjusted so that the minimum character stroke width or feature line width occupies no less than a preset minimum number of pixels in the image, such as 20 pixels.

[0023] Step S103: Based on the surface material type, select a light source combination from the candidate light sources and adjust the parameters to obtain the target light source combination; In the embodiments of this application, when the electronic component is made of glass or highly reflective transparent material, at least two of the following are selected for stacking and combination: coaxial light, ring light, low-angle side light, and strip light; when the electronic component is not made of glass, a single light source or a combination of two light sources is selected.

[0024] Step S104: Using the target light source combination, light each light source in sequence, and acquire at least one original image under each light source condition; In this embodiment of the application, the exposure time, gain, trigger signal and light source lighting sequence of the industrial camera are kept synchronized during the image acquisition process, and the acquired raw images are initially screened to remove images that are severely overexposed, underexposed or blurry.

[0025] Step S105: Calculate the image quality weight of each of the original images, and perform weighted fusion of multiple original images according to the image quality weight to obtain the target detection image; In this embodiment, spatial registration is performed on each original image, followed by calculation of the image quality evaluation value for each original image, and normalization to obtain the corresponding image quality weight. Then, the original images are fused according to their respective image quality weights to obtain the target detection image.

[0026] Step S106: Perform text information, direction markers, or feature graphic recognition on the target detection image to obtain the recognition result.

[0027] In this embodiment, text regions are extracted from the target detection image and input into a character recognition model to obtain character recognition confidence. Direction markers or feature graphic regions are compared with standard templates to obtain template similarity. Defect detection is performed on the above regions to obtain the defect area ratio. When the confidence, similarity, and defect area ratio all meet the corresponding preset thresholds, the recognition result is output.

[0028] This invention provides a method for detecting electronic components. The method involves: acquiring the size parameters and surface material type of the electronic component on a PCB board; adjusting the pixel configuration, field of view, and magnification of an industrial camera according to the size parameters until the surface text information and / or feature markings of the electronic component meet a preset pixel ratio; selecting a light source combination from candidate light sources and adjusting its parameters according to the surface material type to obtain a target light source combination; sequentially illuminating each light source using the target light source combination and acquiring at least one original image under each light source condition; calculating the image quality weight of each original image and weighted fusing multiple original images according to the image quality weight to obtain a target detection image; and performing text information, direction markings, or feature pattern recognition on the target detection image to obtain a recognition result. By automatically adapting camera pixels, shooting field of view, and magnification according to the size of electronic components, it ensures that the tiny text and feature markings on the surface of micro-electronic components have sufficient pixel representation capability in the image. Based on the different reflective characteristics of glass and non-glass materials, it adaptively selects multiple light source combinations such as coaxial light, low-angle side light, and ring light to effectively reduce specular reflection and local overexposure interference of glass-encapsulated electronic components. The original images acquired by multi-angle illumination are quality evaluated and weighted fusion to retain effective information under different lighting conditions, thereby significantly improving the imaging clarity and recognition stability of text information, directional markings, and feature graphics on the surface of electronic components, solving the problem of recognition difficulties caused by the small size and material reflectivity of micro-electronic components in automatic optical inspection.

[0029] Example 2 Please see Figure 2 , Figure 2 This is a flowchart illustrating a second embodiment of the detection method for electronic components according to the present invention. The steps include: Step S201: Obtain the size parameters and surface material type of the electronic components to be tested on the PCB board; In this embodiment of the application, the dimensional parameters include the length of the electronic components. L ,width W and height H , recorded as The surface material type is denoted as M Including glass or highly reflective transparent materials M g And non-glass materials (such as resin encapsulation, ceramic encapsulation, reflective metal materials, etc.) M n Therefore, the surface material type is denoted as Additionally, it can obtain the identification type of the electronic component to be tested, including text information. T c Direction markersT o and feature graphics T f , denoted as: .

[0030] The above parameters can be obtained from production work orders, material information databases, PCB mounting coordinate files, barcode traceability information, or manual entry.

[0031] Step S202: According to the size parameters, adjust the pixel configuration, shooting field of view and magnification of the industrial camera until the surface text information and / or feature marks of the electronic component to be inspected meet the preset pixel ratio. In this embodiment, it is determined whether the size parameter of the electronic component to be tested is smaller than a preset size. If so, an industrial camera with a resolution of not less than 20 megapixels is selected, and the magnification of the industrial camera is determined according to the size parameter. The pixel ratio of the electronic component to be tested in the image captured by the industrial camera is calculated. When the pixel ratio is less than the preset pixel ratio, the shooting field of view or the magnification is adjusted so that the minimum text stroke width or minimum feature line width on the surface of the electronic component to be tested occupies not less than a preset minimum number of pixels in the image. The preset minimum number of pixels is determined according to the preset pixel ratio.

[0032] In the specific implementation, let the horizontal and vertical pixel counts of the industrial camera be respectively... N x and N y The actual width and height of the shooting field of view are respectively F x and F y Then the spatial resolution of the image in the horizontal and vertical directions are respectively: ; ; in, r x and r y This refers to the actual physical size corresponding to a single pixel. To ensure that the minute markings on the surface of electronic components can be effectively identified, the following must be met: ; ; in, l min The minimum line width for the strokes of the character to be identified, the edges of the direction markers, or the feature graphics. n minThe minimum number of pixels that the minimum linewidth should occupy in the image. Determine whether the size parameters of the electronic component to be inspected are smaller than the preset size (e.g., whether it is less than or equal to 1mm × 1mm). If so, select an industrial camera with at least 20 megapixels.

[0033] Furthermore, the pixel percentage of electronic components in the acquired image is defined as: ; in, A c This represents the pixel area of ​​the electronic component region in the image. A I This represents the pixel area of ​​the entire image. When the pixel percentage... or Less than the preset threshold or At 0, adjust the shooting field of view or lens magnification to meet the requirements. or ≥ or 0. Lens magnification G It can be determined based on the actual size of the electronic components and the target imaging size: G = S i / S o ,in S i The target size of the electronic component on the imaging plane. S o This refers to the actual physical dimensions of the electronic components. By adjusting the focal length, working distance, and magnification, the electronic components are made to achieve a preset pixel ratio in the image, ensuring that even tiny character strokes have sufficient pixel representation in the image.

[0034] Step S203: Based on the surface material type, select a light source combination from the candidate light sources and adjust the parameters to obtain the target light source combination; In this embodiment, when the surface material of the electronic component to be tested is glass or highly reflective transparent material, at least two light sources with different angles are selected from the candidate light sources and stacked together to form a multi-light source stacked combination as the target light source combination; when the surface material of the electronic component to be tested is non-glass material, a single light source or a combination of two light sources is selected from the candidate light sources as the target light source combination.

[0035] In specific implementation, assume the system is configured with K There are candidate light sources, and the set of candidate light sources is represented as... L ={ L 1, L 2,…, L K}, No. k The parameters of each light source are expressed as follows: ,in, α k The incident angle of the light source, β k The azimuth angle of the light source. b k This refers to the brightness of the light source. The target light source combination is represented as... ,in s k Choose a variable for the light source, when s k =1 indicates that the first [number] is selected. k A light source, when s k =0 indicates that the first option is not selected. k One light source.

[0036] Simultaneously, when the surface material of the electronic component to be tested is glass or a highly reflective transparent material, at least two light sources at different angles are selected from the candidate light sources and stacked together to form a multi-light source stack as the target light source combination. The multi-light source stack includes a coaxial light source. L coaxial Ring light source L ring Low-angle side light source L low-angle and bar light source L bar At least two of the light sources are selected, and the brightness of each light source is adjusted independently. The target light source combination is represented as follows: When the surface material of the electronic component to be tested is not glass, a single light source or a combination of two light sources is selected from the candidate light sources as the target light source combination, which can be represented as follows: or ,in L i and L j These are different light sources in the candidate light source set.

[0037] Step S204: Perform pre-collection according to the target light source combination, and use the pre-collected image to calculate the local overexposure ratio of the electronic component detection area. When the local overexposure ratio is greater than the preset ratio threshold, reduce the brightness of the coaxial light or high brightness forward light source in the target light source combination, and increase the brightness of the low angle side light source or compensation light source in the target light source combination. In this embodiment of the application, the target light source combination determined according to step S203 Perform a pre-acquisition to obtain the pre-acquisition image. I p ( x , yLet the overexposure threshold be... t s (In an 8-bit grayscale image, the preferred choice is...) ts =250, corresponding to a brightness value close to saturation), the detection area of ​​electronic components is Ω, then the local overexposure ratio in this area R s Defined as: ; Where |Ω| represents the total number of pixels within the detection area of ​​the electronic component, and I(•) is an indicator function, taking a value of 1 when the condition within the parentheses is met, and 0 otherwise. This ratio reflects the degree of pixel saturation caused by reflection or highlighting on the surface of the electronic component. R s When the brightness exceeds a preset threshold, it is determined that there is significant reflection or localized overexposure on the surface of the electronic components, requiring adjustment of the light source brightness. The brightness adjustment of each light source is based on the reflection interference index, using the following formula: ; in b k For the first k The current brightness value of each light source. The adjusted light source brightness value. l s Δ is the reflection suppression coefficient (used to control the intensity of reflection suppression; its value typically ranges from 0.5 to 1.5, with larger values ​​indicating stronger suppression). b k This is a compensation brightness setting for different light source types. Specifically, for coaxial light or high-brightness forward light sources, Δ... b k Negative values ​​are used to reduce brightness and minimize overexposure; for low-angle side light sources or compensating light sources, Δ b k A positive value is used to improve brightness and enhance edge and texture information. This step allows for adaptive adjustment of the light source combination based on the material and reflectivity of the electronic components, avoiding problems such as reflective obstruction, localized overexposure, and illegible markings that can occur with fixed light source solutions in the inspection of glass-encapsulated electronic components.

[0038] Step S205: Using the target light source combination, light each light source in sequence, and acquire at least one original image under each light source condition; Using the aforementioned target light source combination, each light source is illuminated sequentially, and at least one original image is acquired under each light source condition. Let the first... k The original image acquired under the condition of multiple light source combinations is I k ( x , y ),in k=1,2,…, , This represents the actual number of light sources involved in image acquisition. During image acquisition, the exposure time, gain, trigger signal, and light source activation sequence of the industrial camera are synchronized. The acquired raw images undergo preliminary quality screening, discarding images with severe overexposure, underexposure, or blurriness. Image blurriness is evaluated using the gradient sharpness index, calculated as follows: ; when Q sharp ( I k If the image's resolution is less than the preset resolution threshold, it is considered to have insufficient resolution, and its subsequent fusion weight can be reduced or it can be directly removed.

[0039] Step S206: Calculate the local overexposure suppression index, local contrast index, and edge sharpness index of the original image; In this embodiment of the application, for each original image I k First, spatial registration is performed to obtain To ensure that the electronic component areas remain in the same position under different light source conditions, three indicators are calculated: local overexposure suppression index. Q s Local contrast index Q c and edge sharpness index Q e Among them, the local overexposure suppression index Q s The calculation formula is: ; in, This is an indicator function; it takes a value of 1 when the pixel value is greater than or equal to the overexposure threshold (indicating an overexposed pixel), and 0 otherwise. The larger the value, the fewer the overexposed areas in the image.

[0040] Local contrast index Q c The calculation formula is: ; in, The standard deviation of grayscale within the area of ​​electronic components. The average grayscale value within the area of ​​the electronic component. To prevent extremely small constants with a denominator of zero, this index is used to characterize the grayscale difference between text regions or feature-marked regions and the background.

[0041] Edge sharpness index Qe The calculation formula is: ; in, For the image at pixel position ( x , y The gradient magnitude at () is used to characterize the clarity of the edges of text strokes, directional markers, and feature graphic outlines.

[0042] Step S207: The local overexposure suppression index, the local contrast index, and the edge sharpness index are weighted and summed to obtain the comprehensive image quality evaluation value of each original image, so as to obtain the corresponding image quality weight. In this embodiment of the application, a comprehensive image quality evaluation index is used. Q k Defined as: ; in, oh s This is the overexposure suppression weighting coefficient. oh c This represents the local contrast weighting coefficient. oh e The edge sharpness weighting coefficient satisfies oh s + oh c + oh e =1.

[0043] The image quality weight for each image is determined based on a comprehensive image quality evaluation index: ; in, w k For the first k Image quality weights for each image. The total number of images participating in the fusion is determined by the Softmax weight allocation, which ensures that the sum of the weights of each image is 1, and that higher-quality images receive greater fusion weights.

[0044] Step S208: After spatial registration of each of the original images, pixel-by-pixel fusion is performed on each of the original images according to the image quality weights to obtain the target detection image; In this embodiment of the application, for each pixel position in each original image, the image quality evaluation value of each original image in the local region is calculated, and the local fusion weight of each original image is determined according to the image quality evaluation value of each original image in the local region; the local fusion weight is used to perform pixel-by-pixel weighted fusion on each original image to generate a target detection image after region-level fusion.

[0045] In practice, the global weighted fusion method is as follows: ; in, This is the fused target detection image.

[0046] To further improve the recognizability of local labeled regions, a region-level weighted fusion method can be used. For each pixel position in the image ( x , y Its local fusion weights are: ; in, Q k ( x , y ) is the first k The image at pixel location ( x , y The local image quality evaluation value at point (can be obtained by calculating the weighted sum of the local overexposure suppression index, local contrast index, and edge sharpness index within a small window centered on that pixel).

[0047] The region-level fused image is: ; This method reduces the impact of reflective and overexposed areas on the fused image while preserving effective information about text, markings, and feature edges under different lighting conditions.

[0048] Step S209: Extract text regions, direction marker regions, or feature graphic regions from the target detection image; In this embodiment of the application, the fused target detection image The image undergoes denoising, contrast enhancement, and edge enhancement to obtain a preprocessed image. Then, using object detection algorithms or template matching-based localization methods, the regions to be identified, including text regions, directional marker regions, or feature graphic regions, are extracted from the preprocessed image.

[0049] In the specific implementation, the fused target detection image The image is preprocessed by performing denoising, contrast enhancement, and edge enhancement. The preprocessing process is as follows: ; in, Image preprocessing operators include operations such as noise reduction filtering, contrast stretching, and edge enhancement.

[0050] Then, the region to be identified is extracted from the preprocessed image: ; Among them, Ω r This can be a text area, a direction marker area, or a feature graphic area. Extraction operators for the target region (based on object detection algorithms or template matching localization methods), the extraction results include the text region Ω c , Direction Marker Area Ω o and the feature graphic region Ω f .

[0051] Step S210: Input the text region into the character recognition model to obtain the character recognition confidence score; In this embodiment of the application, the extracted text region Ω c Input the optical character recognition model to obtain the recognition result. Y c =C(Ω c ), where C(•) is the character recognition model, and also outputs the character recognition confidence score. P ocr This confidence level reflects the degree of certainty the model has about the recognition results; the higher the value, the more reliable the character recognition.

[0052] Step S211: Compare the direction mark region or feature graphic region with a preset standard template to obtain the template similarity. In this embodiment of the application, the direction marking region Ω o or characteristic graphic area Ω f The shape, position, and orientation of the component are compared with the corresponding template in the standard electronic component information database to obtain the recognition result. The recognition result is then compared with the standard template in the standard electronic component information database; the template similarity (matching degree) can be expressed as: ; Where sim(•) is the similarity calculation function, and a higher value indicates a greater similarity to the standard template. S m Greater than or equal to the preset similarity threshold t m If the identification is correct, the orientation mark or feature pattern of the electronic component is determined; otherwise, it is determined to be an identification abnormality or requires re-inspection.

[0053] Step S212: performing defect detection on the text region, the direction mark region or the feature graphic region to obtain a defect area ratio; In the embodiment of the present application, binarization or edge detection is performed on the above regions to extract regions with missing characters, broken strokes, defective direction marks or abnormal feature graphics, and the ratio of the defect region area to the total area of the surface mark region of the electronic component is calculated and denoted as R def . This indicator is used to quantify the completeness and clarity of the surface mark of the electronic component.

[0054] Step S213: outputting the recognition result when the character recognition confidence is greater than or equal to a preset confidence threshold, and / or the template similarity is greater than or equal to a preset similarity threshold, and / or the defect area ratio is less than or equal to a preset defect threshold.

[0055] In the embodiment of the present application, if P ocr ≥ t ocr and S m ≥ t m and R def ≤ t def (where t ocr , t m , t def are respectively the preset confidence threshold, similarity threshold and defect area threshold), the detection is determined to be qualified; otherwise, the detection is determined to be unqualified or re-inspection is required. The recognition result Y can be expressed as: ; wherein is a text recognition or feature recognition model. The determination of the detection result D can be expressed as: ; wherein D =1 represents that the detection is qualified, D =0 represents that the detection is unqualified or re-inspection is required.

[0056] When the system detects that a certain type of electronic component has failed to be recognized, has a matching degree below the threshold, or has an image quality below the threshold, it adaptively optimizes the camera and light source parameters based on historical detection records. Specific adjustment rules include: when the pixel ratio of the electronic component area is insufficient, reducing the shooting field of view or increasing the lens magnification; when the local overexposure ratio is too high, reducing the brightness of the corresponding angle light source or shortening the exposure time; when the contrast of the text area is insufficient, increasing the brightness of the low-angle side light source or increasing the side illumination weight; when the edge sharpness is insufficient, adjusting the focal length, working distance, or removing blurry images; when the template similarity is below the threshold, recalculating the image quality weight and updating the target light source combination. The detection record is composed of the electronic component size parameters, surface material type, camera configuration parameters, light source combination parameters, image quality evaluation results, and recognition results. ; in, For the first i The test record, d i For the dimensional parameters of electronic components, M i For surface material type, i i For the detection parameter vector, Q i For image quality evaluation results, Y i For the recognition results, D i This is the final test result.

[0057] The detection parameter vector is defined as follows: ; in, N x and N y Configure camera pixels. F x and F y For the shooting field of view, G For lens magnification, E Let b be the exposure time, and b be the light source brightness vector. α Let be the incident angle vector of the light source. β This is the azimuth vector of the light source.

[0058] Construct a comprehensive optimization objective function: ; in, Q f To integrate the overall image quality evaluation value, R s This refers to the local overexposure ratio.S m For template similarity, T The time taken for a single test, l 1. l 2. l 3. l 4 represents the weighting coefficient.

[0059] The optimization goal for the detection parameters is: ; in These are the optimized detection parameters.

[0060] The updated detection parameters are written to the parameter configuration library: ; in, For the parameter configuration library before the update, This is the updated parameter configuration library.

[0061] For electronic components of the same size range and material type, the recommended testing parameters from the parameter configuration library should be used first during subsequent testing. ; in, i rec To recommend detection parameters, c and d These are adjustment coefficients for template similarity and detection time, respectively.

[0062] Through the above-mentioned parameter adaptive optimization mechanism, a closed-loop optimization process of "detection parameters - image quality - recognition results" is formed, reducing reliance on manual parameter tuning and improving the consistency and stability of the detection process of electronic components of different sizes and materials.

[0063] The final detection results can be further represented as multi-dimensional output: ; in, R c The results of the electronic component model test. R o The results of the inspection of electronic components are as follows. R p For the position detection results of electronic components, R q This outputs the image quality inspection results. When all inspection items meet the preset requirements, a qualified result is output and the recognized content is displayed; when any inspection item fails to meet the requirements, a failed result or a re-inspection prompt is output.

[0064] This invention provides a method for detecting electronic components. By adaptively matching the size parameters of the electronic components with camera pixels, field of view, and magnification, it ensures that micron-level character strokes occupy sufficient pixels in the image. Based on the material type of the electronic component, it automatically selects coaxial light, ring light, low-angle side light, or strip light sources for layering and combination, and adjusts the light source brightness feedback for overexposed images, effectively suppressing specular reflections on glass-encapsulated electronic components and local glare on non-glass electronic components. After acquiring multiple original images under multi-angle illumination, it performs weighted fusion of three indicators: local overexposure suppression, local contrast, and edge sharpness, synergistically enhancing the text subject, edge contours, and directional marking information under different lighting conditions. The fused high-definition image is input into a character recognition model and template matching module, combined with defect area ratio detection. When the confidence level, similarity, and defect rate all meet the thresholds, the recognition result is output, significantly improving the recognition success rate of surface markings on micro-electronic components and reducing false recognition and rejection rates. This provides stable and reliable technical support for the detection of multi-variety, small-batch electronic components.

[0065] To facilitate those skilled in the art to understand the beneficial effects of the present invention, an example of a testing method for electronic components of the present invention is described below.

[0066] Example 1: This example uses a glass-encapsulated microchip as the testing object. The chip is mounted on a PCB board, with dimensions of 0.8mm × 0.8mm. Its surface features four laser-engraved characters and a direction identification notch. Due to the glass encapsulation layer covering the chip surface, specular reflection and localized overexposure are easily generated under vertical lighting conditions, resulting in broken character strokes, unclear edges of the direction identification notch, or insufficient contrast in the character area. The testing objectives of this example are: to identify the character content on the chip surface, determine whether the direction identification notch is correctly positioned, and determine whether there are obvious missing parts, breaks, or reflective obstructions in the marking area on the chip surface.

[0067] For the above-mentioned testing targets, perform the following operations in sequence.

[0068] Step (1): Configuring the testing equipment The industrial camera is a 2600×2160 resolution area array camera with a pixel size of 2.5μm×2.5μm and a frame rate of approximately 20fps. The lens is a 2x telecentric lens with a working distance of approximately 66.9mm. The light source system includes a coaxial light source, a low-angle side light source, a multi-angle ring light source, and a ring supplementary light source. Specific configurations are as follows:

[0069] Step (2): Determining size-adaptive imaging parameters First, obtain the width of the chip to be tested. Wc =0.8mm, camera horizontal pixel count N x =2600, camera pixel size p x =2.5 m m, and set the target pixel ratio of the chip in the horizontal direction of the image to be m. =25%. The target magnification can then be determined using the following formula: ; Substituting the above parameters, we get: .

[0070] Therefore, this example selects a 2× telecentric lens, so that the chip occupies approximately 25% of the image width in the acquired image. With this configuration, the field of view is approximately: ; Right now: .

[0071] Therefore, the pixel width occupied by a 0.8mm wide chip in the image is approximately: .

[0072] When the minimum character stroke width on the chip surface is 25μm, its pixel width in the image is approximately: .

[0073] This demonstrates that the minimum stroke width can reach approximately 20 pixels, which is beneficial for subsequent character recognition and stroke defect assessment. This step establishes a clear match between camera resolution, lens magnification, and chip size, avoiding the problem of insufficient pixel proportion for micro-characters in traditional fixed-field-of-view imaging methods.

[0074] Step (3): Material-adaptive multi-light source acquisition Based on the chip surface material type, this example categorizes glass-encapsulated chips as highly reflective transparent materials. The system first uses low-brightness coaxial light for pre-acquisition and calculates the local overexposure ratio Rs of the chip area. Rs. If the local overexposure ratio exceeds the preset threshold, the brightness of the coaxial light will be reduced, and the participation weight of low-angle side light and multi-angle ring light will be increased.

[0075] In this example, the original image is acquired sequentially using four different light source states: ,in, I Image 1 is a coaxial light image. I Image 2 is a low-angle side-lit image. I 3 is a multi-angle ring light image. IImage 4 is a ring-lit image.

[0076] The preferred initial acquisition parameters are as follows:

[0077] The light source brightness and exposure time described above are preferred settings for this example and are not the only limiting values. In actual testing, adjustments can be made based on the reflectivity of the chip surface, the color of the characters, the transmittance of the packaging material, and the camera response characteristics.

[0078] Step (4): Image quality assessment and weighted fusion The four acquired original images were registered to obtain a spatially consistent image sequence. Subsequently, the local overexposure ratio was calculated for each image frame. R s Local contrast index Q c Edge sharpness index Q e and local overexposure suppression index Q s .

[0079] The local overexposure ratio is defined as: ; Where Ω represents the chip detection area. N This represents the total number of pixels in the region. T l The underexposure threshold, T h This is the overexposure threshold. In an 8-bit grayscale image, the preferred value is: , .

[0080] The comprehensive image quality evaluation value is defined as: ; in, To normalize local contrast, To normalize edge gradient sharpness, To normalize illumination uniformity, the evaluation results for the four frames in this example are as follows:

[0081] Calculate image quality weights based on the overall image quality evaluation value: ; Where α is the weight sensitivity coefficient, and in this example, α=5.

[0082] The calculation yielded: , , , .

[0083] The final fused image is: .

[0084] The results above show that, for glass-encapsulated chips, while coaxial light images can reflect the main characters, they suffer from high local overexposure. Low-angle side lighting and multi-angle ring lighting contribute more to the character edges and shallowly etched areas. Therefore, this invention uses quality-weighted fusion to allow effective information from different lighting conditions to participate in imaging, thereby reducing reflective interference and enhancing the clarity of character edges.

[0085] Step (5): Identification and Judgment fused target detection image I f Character region extraction, directional gap localization, and template comparison are performed. The recognition results are expressed using character recognition confidence scores. P ocr Template similarity S m and the percentage of defect area R def Jointly determined.

[0086] In this example, the determination rule is: P ocr ≥0.985 and S m ≥0.92 and R def ≤0.005.

[0087] For example, if a chip under test recognizes the character "6A2F", the recognition result is: P ocr =0.992 and S m =0.938 and R def If the value is 0.0031, then the above judgment condition is met, and the output recognition result is qualified.

[0088] The method of this embodiment is compared with the fixed single-light source detection method. The results of testing 300 glass-encapsulated microchips are as follows:

[0089] As shown in the table, compared with the fixed single-light source detection method, the present invention can significantly reduce the local overexposure ratio of glass-encapsulated chips and improve the confidence and success rate of character recognition. This is because the present invention does not simply increase camera pixels or the number of light sources, but rather determines the imaging magnification based on the chip size, selects the light source combination based on the surface material, and uses image quality indicators to perform weighted fusion of multiple frames, thereby achieving synergistic enhancement of reflective areas, shallowly etched edges, and the main text information.

[0090] Example 2: This example uses a mixed-material chip tray as the inspection object. The tray contains resin-encapsulated chips, ceramic-encapsulated chips, and metal-covered chips. Each chip is approximately 1.2mm × 1.2mm in size, and each chip surface has model number characters, batch number characters, and orientation markings. Because different encapsulation materials reflect light differently, resin-encapsulated chips are prone to low contrast, ceramic-encapsulated chips are prone to localized glare, and metal-covered chips are prone to strong reflection and localized saturation. Therefore, using fixed camera and light source parameters can easily lead to significant differences in image quality between chips of different materials within the same tray.

[0091] For the above-mentioned detection targets, this example performs the following operations in sequence.

[0092] Step (1): Configuring the testing equipment This example employs a wide field-of-view batch inspection mode. The industrial camera used can be a 4508×4096 (18.4MP) area scan camera with a pixel size of 2.5μm×2.5μm and a frame rate of approximately 20fps. The lens is a 1× telecentric lens, used in conjunction with multi-angle ring light, striped oblique illumination, and coaxial light for multi-frame acquisition. Multi-angle light sources are used to ensure uniform illumination across different materials, striped oblique illumination enhances shallow markings and surface unevenness, and coaxial light supplements the reflective information of the character body.

[0093] The configuration in this example is as follows:

[0094] Step (2): Determining wide field-of-view imaging parameters Let the chip width be W c =1.2mm, camera horizontal pixel count is N x =4508, cell size is p x =2.5 m m. In the tray batch inspection mode, to balance inspection efficiency and single-chip recognition accuracy, the target pixel ratio is set to be... =12%, target magnification is: ; Therefore, this example uses a 1× telecentric lens. The size of a single pixel on the object surface is approximately: .

[0095] When the minimum character stroke width is 30μm, the corresponding number of pixels is: ; This pixel width meets the basic requirements for character segmentation, direction marker extraction, and template matching. Compared to the single-chip precision detection mode, this example improves detection efficiency by reducing the proportion of a single chip in the entire image and enabling simultaneous acquisition of multiple chips within the same frame.

[0096] Step (3): Material-adaptive light source combination In this example, a low-brightness preview image is first acquired, and the material tendency of the chip surface is determined based on the mean gray level, gray level variance, local overexposure ratio, and local contrast index of the chip ROI region.

[0097] The rules for determining the material are as follows: ; in, M r It is a highly reflective material. M d It is a low-contrast diffuse reflection material. M c It is made of ceramic or a material with localized glare.

[0098] Based on the material identification results, the light source priority is automatically adjusted. The optimization rules are as follows:

[0099] In this example, the three frame acquisition parameters are as follows:

[0100] Step (4): Multi-frame image quality assessment and weighted fusion This example performs image quality evaluation on three frames acquired for each field of view, and determines the image quality weight based on the overall image quality evaluation value. The quality evaluation formula is as follows: ; For a field of view containing 4 chips, the following evaluation results were obtained:

[0101] Pick Then the image quality weights are: , , Then the image quality weights are: .

[0102] The fusion results indicate that in the detection of hybrid material chips, multi-angle ring light contributes significantly to overall uniformity, strip-shaped oblique illumination significantly enhances shallow imprint edges and directional markings, and although coaxial light is prone to local saturation in metal cover chips, it can still provide some character information. Therefore, retaining the effective information of each light source through quality weighting can avoid the material adaptation problem caused by fixed main frame detection.

[0103] Step (5): Chip identification and batch output Chip localization was performed on the fused image, resulting in four chip ROI regions: , , , For each ROI, attitude correction, character recognition, orientation marker localization, and defect area calculation are performed separately. The judgment rule is as follows: ; in, This indicates the chip orientation angle deviation.

[0104] The recognition results for a certain field of view are as follows:

[0105] Among them, the C4 chip was deemed unqualified because the character recognition confidence, template similarity, defect area ratio and direction deviation did not meet the preset conditions, and a re-inspection or rejection instruction was output.

[0106] Step (6): Adaptive parameter optimization Each recognition result is written to the parameter configuration library. For chips of the same batch or similar material, the system updates the recommended parameters based on historical recognition results.

[0107] The test record can be represented as: ; in, M i Material type i i For detection parameters, Q i This is the image quality evaluation value. D i This is the final judgment result.

[0108] When a high degree of local overexposure is detected in the metal cover chip, the following adjustments are made: ; ; When insufficient character contrast is detected on the resin-encapsulated chip, the following adjustments are made: ; .

[0109] In this example, the parameter optimization records are as follows:

[0110] Through this closed-loop optimization process, the system can gradually form a correspondence between "chip material - light source parameters - imaging quality - recognition results", reducing reliance on manual parameter adjustment and improving the consistency of batch detection of mixed materials.

[0111] The results of batch testing of 2000 hybrid material chips are as follows:

[0112] As shown in the table, this invention significantly improves the recognition success rate of chips with mixed materials while reducing the false recognition and false rejection rates, provided that the detection cycle time basically meets the production line requirements. Although the single-chip equivalent cycle time is slightly increased due to multi-frame acquisition and image fusion, its detection accuracy and stability are significantly better than the fixed light source detection method, making it particularly suitable for PCB chip detection scenarios with multiple varieties, small batches, and mixed packaging materials.

[0113] Example 3: Application Case of Automatic Reshooting and Parameter Update After Recognition Failure This example illustrates how the present invention adjusts the detection parameters in reverse based on the image quality evaluation results and automatically performs a re-encoder when the chip fails to detect on the first attempt.

[0114] A glass-encapsulated microchip was found on a PCB board. During the initial test, the system used default parameters for data acquisition. The test results are as follows:

[0115] The main reason for the chip's detection failure was determined to be localized overexposure caused by reflections from the glass surface, resulting in decreased contrast in the character area. To address this recognition failure, this example automatically triggered the following parameter adjustment and re-enhancing process: Depending on the failure type, the system automatically performs the following adjustments: reducing coaxial light brightness, increasing low-angle side light brightness, shortening coaxial light exposure time, recalculating multi-frame image quality weights, and performing a reshoot.

[0116] The parameters before and after adjustment are as follows:

[0117] Step (2): Results of reshoot After reshooting, the system recalculates the image quality metrics and recognition results:

[0118] The system binds the adjusted parameters to the chip's size, material type, and product model, and writes them into the parameter configuration library: ; in, This represents the optimal parameters obtained after repeated testing. When testing similar glass-packaged chips, the system will prioritize using this set of parameters, thereby reducing the number of repeated tests and improving testing stability.

[0119] Step (3): Application Effect Description This example demonstrates that the present invention can automatically adjust camera and light source parameters based on image quality indicators and recognition results, forming a closed-loop optimization mechanism for detection parameters and reducing reliance on manual parameter tuning. Through automatic parameter optimization after the initial detection failure, all four image quality indicators improved from being unqualified to being qualified, verifying the effectiveness of the present invention's adaptive parameter optimization mechanism.

[0120] The three application examples above demonstrate that the present invention can achieve stable application in different detection scenarios: First, in the scenario of precise inspection of a single glass-encapsulated microchip, this invention significantly reduces the problems of overexposure and character occlusion caused by reflections on the glass surface through size-adaptive imaging and multi-source weighted fusion.

[0121] Secondly, in the scenario of batch inspection of mixed material trays, the present invention can adjust the light source priority according to the reflective characteristics of chips of different materials, and perform quality weighted fusion of multiple frames of images to improve the consistency of multi-variety inspection.

[0122] Third, in scenarios where recognition fails and reshoots are needed, this invention can automatically adjust camera and light source parameters based on image quality indicators and recognition results, forming a closed-loop optimization mechanism for detection parameters and reducing reliance on manual parameter adjustment.

[0123] Therefore, the technical effect of this invention does not stem from a single high-pixel camera, a single light source, or a single recognition algorithm, but rather from the synergistic effect between "chip size adaptive imaging configuration, material-adaptive light source control, multi-frame image quality weighted fusion, and recognition result feedback optimization." This synergistic mechanism can effectively improve the imaging clarity, recognition accuracy, and production line inspection stability of text information, directional markings, and feature graphics on the surface of microchips.

[0124] Example 3

[0125] Please see Figure 3 , Figure 3 This is a structural block diagram of an embodiment of an electronic component testing device according to the present invention. The device includes: The acquisition module 301 is used to acquire the size parameters and surface material type of the electronic components to be tested on the PCB board to be tested. The adjustment module 302 is used to adjust the pixel configuration, shooting field of view and magnification of the industrial camera according to the size parameters until the surface text information and / or feature marks of the electronic component to be inspected meet the preset pixel ratio. The light source combination determination module 303 is used to select a light source combination from the candidate light sources and adjust the parameters according to the surface material type to obtain the target light source combination; The original image acquisition module 304 is used to sequentially illuminate each light source using the target light source combination, and acquire at least one original image under each light source state. The target detection image acquisition module 305 is used to calculate the image quality weight of each of the original images, and to perform weighted fusion of multiple original images according to the image quality weight to obtain a target detection image; The recognition module 306 is used to recognize text information, direction marks or feature graphics in the target detection image to obtain recognition results.

[0126] In an optional embodiment, the adjustment module 302 includes: The judgment submodule is used to determine whether the size parameter of the electronic component to be tested is smaller than the preset size. If so, an industrial camera with a resolution of not less than 20 million pixels is selected, and the magnification of the industrial camera is determined according to the size parameter. The adjustment submodule is used to calculate the pixel ratio of the electronic component under test in the image captured by the industrial camera. When the pixel ratio is less than the preset pixel ratio, the shooting field of view or the magnification is adjusted so that the minimum text stroke width or minimum feature line width of the electronic component under test occupies no less than the preset minimum number of pixels in the image. The preset minimum number of pixels is determined according to the preset pixel ratio.

[0127] In an optional embodiment, the light source combination determination module 303 includes: The first light source combination determination submodule is used to select at least two light sources with different angles from the candidate light sources and stack them together to form a multi-light source stack combination as the target light source combination when the surface material type of the electronic component to be tested is glass or highly reflective transparent material. The second light source combination determination submodule is used to select a single light source or a combination of two light sources as the target light source combination when the surface material type of the electronic component to be tested is a non-glass material.

[0128] In an optional embodiment, it further includes: The brightness adjustment module is used to pre-acquire the target light source combination and calculate the local overexposure ratio of the electronic component detection area using the pre-acquired image. When the local overexposure ratio is greater than a preset ratio threshold, the brightness of the coaxial light or high-brightness forward light source in the target light source combination is reduced, and the brightness of the low-angle side light source or compensation light source in the target light source combination is increased.

[0129] In an optional embodiment, the target detection image acquisition module 305 includes: The index calculation submodule is used to calculate the local overexposure suppression index, local contrast index, and edge sharpness index of the original image. The weighted summation operator module is used to perform a weighted summation of the local overexposure suppression index, the local contrast index, and the edge sharpness index to obtain a comprehensive image quality evaluation value for each original image, so as to obtain the corresponding image quality weight. The fusion submodule is used to perform spatial registration on each of the original images, and then perform pixel-by-pixel fusion on each of the original images according to the image quality weights to obtain the target detection image.

[0130] In an optional embodiment, the fusion submodule includes: The local fusion weight determination unit is used to calculate the image quality evaluation value of each original image in a local region for each pixel position in each original image, and determine the local fusion weight of each original image based on the image quality evaluation value of each original image in the local region. The fusion unit is used to perform pixel-by-pixel weighted fusion of each of the original images using the local fusion weights to generate a target detection image after region-level fusion.

[0131] In an optional embodiment, the identification module 306 includes: An extraction submodule is used to extract text regions, direction marker regions, or feature graphic regions from the target detection image; The confidence determination submodule is used to input the text region into the character recognition model to obtain the character recognition confidence. The comparison submodule is used to compare the direction mark region or feature graphic region with a preset standard template to obtain the template similarity. The defect area ratio detection submodule is used to perform defect detection on the text area, the direction mark area, or the feature graphic area to obtain the defect area ratio. The recognition result output submodule is used to output the recognition result when the character recognition confidence is greater than or equal to a preset confidence threshold, and / or the template similarity is greater than or equal to a preset similarity threshold, and / or the defect area ratio is less than or equal to a preset defect threshold.

[0132] Example 4 This invention also provides an electronic device, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of a detection method for an electronic component according to any embodiment.

[0133] Example 5 This invention also provides a computer storage medium storing a computer program thereon, which, when executed by the processor, implements the steps of a detection method for an electronic component according to any embodiment.

[0134] Example 6 This invention also provides a computer program product having a computer program stored thereon, wherein the computer program, when executed by the processor, implements the steps of a detection method for an electronic component according to any embodiment.

[0135] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0136] In the several embodiments provided in this application, it should be understood that the methods, apparatuses, electronic devices, and storage media disclosed in this invention can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0137] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0138] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0139] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned readable storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0140] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for testing electronic components, characterized in that, include: Obtain the dimensional parameters and surface material type of the electronic components to be tested on the PCB board; According to the size parameters, adjust the pixel configuration, shooting field of view and magnification of the industrial camera until the surface text information and / or feature marks of the electronic component to be inspected meet the preset pixel ratio; Based on the surface material type, a combination of light sources is selected from the candidate light sources and its parameters are adjusted to obtain the target light source combination; Using the target light source combination, each light source is lit sequentially, and at least one original image is captured under each light source condition; Calculate the image quality weight of each of the original images, and then perform weighted fusion of the multiple original images according to the image quality weight to obtain the target detection image; The target detection image is subjected to text information, direction markers, or feature graphic recognition to obtain the recognition result.

2. The method for detecting electronic components according to claim 1, characterized in that, According to the stated size parameters, adjust the pixel configuration, field of view, and magnification of the industrial camera until the surface text information and / or feature markings of the electronic component to be inspected meet the preset pixel ratio, including: Determine whether the size parameter of the electronic component to be tested is smaller than the preset size. If so, select an industrial camera with no less than 20 million pixels and determine the magnification of the industrial camera according to the size parameter. Calculate the pixel percentage of the electronic component under test in the image captured by the industrial camera. When the pixel percentage is less than the preset pixel percentage, adjust the shooting field of view or the magnification so that the minimum text stroke width or minimum feature line width of the electronic component under test occupies no less than the preset minimum number of pixels in the image. The preset minimum number of pixels is determined based on the preset pixel percentage.

3. The method for testing electronic components according to claim 1, characterized in that, Based on the surface material type, a combination of light sources is selected from the candidate light sources and its parameters are adjusted to obtain the target light source combination, including: When the surface material of the electronic component to be tested is glass or highly reflective transparent material, at least two light sources with different angles are selected from the candidate light sources and stacked together to form a multi-light source stacked combination as the target light source combination. When the surface material of the electronic component to be tested is a non-glass material, a single light source or a combination of two light sources is selected from the candidate light sources as the target light source combination.

4. The method for detecting electronic components according to claim 3, characterized in that, After selecting a combination of light sources from the candidate light sources and adjusting its parameters to obtain the target light source combination, the process also includes: Pre-acquisition is performed according to the target light source combination, and the local overexposure ratio of the electronic component detection area is calculated using the pre-acquisition image. When the local overexposure ratio is greater than a preset ratio threshold, the brightness of the coaxial light or high-brightness forward light source in the target light source combination is reduced, and the brightness of the low-angle side light source or compensation light source in the target light source combination is increased.

5. The method for testing electronic components according to claim 1, characterized in that, Calculate the image quality weight of each of the original images, and perform weighted fusion of multiple original images according to the image quality weight to obtain a target detection image, including: Calculate the local overexposure suppression index, local contrast index, and edge sharpness index of the original image; The local overexposure suppression index, the local contrast index, and the edge sharpness index are weighted and summed to obtain the comprehensive image quality evaluation value of each original image, so as to obtain the corresponding image quality weight. After spatial registration of each of the original images, pixel-by-pixel fusion is performed on each of the original images according to the image quality weights to obtain the target detection image.

6. The method for testing electronic components according to claim 5, characterized in that, Based on the image quality weights, each of the original images is fused pixel-by-pixel to obtain the target detection image, including: For each pixel position in each of the original images, calculate the image quality evaluation value of each original image in the local region, and determine the local fusion weight of each original image based on the image quality evaluation value of each original image in the local region; The original images are weighted and fused pixel by pixel using the local fusion weights to generate a target detection image after region-level fusion.

7. The method for testing electronic components according to claim 1, characterized in that, The target detection image is subjected to text information, direction markers, or feature graphic recognition to obtain recognition results, including: Extract text regions, direction marker regions, or feature graphic regions from the target detection image; The text region is input into the character recognition model to obtain the character recognition confidence score; The direction mark region or feature graphic region is compared with a preset standard template to obtain the template similarity. Defect detection is performed on the text region, the direction mark region, or the feature graphic region to obtain the defect area ratio; The recognition result is output when the character recognition confidence is greater than or equal to a preset confidence threshold, and / or the template similarity is greater than or equal to a preset similarity threshold, and / or the defect area ratio is less than or equal to a preset defect threshold.

8. A testing device for electronic components, characterized in that, include: The acquisition module is used to acquire the size parameters and surface material type of the electronic components to be tested on the PCB board. The adjustment module is used to adjust the pixel configuration, shooting field of view and magnification of the industrial camera according to the size parameters until the surface text information and / or feature marks of the electronic component to be inspected meet the preset pixel ratio. The light source combination determination module is used to select a light source combination from the candidate light sources and adjust the parameters according to the surface material type to obtain the target light source combination; The original image acquisition module is used to sequentially illuminate each light source using the target light source combination, and acquire at least one original image under each light source condition; The target detection image acquisition module is used to calculate the image quality weight of each of the original images, and to perform weighted fusion of multiple original images according to the image quality weight to obtain the target detection image; The recognition module is used to recognize text information, direction markers, or feature graphics in the target detection image to obtain recognition results.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing computer-readable instructions that, when executed by the processor, perform the method as described in any one of claims 1-7.

10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it performs the method as described in any one of claims 1-7.