A circuit board metallographic section image defect detection method
By calculating local directional energy using Gabor filters and constructing adaptive anisotropic filters, the problem of distinguishing between background scratches and defects was solved, and high-precision defect detection of metallographic slice images of circuit boards was achieved.
Patent Information
- Application Number
- CN202511120313.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2045-08-12
AI Technical Summary
Existing technologies cannot effectively distinguish between background scratches and actual defects in metallographic cross-section images of circuit boards, resulting in distortion of defect morphology during the filtering process and affecting detection accuracy.
Gabor filters are used to calculate local directional energy and generate directional energy maps. Spatially adaptive anisotropic filters are constructed using directional continuity index and scratch similarity to selectively smooth background scratches while preserving defect features.
It achieves precise removal of background scratches, maintains the integrity of defect edges, and significantly improves the detection accuracy and reliability of metallographic analysis of circuit boards.
Smart Images

Figure CN120635071B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image processing, in particular to a circuit board metallographic section image defect detection method. BACKGROUND
[0002] The quality of a printed circuit board is a core element that determines the reliability of the final product. In order to ensure the integrity of the internal microstructure of the circuit board, such as detecting the uniformity of the plating layer of the via and the connection reliability of the solder joint, metallographic section analysis has become an indispensable key detection method. This method intercepts the key parts of the circuit board to produce a cross-section sample that can be observed under a microscope, thereby exposing the internal microstructure to find possible manufacturing defects such as voids, cracks, impurities, etc.
[0003] However, the mechanical grinding and polishing steps in the preparation process of the metallographic section leave a large number of fine scratches on the sample surface, which are basically consistent in direction and distributed at high density. When imaged under a microscope, these scratches form strong noise in the image background, which can be very similar in visual features to some real defects, thereby seriously interfering with subsequent automated defect recognition algorithms.
[0004] The current method commonly used to solve the above problem is a frequency domain filtering method based on Fourier transform. The technical logic is as follows: the regular and directional structure in the image (such as background scratches) will concentrate its energy as a high-light linear or point area in a specific direction on the frequency spectrum graph after two-dimensional Fourier transform. After identifying these frequency components representing scratches, a corresponding notch filter can be designed to suppress the amplitude of these frequency components. Finally, by inverse Fourier transform, the processed frequency spectrum graph is converted back to the spatial domain, and a clear image without scratches can be obtained.
[0005] However, this global frequency domain filtering cannot distinguish whether a vertical component at a specific frequency location is from a large area of background scratches or from a small vertical edge of a real defect. Its processing method is to suppress all components that meet the direction and frequency characteristics. The final result is that while eliminating scratch noise, the real edge of the defect itself will also be eliminated or weakened. For metallographic analysis scenarios that require accurate assessment of defect size and shape to determine its hazard level, this loss of information is unacceptable. SUMMARY
[0006] In order to solve the technical problem that the traditional filtering method cannot distinguish the similar direction features of scratches and defects, resulting in distortion of the defect morphology, the present application provides a circuit board metallographic section image defect detection method.
[0007] The present application provides a method for detecting defects in metallographic slice images of circuit boards, comprising: acquiring a metallographic slice image of a circuit board containing background scratch noise, calculating the local directional energy of each pixel point in the metallographic slice image of the circuit board in a preset scratch direction, and generating a directional energy map; based on the directional energy map, calculating a directional continuity index of each pixel point by analyzing the neighborhood energy distribution of each pixel point in the preset scratch direction, wherein the directional continuity index is used to characterize the degree to which the pixel point belongs to a long-range continuous scratch; based on the directional continuity index, constructing a spatially adaptive scratch similarity for each pixel point, wherein a pixel point with a higher directional continuity index has a larger corresponding scratch similarity value; and based on the scratch similarity, performing spatially adaptive anisotropic filtering processing on the metallographic slice image of the circuit board to selectively smooth background scratches and retain defect characteristics, thereby realizing defect detection on the metallographic slice image of the circuit board.
[0008] In one embodiment, the local directional energy is calculated by performing convolution processing on the metallographic slice image of the circuit board using a set of Gabor filters with multiple directions set to obtain the energy response of the image in each direction, and using the energy response corresponding to the preset scratch direction as the directional energy map.
[0009] Gabor filters have the best joint resolution for textures of specific orientations and frequencies, and are extremely sensitive to directional features in images. By constructing an energy map for a specific orientation, all visual features related to scratch directions can be effectively enhanced and extracted, providing high-quality initial features for subsequent differentiation between the two.
[0010] In one embodiment, the directional continuity index satisfies the relationship: ;in, Pixel Directional continuity index; Pixel Along the preset scratch direction and the distance is The local directional energy of the neighboring points; is the neighborhood one-way search length; is the maximum energy value in the directional energy map, used for normalization.
[0011] By integrating the neighborhood energy along the scratch direction, the index can effectively distinguish long and continuous scratch features from short and discontinuous defect edge features. The calculated continuity index value directly reflects the confidence that the pixel point belongs to a long scratch.
[0012] In one embodiment, based on the directional continuity index, the scratch similarity is generated by a Sigmoid function, and the scratch similarity satisfies the relationship: ; wherein, is a scratch similarity of the pixel point ; is a gain coefficient for controlling the steepness of the Sigmoid function; is a preset threshold for distinguishing scratch and non-scratch features.
[0013] Using the Sigmoid function for non-linear mapping, a controllable transition zone can be provided to avoid blockiness or artifacts that may be caused by using a hard threshold. By adjusting the gain and threshold parameters of the function, the determination criteria for blurred features and the variation rate of the filtering strength can be flexibly controlled to enhance robustness and adaptability.
[0014] In one embodiment, the spatially adaptive anisotropic filtering process is implemented by using an anisotropic Gaussian filter.
[0015] In one embodiment, the standard deviation of the anisotropic Gaussian filter in a direction orthogonal to the preset scratch direction is a fixed value, and the standard deviation in the preset scratch direction is dynamically controlled by the scratch similarity.
[0016] The anisotropic Gaussian filter can achieve direction-selective smoothing, which can perform strong blurring only along the scratch direction in the scratch area and hardly produce blurring in the defect area.
[0017] In one embodiment, the standard deviation of the anisotropic Gaussian filter in the preset scratch direction satisfies the relationship: ; wherein, is the standard deviation corresponding to the maximum blurring degree of the filter; is the standard deviation corresponding to the minimum blurring degree of the filter.
[0018] In one embodiment, the method further comprises, after performing the spatially adaptive anisotropic filtering process, applying an image segmentation algorithm to the filtered image to extract and output a binary mask of the defect area.
[0019] The technical solution of the present application has the following beneficial technical effects:
[0020] The present application obtains a scratch similarity capable of distinguishing long-range continuous scratches from short-range defect edges by analyzing the local anisotropy characteristics of the image, and guides an anisotropy filter to filter the image, thereby realizing accurate removal of scratches and complete protection of defect morphology. Therefore, while eliminating background scratch interference, the sharpness and integrity of the defect edge are maintained, providing a high-quality image basis for subsequent accurate defect analysis, thereby significantly improving the overall detection accuracy and reliability of the circuit board metallographic analysis automatic system. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 is a flowchart of a circuit board metallographic slice image defect detection method according to an embodiment of the present application.
[0022] Figure 2 is a schematic diagram of a raw image of a circuit board metallographic slice to be detected according to an embodiment of the present application.
[0023] Figure 3 is a schematic diagram of a vertical direction energy map obtained after processing the raw image according to an embodiment of the present application.
[0024] Figure 4 is a schematic diagram of a vertical continuity index map according to an embodiment of the present application.
[0025] Figure 5 is a schematic diagram of a scratch similarity map calculated according to an embodiment of the present application.
[0026] Figure 6 is a schematic diagram of an image obtained after adaptive anisotropy filtering according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] The technical solutions in the embodiments of the present application will be described in detail below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all embodiments.
[0028] Figure 1 is a flowchart of a circuit board metallographic slice image defect detection method according to an embodiment of the present application. As shown in Figure 1 , the circuit board metallographic slice image defect detection method includes steps S101-S104, which will be described in detail below.
[0029] S101, collect a circuit board metallographic slice image containing background scratch noise, calculate the local direction energy of each pixel point in the circuit board metallographic slice image in a preset scratch direction, and generate a direction energy map.
[0030] In one embodiment, the metallographic slice image of the circuit board to be detected can be acquired by a metallographic microscope and an image acquisition device matched therewith. As shown in Figure 2 Fig. 1 is a schematic diagram of an original image of a metallographic slice of a circuit board to be detected according to an embodiment of the present application.
[0031] Further, in order to facilitate subsequent calculation and eliminate the interference of uneven illumination, it is usually necessary to pre-process the original image. In the present embodiment, the pre-processing includes grayscale and normalization of the metallographic slice image of the circuit board, i.e., converting the original image from color to single-channel gray image, and mapping the grayscale value of the image from the interval of 0-255 to the interval of 0-1.
[0032] In an alternative embodiment, as shown in Figure 2 In actual operation, the background scratches are almost regular vertical, so the preset scratch direction in the present application is 90-degree vertical direction.
[0033] Further, since the Gabor filter has extremely high sensitivity to textures of specific direction and frequency, the Gabor filter can be used to detect the features in the preset scratch direction, specifically: a Gabor filter with a main direction of 90 degrees can be used, and the pre-processed image is convolved with the filter. The result of the convolution is a new image, in which the value of each pixel represents the energy response intensity of the corresponding position of the original image in the vertical direction. In the present application, the obtained image is taken as the vertical direction energy map, as shown in Figure 3 As can be seen, in the energy map, whether the real vertical scratch or the vertical edge of the defect, will be enhanced due to the inclusion of the vertical component, and present as a high-luminance region.
[0034] In this way, through the Gabor filtering, all potential vertical structural features in the image are effectively extracted and enhanced, providing data support for the next step of distinguishing and recognizing.
[0035] In one embodiment, the direction continuity index of each pixel can be calculated by analyzing the neighborhood energy distribution of each pixel in the preset scratch direction. If a point is located on a long scratch, then its neighbors above and below it in the vertical direction should also have a relatively high energy, and the direction continuity index satisfies the relationship:
[0036] In one embodiment, the direction continuity index of each pixel can be calculated by analyzing the neighborhood energy distribution of each pixel in the preset scratch direction. If a point is located on a long scratch, then its neighbors above and below it in the vertical direction should also have a relatively high energy, and the direction continuity index satisfies the relationship:
[0037]
[0038] wherein, is the vertical continuity index of the pixel point . is the local directional energy of the neighbor point along the preset scratch direction and at a distance of . is the length of the one-direction search of the vertical neighborhood. is the maximum energy value in the directional energy map, used for normalization.
[0039] In this optional embodiment, may be set according to the typical length of the scratch. For example, it can be set as 10 pixels. It is worth mentioning that, since when 0 represents that all the energy in the directional energy map is 0, which has no analysis significance, the case where 0 is no longer considered in this application.
[0040] For example, assuming that the maximum energy value in the directional energy map is 250, 10, for a pixel point A on the scratch, its own local directional energy is 220, and the average energy of its 20 vertical neighbor pixel points is also high, which is 210, so the directional continuity index is , which is a high value close to 1; while for a pixel point B on the defect edge, its own local directional energy is 220, but the average energy of its vertical neighbors rapidly decays to 40, so the directional continuity index is , which is a value much smaller than 1.
[0041] Further, after the calculation for all pixel points, a vertical continuity index map can be obtained, as shown in Figure 4 . In this map, the long scratch area will appear as a bright band, while the defect edge and isolated noise points are very dark.
[0042] In this way, by calculating the directional continuity index, the scratch and the defect edge can be effectively separated in numerical value, which provides a key calculation basis for the subsequent steps.
[0043] S103, based on the directional continuity index, a spatially adaptive scratch similarity is constructed for each pixel point, wherein the higher the directional continuity index of a pixel point, the greater the scratch similarity value corresponding to the pixel point.
[0044] In one embodiment, the area with high value of the direction continuity index can be mapped to high scratch similarity, and the area with low value of the direction continuity index can be mapped to low scratch similarity. In this scheme, a Sigmoid function can be used to realize this smooth nonlinear mapping, and the scratch similarity satisfies the following relationship:
[0045]
[0046] wherein, is the scratch similarity of the pixel point , and the value range is (0, 1); is a gain coefficient, which is used to control the steepness of the Sigmoid function, and in this application, the value is 10; is a preset threshold value for distinguishing scratch and non-scratch features, and in this application, the value is 0.5.
[0047] For example, for the pixel point A on the scratch, the scratch similarity is , and for the pixel point B on the defect edge, the scratch similarity is .
[0048] Further, after performing the calculation on all the pixel points, a scratch similarity map can be obtained, as shown in Figure 5 In this map, only the area determined as the long-range continuous scratch is bright, and the similarity is high, while the defects and other background areas are dark, and the similarity is low.
[0049] In this way, an accurate and spatially intelligent varying filtering reference map can be constructed, which clearly identifies the similarity degree of each position in the image to the background scratch.
[0050] S104, based on the scratch similarity, performing spatially adaptive anisotropic filtering processing on the circuit board metallographic slice image to selectively smooth the background scratch and reserve the defect features, so as to realize the defect detection of the circuit board metallographic slice image.
[0051] In one embodiment, a spatially variable anisotropic Gaussian filter can be used to realize the spatially adaptive anisotropic filtering processing. The core of this filter is that the shape of the filter kernel will be adaptively changed according to the scratch similarity of each pixel point, specifically:
[0052] The standard deviation of the filter in the direction perpendicular to the scratch direction (i.e. the horizontal direction) is fixed to a very small value, for example, , to ensure that no blur is generated in this direction, thereby protecting the horizontal edge of the defect; and the standard deviation of the filter in the scratch direction (i.e. the vertical direction) Designed as a variable dynamically controlled by scratch similarity. The standard deviation of the anisotropic Gaussian filter in the preset scratch direction Satisfies the relationship:
[0053]
[0054] in, is the standard deviation corresponding to the maximum blur level of the filter, which can be set to 15 for example; is the standard deviation corresponding to the minimum blur level of the filter, and can be set to 1 for example.
[0055] For example, for pixel A on the scratch, the standard deviation in the vertical direction is At this time, the Gaussian kernel is greatly stretched in the vertical direction to form an elongated ellipse, and a strong vertical smoothing is performed on the point, thereby effectively blurring the vertical scratch. For the pixel point B on the edge of the defect, its standard deviation in the vertical direction is .at this time and The Gaussian kernel is very close to a standard circular kernel, and its smoothing effect is very weak, so the edge details of the defect are completely preserved.
[0056] like Figure 6 As shown, it is a schematic diagram of an image obtained after adaptive anisotropic filtering according to an embodiment of the present application. It can be seen that the vertical scratches in the background of the original image are basically completely eliminated, while the outline and internal texture of the defect remain relatively intact.
[0057] Furthermore, after performing spatially adaptive anisotropic filtering, an image segmentation algorithm, such as the Otsu adaptive thresholding method, can be applied to the filtered image to extract and output a binary mask of the defect area. Segmentation yields a binary mask of the defect, which accurately identifies the defect's location, size, and morphology. This mask can be directly used for detection tasks such as defect area calculation, morphological analysis, and hazard level assessment, thereby enabling accurate defect detection in metallographic section images of circuit boards.
[0058] In this way, through spatially adaptive anisotropic filtering processing, strong smoothing can be applied to the identified scratch area along the scratch direction, thereby eliminating background scratch noise, while maximally retaining the edge details and morphological integrity of real defects with the same direction as the scratch, so that the background of the filtered image is clean and the defects are prominent, thereby greatly improving the accuracy and stability of subsequent defect extraction using standard segmentation algorithms.
[0059] It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A method of detecting defects in a metallographic slice image of a circuit board, characterized by, The method comprises: Collecting a circuit board metallographic section image containing background scratch noise, calculating local directional energy of each pixel point in the circuit board metallographic section image in a preset scratch direction, and generating a directional energy map; the calculation method of the local directional energy is: a group of Gabor filters with multiple directions are set to perform convolution processing on the circuit board metallographic section image to obtain the energy response of the image in each direction, and the energy response corresponding to the preset scratch direction is taken as the directional energy map; Based on the directional energy map, the directional continuity index of each pixel point is calculated by analyzing the neighborhood energy distribution of each pixel point in the preset scratch direction, and the directional continuity index is used to represent the degree of long-range continuous scratch of the pixel point; the directional continuity index satisfies the relationship: wherein, is a direction continuity index of the pixel point ; is a local direction energy of the neighbor point along the preset scratch direction and at a distance of ; is a length of the neighbor one-way search; is a maximum energy value in the direction energy map, used for normalization; Based on the directional continuity index, a spatially adaptive scratch similarity is constructed for each pixel point, wherein the higher the directional continuity index of a pixel point, the greater the corresponding scratch similarity value; Based on the scratch similarity, spatially adaptive anisotropic filtering processing is performed on the circuit board metallographic section image to selectively smooth the background scratch and retain the defect features, thereby realizing defect detection of the circuit board metallographic section image.
2. The method of claim 1, wherein the method further comprises: Based on the directional continuity index, the scratch similarity is generated through a Sigmoid function, and the scratch similarity satisfies the relationship: wherein, is the scratch similarity of the pixel point ; is the gain coefficient for controlling the steepness of the Sigmoid function; is the preset threshold for distinguishing the scratch and non-scratch features.
3. The method for detecting defects in metallographic slice images of a circuit board according to claim 1, wherein: The spatially adaptive anisotropic filtering processing is realized by using an anisotropic Gaussian filter.
4. The method of claim 3, wherein the method further comprises: The standard deviation of the filter kernel of the anisotropic Gaussian filter in a direction perpendicular to the preset scratch direction is a fixed value, and the standard deviation in the preset scratch direction is dynamically controlled by the scratch similarity.
5. The method of claim 4, wherein the method further comprises: a standard deviation of the anisotropic Gaussian filter in the preset scratch direction satisfies the relationship: wherein, is the standard deviation corresponding to the maximum blur degree of the filter; is the standard deviation corresponding to the minimum blur degree of the filter.
6. The method of claim 1, wherein the method further comprises: The method further comprises: After performing the spatially adaptive anisotropic filtering processing, an image segmentation algorithm is applied to the filtered image to extract and output a binary mask of the defect region.
Citation Information
Patent Citations
Method for detecting surface scratch of chassis containing complicated information
CN108961248A
Semiconductor surface defect detection method
CN115020267A