Weak contrast workpiece micro-defect multi-scale detection and process root cause tracing method

CN122905965APending Publication Date: 2026-10-13TAIZHOU KEJUXINAN DIGITAL INTELLIGENCE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611038465.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-13
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

这导致真实缺陷易被误判为噪声,多尺度增强时出现内部空心化、边缘断裂,最终引发缺陷特征提取畸变,生产工序根因溯源严重偏差

Benefits of technology

[0024]与现有技术相比,本发明所达到的有益效果是:本发明在常规方向一致性检测之外,同步计算各尺度下的局部线状度指标,当检测到细尺度呈高线状度而粗尺度突变为低线状度时,标记为形态反转候选区域,再通过验证细尺度中心线骨架在粗尺度对比度图上是否仍保持高响应占比,以此筛除伪缺陷、保留拓扑连续的真实缺陷;解决了同一缺陷因尺度间形态各向异性反转而被误判为噪声的问题;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122905965A_ABST
    Figure CN122905965A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of industrial vision detection and precision manufacturing quality control. Specifically, it is a weak contrast workpiece micro-defect multi-scale detection and process root cause tracing method. The method first collects workpiece surface reflection image sequences with consistent spatial positions at different illumination azimuth angles, performs multi-scale decomposition on each image to obtain low-frequency approximation images representing global illumination background and high-frequency detail images corresponding to different spatial scales; then calculates initial defect confidence maps and linearity maps of each scale, detects morphologically inverted candidate regions, determines defect regions that need to be compensated, generates a mask, and finally extracts a defect feature vector. The present application can effectively identify and compensate for scale conflicts caused by morphological inversion of cross-scale defects, and on the basis of robustly enhancing and completely extracting morphologically inverted real defects, accurately trace the root cause of the production process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial visual inspection and precision manufacturing quality control technology, specifically a method for multi-scale detection of micro-defects in low-contrast workpieces and for tracing the root causes of defects in processes. Background Technology

[0002] With the rapid development of high-end equipment industries such as aerospace, automobile manufacturing, and electronic information, the surface processing precision requirements for precision metal workpieces have reached the micrometer or even sub-micrometer level. Micro-defects such as microcracks, microscratches, and micro-pits can seriously affect the mechanical properties and service life of workpieces. Therefore, achieving automated, high-precision detection of micro-defects on workpiece surfaces is a key aspect of ensuring product quality. Traditional manual visual inspection suffers from low efficiency and strong subjectivity. While machine vision-based inspection technology has been widely applied, the increasing surface finish of workpieces means that weak-contrast micro-defects become comparable in intensity to background noise signals, significantly increasing the difficulty of detection.

[0003] Some linear micro-defects exhibit cross-scale morphological inversion, meaning that at a fine scale they appear as clear linear structures with high directional consistency, but at a coarse scale, due to internal oxidation accumulation, interference from fine branches, and the downsampling averaging effect, they become spherical clusters with significantly reduced directional consistency. This leads to real defects being easily misjudged as noise, and during multi-scale enhancement, internal hollowing and edge breakage occur, ultimately causing distortion in defect feature extraction and serious deviations in root cause tracing of production processes.

[0004] Among existing patents, CN116721066B employs a dual-branch feature fusion network combined with photometric stereo imaging, but its fusion strategy does not adjust the high-frequency gain for cross-scale morphological differences; CN121685517A determines defects through multi-scale anomaly point evolution maps, but relies on acquiring costly and low-precision depth maps, and fails to detect morphological inversion issues. In summary, existing technologies are insufficient to meet the stringent requirements of precision manufacturing for the detection and root cause analysis of low-contrast micro-defects. Summary of the Invention

[0005] The purpose of this invention is to provide a multi-scale detection method for micro-defects in low-contrast workpieces and a method for tracing the root causes of processes. This method can effectively identify and compensate for inter-scale conflicts caused by morphological inversion of cross-scale defects. At the same time, it can achieve accurate tracing of the root causes of production processes based on robust enhancement and complete extraction of true defects with morphological inversion, thereby solving the problems mentioned in the background art.

[0006] To address the aforementioned technical problems, this invention provides the following technical solution: a multi-scale detection method for micro-defects in low-contrast workpieces and a method for tracing the root causes of defects in processes. Under multiple preset different lighting azimuth angles, the reflection images of the workpiece surface under test are collected respectively, and a multi-lighting angle image sequence with consistent spatial position is obtained, so that the same weak defect presents different local brightness and darkness changes in different lighting directions. For each image in the illumination angle image sequence, a low-frequency approximate image representing the global illumination background and a high-frequency detail image carrying edge and texture information corresponding to different spatial scales are generated using a multi-scale decomposition method. The high-resolution scale is denoted as the fine scale and the low-resolution scale is denoted as the coarse scale. For each scale of normalized high-frequency detail image, a neighborhood window of a preset size is slid pixel by pixel, and two types of calculations are performed in parallel within the same window: The first type calculates the gradient magnitude and gradient direction, constructs a local orientation histogram, calculates the orientation consistency index and local root mean square contrast, multiplies the two and normalizes them to obtain the initial defect confidence map of the corresponding scale; The second type calculates the structure tensor and performs eigenvalue decomposition to obtain the local linearity index, forms the linearity map corresponding to the scale, and marks the difference in linearity between the fine scale and the coarse scale as morphological inversion candidate points. For the candidate region formed by the spatially connected morphological inversion candidate points, thresholding and skeletonization are performed in the initial defect confidence map at the finest scale to extract the center line point set of the linear structure; based on the proportion of pixels with contrast values ​​higher than the preset threshold in the center line point set, it is determined whether the candidate region is a defect region that needs to be compensated, and finally a mask map of the defect region that needs to be compensated is generated. The initial defect confidence maps at each scale are interpolated to the original image size to obtain the full-resolution initial defect confidence map. In non-compensating defect areas, the maximum value of the full-resolution initial defect confidence value at each scale is taken pixel by pixel as the fusion confidence value. In the defect areas that need compensation, the coarse-scale full-resolution initial defect confidence value is replaced with the full-resolution initial defect confidence value of the corresponding pixel at the finest scale, and then the maximum value of each scale is taken as the fusion confidence value. Based on the fusion confidence values ​​of all pixels, a multi-scale defect fusion confidence map is generated. The pixel-by-pixel replacement is not performed in the original coarse-scale low-frequency sampling domain, but is performed after the initial defect confidence maps at all scales have been resampled to the full resolution of the original image through bilinear interpolation. In this full-resolution space, the coarse-scale confidence map and the fine-scale confidence map have the same pixel coordinate system, and a strict pixel-by-pixel spatial correspondence is established between them. An adaptive enhancement weight map matching the spatial size of high-frequency detail images at each scale is generated using a multi-scale defect fusion confidence map. The high-frequency detail images at each scale are weighted pixel by pixel and then superimposed with the enhanced low-frequency approximation image to reconstruct the fused enhanced image. The fused and enhanced image is subjected to threshold segmentation and connected component filtering. The geometric shape features of the defect region and its reflectance variation features in the multi-illumination angle image sequence are calculated to form a defect feature vector.

[0007] Furthermore, the specific methods for generating a low-frequency approximate image representing the global illumination background and high-frequency detail images corresponding to different spatial scales are as follows: Each reflection image in the obtained multi-illumination angle image sequence is input into a two-dimensional discrete wavelet decomposition module. A three-level two-dimensional discrete wavelet transform is performed on the original image, where the input image is denoted as I(x,y), where x represents the horizontal pixel coordinate and y represents the vertical pixel coordinate. Low-pass and high-pass filters are convolved along the row and column directions respectively, and a 2x downsampling is performed after each level of decomposition to obtain the low-frequency approximate subband, horizontal high-frequency subband, vertical high-frequency subband, and diagonal high-frequency subband for that level. The three directional high-frequency subbands of each level are then used to construct a unified high-frequency detail image according to an energy synthesis method, calculated using the following formula: Among them, H s (x, y) represents the high-frequency detail image at the s-th scale, H h,s (x, y) represents the horizontal high-frequency subband coefficient, Hv ,s (x, y) represents the vertical high-frequency subband coefficient, H d,s (x, y) represents the diagonal high-frequency subband coefficients, which are used to uniformly map textures in different directions to local texture intensities. Simultaneously, the low-frequency approximate subband obtained from the last level of decomposition is used as the global illumination background image and denoted as L(x, y). Furthermore, amplitude normalization is performed on the high-frequency detail images at each scale, calculated using the following formula: ,in, H represents the normalized high-frequency detail image. s,min H represents the minimum pixel value in a high-frequency image at this scale. s,max This represents the maximum pixel value in a high-frequency image at that scale. This formula is used to unify the dynamic range of high-frequency coefficients at different scales.

[0008] Furthermore, the specific methods for performing the two types of calculations to obtain the initial defect confidence maps at the corresponding scales are as follows: For high-frequency detail images at each scale, a neighborhood window of a preset size slides across the image. Within each window, the gradient magnitude and gradient direction are calculated, and a local orientation histogram is constructed. From the histogram, the main orientation energy representing the main structural direction within the window and the clutter energy representing the other directions are extracted. The ratio of the main orientation energy to the clutter energy is used as the orientation consistency index. Simultaneously, the local root mean square contrast within the window is calculated. The orientation consistency index is multiplied by the local root mean square contrast and normalized to obtain the initial defect confidence value of the center pixel of the window at that scale, forming the initial defect confidence map for the corresponding scale.

[0009] Constructing a local orientation histogram includes: inputting the normalized high-frequency detail image into a sliding window analysis module and calculating the histogram pixel by pixel using a local neighborhood window of size m×m; and calculating the horizontal gradient G within each window using the Sobel operator. x With vertical gradient G y And calculate the gradient magnitude according to the formula. Where M(x,y) represents the gradient intensity of a pixel, this formula is used to characterize the intensity of local texture edge changes; then, the gradient direction is calculated according to the formula θ(x,y)=arctan[Gy(x,y) / Gx(x,y)], where θ(x,y) represents the local gradient direction angle; a direction histogram is established according to the preset angle interval, and the cumulative gradient energy in each direction interval is counted. The direction interval with the largest cumulative energy is recorded as the main direction, and its energy is recorded as E. p The total energy in the remaining directional intervals is denoted as E. r Through the formula: C d =E p / (E r +ε), calculate the directional consistency index, C d The formula represents the directional consistency index, where ε represents a stabilizing term to prevent the denominator from being zero. This formula is used to characterize the degree of local texture direction clustering. Simultaneously, the local root mean square contrast C is calculated according to the formula within the same window. c ={(1 / N)∑N n=1[(p n -p ’ ) 2 ]} 1 / 2 C c This represents the local root mean square contrast, where N represents the total number of pixels in the window, and p n p represents the grayscale value of the nth pixel within the window. ’ This represents the average grayscale value of the window, and the formula is used to characterize the degree of local brightness fluctuation; according to the formula S(x,y)=(C d ×C c ) / [max(C d ×C c The initial defect confidence value at the center of the window is calculated.

[0010] Furthermore, the specific method for performing two types of calculations to obtain linearity maps at corresponding scales, and marking them as morphological inversion candidate points based on the difference in linearity between the fine and coarse scales, is as follows: A local structure tensor matrix is ​​constructed in the same window. Eigenvalue decomposition is performed on the structure tensor matrix to obtain two eigenvalues, λ1 and λ2, where λ1 ≥ λ2. The ratio of λ1 and λ2 to the sum of the stability terms is used as a local linearity index to form a linearity map corresponding to this scale. Then, the linearity values ​​of the same pixel location at different scales are combined into a linearity scale change sequence according to the scale order. When it is detected that the linearity of a certain fine scale is higher than the first preset threshold and the linearity of a certain coarse scale is lower than the second preset threshold in the linearity scale change sequence, the pixel is marked as a morphological inversion candidate point.

[0011] The specific methods for calculating the structure tensor include: converting the horizontal gradient G... x With vertical gradient G y Input into the structure tensor construction module, and within each sliding window, according to the formula... Construct a local structure tensor matrix, where each term in the matrix is ​​the accumulated value of the corresponding gradient term within a window. This structure tensor is used to describe the local texture direction distribution. Perform eigenvalue decomposition on the structure tensor matrix to obtain larger eigenvalues. With smaller eigenvalues Among them, satisfying ; Then calculate the local linearity index according to the formula.

[0012] in, This represents the linearity value of the pixel position at the current scale. This represents the stabilizing term, and the formula describes the degree of directional stretching of the local structure. When the defect is in the form of a slender crack, the gradient in the principal direction is much greater than the gradient in the vertical direction, thus increasing the linearity value. Subsequently, the linearity values ​​of the same pixel location at different scales are arranged in scale order to form a linearity scale variation sequence, and then the formula is applied. Calculate the difference in linearity between the fine and coarse scales, where, This represents the finest linearity value. This represents the coarsest-scale linearity value, and the formula is used to characterize the degree of topological change in local structures during scale variations; when When the value exceeds the preset shape inversion threshold, the corresponding pixel is marked as a shape inversion candidate point.

[0013] When constructing the structure tensor, within each sliding window, it is calculated according to the formula... Construct a second-order matrix, and These represent the horizontal and vertical gradients obtained from the high-frequency detail image at this scale using the Sobel operator, respectively. Each term in the matrix is ​​the accumulated value of the corresponding gradient term within the window range. This matrix is ​​used to describe the local texture direction distribution.

[0014] Furthermore, the specific method for determining whether the candidate region is a defect region requiring compensation is as follows: For the candidate regions formed by spatially connected morphological inversion candidate points, thresholding and skeletonization are performed on the candidate regions in the initial defect confidence map at the finest scale to extract the set of linear structure centerline points composed of pixels with high initial defect confidence values; at the same time, local root mean square contrast is calculated in the high-frequency detail image at the coarse scale using a neighborhood window to form a coarse-scale contrast map. Mapping the centerline point set of the linear structure to a coarse-scale contrast map, and then calculating the proportion of pixels with contrast values ​​higher than a third preset threshold out of the total number of points in the centerline point set, is based on the formula... Calculate the proportion of high contrast, where... This indicates the proportion of high contrast along the center line. This indicates the number of pixels with a contrast value higher than the third preset threshold at the center line point. This formula represents the total number of pixels in the centerline point set and is used to evaluate the degree of continuity preservation of linear structures at a coarse scale. If the ratio exceeds the preset ratio threshold, it means that the region still retains continuous texture response at the coarse scale, and the corresponding candidate region is determined to be a defect region that needs to be compensated. Otherwise, it means that the region lacks stable structural support after scale expansion, and is determined to be a pseudo-defect region.

[0015] The specific methods for thresholding and skeletonizing candidate regions include: inputting the binary map of morphologically inverted candidate points into an eight-neighbor connected component labeling module, performing region clustering on spatially continuous candidate points to generate multiple candidate regions; subsequently, inputting the initial defect confidence map at the finest scale into a region filtering module, and applying a formula to each candidate region... Perform thresholding, where, Indicates the binary results for the region. This represents the initial defect confidence value. The confidence threshold is represented by the formula used to extract high-confidence defect regions. Subsequently, iterative refinement and skeletonization processing is performed on the binary region to obtain the centerline point set of the linear structure, and the coordinates of the centerline point set are mapped to a coarse-scale contrast map.

[0016] Furthermore, based on the fusion confidence values ​​of all pixels, the specific method for generating a multi-scale defect fusion confidence map is as follows: The initial defect confidence maps at each scale are input into the bilinear interpolation module, and spatial resampling is performed according to the original image size to obtain the full-resolution initial defect confidence maps corresponding to each scale. The mask image of the defect region to be compensated is read, and cross-scale confidence replacement processing is performed on the pixels within the mask region. The coarse-scale confidence value after replacement is based on the formula... It is confirmed that, among them, This represents the coarse-scale confidence value after the replacement. This represents the initial defect confidence value at full resolution for the pixel corresponding to the finest scale. This formula is used to avoid voids inside defects caused by coarse-scale diffusion. In areas where no compensation is needed, the original coarse-scale confidence value remains unchanged. Subsequently, according to the formula... Calculate the fusion confidence value, where, This represents the final fusion confidence value. Represents the entire scale set. Indicates the first The initial defect confidence value at full resolution is calculated using a formula to retain the most significant defect response at each scale; finally, a multi-scale defect fusion confidence map is generated from the fusion confidence values ​​of all pixels.

[0017] Furthermore, the specific method for reconstructing and fusing the enhanced image is as follows: The multi-scale defect fusion confidence map is scaled according to the actual size of the high-frequency detail images at each scale to generate an adaptive enhancement weight map that matches the spatial size of the high-frequency detail images at each scale. The high-frequency detail images at the corresponding scale are then weighted pixel by pixel using the adaptive enhancement weight map at each scale. In defect areas with high confidence values, the high-frequency coefficients are increased to enhance the defect contour and internal filling, while the high-frequency coefficients are attenuated in background areas with low confidence values ​​to suppress noise. The weighted high-frequency detail images at each scale are then superimposed with the low-frequency approximation image enhanced by homomorphic filtering to reconstruct a fusion enhancement image with a complete defect region, continuous contour, and uniform background.

[0018] The multi-scale defect fusion confidence map is input into the scale mapping module, which generates an adaptive enhancement weight map for the corresponding scale based on the size of the high-frequency detail images at each scale, and then applies the formula... Calculate the enhancement weights, where, Indicates the first Scale enhancement weights, Indicates the enhancement gain coefficient. This represents the fusion confidence value at the corresponding scale. This formula is used to adjust the high-frequency enhancement intensity based on the defect confidence level; subsequently, according to the formula... Pixel-wise weighting is applied to high-frequency detail images, where... This represents the enhanced high-frequency detail image. This represents the original high-frequency detail image, and the formula is used to enhance defect edges and internal textures; then, the low-frequency approximate image is input into the homomorphic filtering module, according to the formula... Background equalization processing is performed, where, Indicates Fourier transform, Indicates the inverse Fourier transform. This represents the high-pass filter function, which is used to reduce the effects of uneven lighting. The fused and enhanced image is then reconstructed according to the formula.

[0019] in, Indicates fused and enhanced image, This represents the total number of scales. This formula is used to achieve joint reconstruction of defect enhancement and background suppression.

[0020] Furthermore, the specific method for constructing the defect feature vector is as follows: The fused and enhanced image is subjected to threshold segmentation and connected component filtering to extract the location and contour of the defect region. The geometric features of the defect region and its reflectance variation features in the multi-illumination angle image sequence are calculated to form a defect feature vector. The defect feature vector is matched with a pre-built production process fault feature library to output the production process node with the highest similarity to the defect feature vector and the corresponding process parameter deviation range, thus completing the root cause tracing.

[0021] The fused and enhanced image is used to perform global threshold segmentation and area filtering to extract the contour of the defect region. A defect feature vector is constructed based on the defect area, aspect ratio, edge curvature, and average reflectivity change rate under different lighting angles. This defect feature vector is then input into the production process fault feature database matching module, and the feature distance is calculated according to the formula.

[0023] in, Indicates the defect to be tested and the first Euclidean distance between fault characteristics of similar processes Indicates the defect to be tested. dimensional features, This represents the feature value of the corresponding dimension in the fault feature library. This formula is used to measure the similarity between the defect and the historical process anomaly pattern; the final output is the production process node with the smallest distance and its process parameter deviation range.

[0024] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: In addition to conventional directional consistency detection, the present invention simultaneously calculates the local linearity index at each scale. When a high linearity is detected at the fine scale and a sudden drop to low linearity at the coarse scale, it is marked as a morphological inversion candidate region. Then, by verifying whether the centerline skeleton of the fine scale still maintains a high response ratio on the coarse scale contrast map, false defects are eliminated and real defects with topological continuity are retained. This solves the problem that the same defect is misjudged as noise due to morphological anisotropy inversion between scales. This invention replaces the low-confidence values ​​at the coarse scale with the high-confidence values ​​at the corresponding locations at the fine scale for true defect regions identified as having morphological inversion, and then performs multi-scale maximum value fusion. This compensation mechanism eliminates the distortion of the fused confidence map caused by the decay of coarse-scale directional consistency, ensuring that the defect remains internally intact and has a continuous contour in the enhanced image. This invention adaptively adjusts the high-frequency enhancement intensity at each scale using a compensated fused confidence map, amplifying high frequencies in the defect region and suppressing noise in the background region to reconstruct a significantly enhanced image of the defect. Then, it extracts the defect's geometric and reflection features for matching with a process fault feature library, outputting the responsible process node. This process ensures that morphological inversion defects are fully revealed during the enhancement stage, avoiding feature distortion and tracing errors caused by insufficient enhancement. Attached Figure Description

[0025] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of the technical solution of a method for multi-scale detection of micro-defects in low-contrast workpieces and for tracing the root causes of processes according to the present invention. Figure 2 This is a flowchart of the multi-scale decomposition and normalization process of a multi-scale detection method for micro-defects in low-contrast workpieces and a method for tracing the root causes of processes, according to the present invention. Figure 3 This is a flowchart of the method for multi-scale detection of micro-defects in low-contrast workpieces and root cause tracing of processes, based on the present invention, showing the directional consistency and initial defect confidence value calculation. Figure 4 This is a block diagram of the morphological inversion detection and topological continuity determination method of a multi-scale detection method for micro-defects in low-contrast workpieces and a process root cause tracing method of the present invention. Figure 5 This is a cross-scale fusion, enhanced reconstruction, and root cause tracing block diagram of a multi-scale detection and process root cause tracing method for micro-defects in low-contrast workpieces according to the present invention. Detailed Implementation

[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0027] Please see Figure 1-5 This invention provides a technical solution: a method for multi-scale detection of micro-defects in low-contrast workpieces and for tracing the root causes of defects in processes. Under multiple preset different lighting azimuth angles, the reflection images of the workpiece surface under test are collected respectively, and a multi-lighting angle image sequence with consistent spatial position is obtained, so that the same weak defect presents different local brightness and darkness changes in different lighting directions. For each image in the illumination angle image sequence, a low-frequency approximate image representing the global illumination background and a high-frequency detail image carrying edge and texture information corresponding to different spatial scales are generated using a multi-scale decomposition method. The high-resolution scale is denoted as the fine scale and the low-resolution scale is denoted as the coarse scale. For each scale of normalized high-frequency detail image, a neighborhood window of a preset size is slid pixel by pixel, and two types of calculations are performed in parallel within the same window: The first type calculates the gradient magnitude and gradient direction, constructs a local orientation histogram, calculates the orientation consistency index and local root mean square contrast, multiplies the two and normalizes them to obtain the initial defect confidence map of the corresponding scale; The second type calculates the structure tensor and performs eigenvalue decomposition to obtain the local linearity index, forms the linearity map corresponding to the scale, and marks the difference in linearity between the fine scale and the coarse scale as morphological inversion candidate points. For the candidate region formed by the spatially connected morphological inversion candidate points, thresholding and skeletonization are performed in the initial defect confidence map at the finest scale to extract the center line point set of the linear structure; based on the proportion of pixels with contrast values ​​higher than the preset threshold in the center line point set, it is determined whether the candidate region is a defect region that needs to be compensated, and finally a mask map of the defect region that needs to be compensated is generated. The initial defect confidence maps at each scale are interpolated to the original image size to obtain the full-resolution initial defect confidence map. In non-compensating defect areas, the maximum value of the full-resolution initial defect confidence value at each scale is taken pixel by pixel as the fusion confidence value. In the defect areas that need compensation, the coarse-scale full-resolution initial defect confidence value is replaced with the full-resolution initial defect confidence value of the corresponding pixel at the finest scale, and then the maximum value of each scale is taken as the fusion confidence value. Based on the fusion confidence values ​​of all pixels, a multi-scale defect fusion confidence map is generated. The pixel-by-pixel replacement is not performed in the original coarse-scale low-frequency sampling domain, but is performed after the initial defect confidence maps at all scales have been resampled to the full resolution of the original image through bilinear interpolation. In this full-resolution space, the coarse-scale confidence map and the fine-scale confidence map have the same pixel coordinate system, and a strict pixel-by-pixel spatial correspondence is established between them. An adaptive enhancement weight map matching the spatial size of high-frequency detail images at each scale is generated using a multi-scale defect fusion confidence map. The high-frequency detail images at each scale are weighted pixel by pixel and then superimposed with the enhanced low-frequency approximation image to reconstruct the fused enhanced image. The fused and enhanced image is subjected to threshold segmentation and connected component filtering. The geometric shape features of the defect region and its reflectance variation features in the multi-illumination angle image sequence are calculated to form a defect feature vector.

[0028] Furthermore, the specific methods for generating a low-frequency approximate image representing the global illumination background and high-frequency detail images corresponding to different spatial scales are as follows: Each reflection image in the obtained multi-illumination angle image sequence is input into a two-dimensional discrete wavelet decomposition module. A three-level two-dimensional discrete wavelet transform is performed on the original image, where the input image is denoted as I(x,y), where x represents the horizontal pixel coordinate and y represents the vertical pixel coordinate. Low-pass and high-pass filters are convolved along the row and column directions respectively, and a 2x downsampling is performed after each level of decomposition to obtain the low-frequency approximate subband, horizontal high-frequency subband, vertical high-frequency subband, and diagonal high-frequency subband for that level. The three directional high-frequency subbands of each level are then used to construct a unified high-frequency detail image according to an energy synthesis method, calculated using the following formula: , where H s (x, y) represents the high-frequency detail image at the s-th scale, H h,s (x, y) represents the horizontal high-frequency subband coefficient, Hv ,s (x, y) represents the vertical high-frequency subband coefficient, H d,s (x, y) represents the diagonal high-frequency subband coefficients, which are used to uniformly map textures in different directions to local texture intensities. Simultaneously, the low-frequency approximate subband obtained from the last level of decomposition is used as the global illumination background image and denoted as L(x, y). Furthermore, amplitude normalization is performed on the high-frequency detail images at each scale, calculated using the following formula: ,in, H represents the normalized high-frequency detail image. s,min H represents the minimum pixel value in a high-frequency image at this scale. s,max This represents the maximum pixel value in a high-frequency image at that scale. This formula is used to unify the dynamic range of high-frequency coefficients at different scales.

[0029] Furthermore, the specific methods for performing the two types of calculations to obtain the initial defect confidence maps at the corresponding scales are as follows: For high-frequency detail images at each scale, a neighborhood window of a preset size slides across the image. Within each window, the gradient magnitude and gradient direction are calculated, and a local orientation histogram is constructed. From the histogram, the main orientation energy representing the main structural direction within the window and the clutter energy representing the other directions are extracted. The ratio of the main orientation energy to the clutter energy is used as the orientation consistency index. Simultaneously, the local root mean square contrast within the window is calculated. The orientation consistency index is multiplied by the local root mean square contrast and normalized to obtain the initial defect confidence value of the center pixel of the window at that scale, forming the initial defect confidence map for the corresponding scale.

[0030] Constructing a local orientation histogram includes: inputting the normalized high-frequency detail image into a sliding window analysis module and calculating the histogram pixel by pixel using a local neighborhood window of size m×m; and calculating the horizontal gradient G within each window using the Sobel operator. x With vertical gradient G y And calculate the gradient magnitude according to the formula. Where M(x,y) represents the gradient intensity of a pixel, this formula is used to characterize the intensity of local texture edge changes; then, the gradient direction is calculated according to the formula θ(x,y)=arctan[Gy(x,y) / Gx(x,y)], where θ(x,y) represents the local gradient direction angle; a direction histogram is established according to the preset angle interval, and the cumulative gradient energy in each direction interval is counted. The direction interval with the largest cumulative energy is recorded as the main direction, and its energy is recorded as E. p The total energy in the remaining directional intervals is denoted as E. r Through the formula: C d =E p / (E r +ε), calculate the directional consistency index, C d The formula represents the directional consistency index, where ε represents a stabilizing term to prevent the denominator from being zero. This formula is used to characterize the degree of local texture direction clustering. Simultaneously, the local root mean square contrast C is calculated according to the formula within the same window. c ={(1 / N) C c This represents the local root mean square contrast, where N represents the total number of pixels in the window, and p n p represents the grayscale value of the nth pixel within the window. ’ This represents the average grayscale value of the window, and the formula is used to characterize the degree of local brightness fluctuation; according to the formula S(x,y)=(C d ×C c ) / [max(C d ×C c The initial defect confidence value at the center of the window is calculated.

[0031] Furthermore, the specific method for performing two types of calculations to obtain linearity maps at corresponding scales, and marking them as morphological inversion candidate points based on the difference in linearity between the fine and coarse scales, is as follows: A local structure tensor matrix is ​​constructed in the same window. Eigenvalue decomposition is performed on the structure tensor matrix to obtain two eigenvalues, λ1 and λ2, where λ1 ≥ λ2. The ratio of λ1 and λ2 to the sum of the stability terms is used as a local linearity index to form a linearity map corresponding to this scale. Then, the linearity values ​​of the same pixel location at different scales are combined into a linearity scale change sequence according to the scale order. When it is detected that the linearity of a certain fine scale is higher than the first preset threshold and the linearity of a certain coarse scale is lower than the second preset threshold in the linearity scale change sequence, the pixel is marked as a morphological inversion candidate point.

[0032] The specific methods for calculating the structure tensor include: converting the horizontal gradient G... x With vertical gradient G y Input into the structure tensor construction module, and within each sliding window, according to the formula... Construct a local structure tensor matrix, where each term in the matrix is ​​the accumulated value of the corresponding gradient term within a window. This structure tensor is used to describe the local texture direction distribution. Perform eigenvalue decomposition on the structure tensor matrix to obtain larger eigenvalues. With smaller eigenvalues Among them, satisfying ; Then calculate the local linearity index according to the formula.

[0033] in, This represents the linearity value of the pixel position at the current scale. This represents the stabilizing term, and the formula describes the degree of directional stretching of the local structure. When the defect is in the form of a slender crack, the gradient in the principal direction is much greater than the gradient in the vertical direction, thus increasing the linearity value. Subsequently, the linearity values ​​of the same pixel location at different scales are arranged in scale order to form a linearity scale variation sequence, and then the formula is applied. Calculate the difference in linearity between the fine and coarse scales, where, This represents the finest linearity value. This represents the coarsest-scale linearity value, and the formula is used to characterize the degree of topological change in local structures during scale variations; when When the value exceeds a preset shape inversion threshold, the corresponding pixel is marked as a shape inversion candidate point. Specifically, during the construction of the structure tensor, within each sliding window, the formula is used... Construct a second-order matrix, and These represent the horizontal and vertical gradients obtained from the high-frequency detail image at this scale using the Sobel operator, respectively. Each term in the matrix is ​​the accumulated value of the corresponding gradient term within the window range. This matrix is ​​used to describe the local texture direction distribution.

[0034] Furthermore, the specific method for determining whether the candidate region is a defect region requiring compensation is as follows: For the candidate regions formed by spatially connected morphological inversion candidate points, thresholding and skeletonization are performed on the candidate regions in the initial defect confidence map at the finest scale to extract the set of linear structure centerline points composed of pixels with high initial defect confidence values; at the same time, local root mean square contrast is calculated in the high-frequency detail image at the coarse scale using a neighborhood window to form a coarse-scale contrast map. Mapping the centerline point set of the linear structure to a coarse-scale contrast map, and then calculating the proportion of pixels with contrast values ​​higher than a third preset threshold out of the total number of points in the centerline point set, is based on the formula... Calculate the proportion of high contrast, where... This indicates the proportion of high contrast along the center line. This indicates the number of pixels with a contrast value higher than the third preset threshold at the center line point. This formula represents the total number of pixels in the centerline point set and is used to evaluate the degree of continuity preservation of linear structures at a coarse scale. If the ratio exceeds the preset ratio threshold, it means that the region still retains continuous texture response at the coarse scale, and the corresponding candidate region is determined to be a defect region that needs to be compensated. Otherwise, it means that the region lacks stable structural support after scale expansion, and is determined to be a pseudo-defect region.

[0035] The specific methods for thresholding and skeletonizing candidate regions include: inputting the binary map of morphologically inverted candidate points into an eight-neighbor connected component labeling module, performing region clustering on spatially continuous candidate points to generate multiple candidate regions; subsequently, inputting the initial defect confidence map at the finest scale into a region filtering module, and applying a formula to each candidate region... Perform thresholding, where, Indicates the binary results for the region. This represents the initial defect confidence value. The confidence threshold is represented by the formula used to extract high-confidence defect regions. Subsequently, iterative refinement and skeletonization processing is performed on the binary region to obtain the centerline point set of the linear structure, and the coordinates of the centerline point set are mapped to a coarse-scale contrast map.

[0036] Furthermore, based on the fusion confidence values ​​of all pixels, the specific method for generating a multi-scale defect fusion confidence map is as follows: The initial defect confidence maps at each scale are input into the bilinear interpolation module, and spatial resampling is performed according to the original image size to obtain the full-resolution initial defect confidence maps corresponding to each scale. The mask image of the defect region to be compensated is read, and cross-scale confidence replacement processing is performed on the pixels within the mask region. The coarse-scale confidence value after replacement is based on the formula... It is confirmed that, among them, This represents the coarse-scale confidence value after the replacement. This represents the initial defect confidence value at full resolution for the pixel corresponding to the finest scale. This formula is used to avoid voids inside defects caused by coarse-scale diffusion. In areas where no compensation is needed, the original coarse-scale confidence value remains unchanged. Subsequently, according to the formula... Calculate the fusion confidence value, where, This represents the final fusion confidence value. Represents the entire scale set. Indicates the first The initial defect confidence value at full resolution is calculated using a formula to retain the most significant defect response at each scale; finally, a multi-scale defect fusion confidence map is generated from the fusion confidence values ​​of all pixels.

[0037] Furthermore, the specific method for reconstructing and fusing the enhanced image is as follows: The multi-scale defect fusion confidence map is scaled according to the actual size of the high-frequency detail images at each scale to generate an adaptive enhancement weight map that matches the spatial size of the high-frequency detail images at each scale. The high-frequency detail images at the corresponding scale are then weighted pixel by pixel using the adaptive enhancement weight map at each scale. In defect areas with high confidence values, the high-frequency coefficients are increased to enhance the defect contour and internal filling, while the high-frequency coefficients are attenuated in background areas with low confidence values ​​to suppress noise. The weighted high-frequency detail images at each scale are then superimposed with the low-frequency approximation image enhanced by homomorphic filtering to reconstruct a fusion enhancement image with a complete defect region, continuous contour, and uniform background.

[0038] The multi-scale defect fusion confidence map is input into the scale mapping module, which generates an adaptive enhancement weight map for the corresponding scale based on the size of the high-frequency detail images at each scale, and then applies the formula... Calculate the enhancement weights, where, Indicates the first Scale enhancement weights, Indicates the enhancement gain coefficient. This represents the fusion confidence value at the corresponding scale. This formula is used to adjust the high-frequency enhancement intensity based on the defect confidence level; subsequently, according to the formula... Pixel-wise weighting is applied to high-frequency detail images, where... This represents the enhanced high-frequency detail image. This represents the original high-frequency detail image, and the formula is used to enhance defect edges and internal textures; then, the low-frequency approximate image is input into the homomorphic filtering module, according to the formula... Background equalization processing is performed, where, Indicates Fourier transform, Indicates the inverse Fourier transform. This represents the high-pass filter function, which is used to reduce the effects of uneven lighting. The fused and enhanced image is then reconstructed according to the formula.

[0039] in, Indicates fused and enhanced image, This represents the total number of scales. This formula is used to achieve joint reconstruction of defect enhancement and background suppression.

[0040] Furthermore, the specific method for constructing the defect feature vector is as follows: The fused and enhanced image is subjected to threshold segmentation and connected component filtering to extract the location and contour of the defect region. The geometric features of the defect region and its reflectance variation features in a multi-illumination angle image sequence are calculated to form a defect feature vector. This defect feature vector is then matched with a pre-built production process fault feature library to output the production process node with the highest similarity to the defect feature vector and the corresponding process parameter deviation range, thus completing root cause tracing. Further, the specific method for constructing the defect feature vector is as follows: The fused and enhanced image is subjected to threshold segmentation and connected component filtering to extract the location and contour of the defect region. The geometric features of the defect region and its reflectance variation features in the multi-illumination angle image sequence are calculated to form a defect feature vector. The defect feature vector is matched with a pre-built production process fault feature library to output the production process node with the highest similarity to the defect feature vector and the corresponding process parameter deviation range, thus completing the root cause tracing.

[0041] The fused and enhanced image is used to perform global threshold segmentation and area filtering to extract the contour of the defect region. A defect feature vector is constructed based on the defect area, aspect ratio, edge curvature, and average reflectivity change rate under different lighting angles. This defect feature vector is then input into the production process fault feature database matching module, and the feature distance is calculated according to the formula.

[0042] in, Indicates the defect to be tested and the first Euclidean distance between fault characteristics of similar processes Indicates the defect to be tested. dimensional features, This represents the feature value of the corresponding dimension in the fault feature library. This formula is used to measure the similarity between defects and historical process anomaly patterns; the final output is the production process node with the smallest distance and its process parameter deviation range. It should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0043] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for multi-scale detection of micro-defects in low-contrast workpieces and for tracing the root causes of defects in processes, characterized in that: Reflection images of the workpiece surface under different illumination azimuth angles were acquired to obtain a sequence of illumination angle images with consistent spatial position. For each image in the illumination angle image sequence, a low-frequency approximate image representing the global illumination background and a high-frequency detail image corresponding to different spatial scales are generated using a multi-scale decomposition method. The high-resolution scale is denoted as the fine scale, and the low-resolution scale is denoted as the coarse scale. For each high-frequency detail image at each scale, two types of calculations are performed to obtain the initial defect confidence map and linearity map of the corresponding scale, and the linearity difference between the fine scale and the coarse scale is marked as a morphological inversion candidate point; for the candidate region formed by the spatially connected morphological inversion candidate points, the set of linear structure centerline points is extracted from the initial defect confidence map at the finest scale. Based on the proportion of pixels with a contrast value higher than a preset threshold at the center line point, it is determined whether the candidate region is a defect region that needs to be compensated, and finally a mask map of the defect region that needs to be compensated is generated. The initial defect confidence maps at each scale are interpolated to the original image size to obtain the full-resolution initial defect confidence map; based on the fusion confidence values ​​of all pixels in the non-compensated defect region and the compensated defect region, a multi-scale defect fusion confidence map is generated. An adaptive enhancement weight map matching the spatial size of high-frequency detail images at each scale is generated using a multi-scale defect fusion confidence map. The high-frequency detail images at each scale are weighted pixel by pixel and then superimposed with the enhanced low-frequency approximation image to reconstruct the fused enhanced image. The fused and enhanced image is subjected to threshold segmentation and connected component filtering to form a defect feature vector.

2. The method for multi-scale detection and process root cause tracing of micro-defects in low-contrast workpieces according to claim 1, characterized in that: The specific method for generating a low-frequency approximate image representing the global illumination background and high-frequency detail images corresponding to different spatial scales is as follows: Each reflection image in the illumination angle image sequence is input into a two-dimensional discrete wavelet decomposition module, and a three-level two-dimensional discrete wavelet transform is performed on the original image. Low-pass and high-pass filters are convolved along the row and column directions, respectively, and downsampling is performed after each level of decomposition to obtain the low-frequency approximate subband, horizontal high-frequency subband, vertical high-frequency subband, and diagonal high-frequency subband of that level. The three high-frequency subbands of each level are used to construct a unified high-frequency detail image according to the energy synthesis method, and amplitude normalization is performed on the high-frequency detail image at each scale.

3. The method for multi-scale detection and process root cause tracing of micro-defects in low-contrast workpieces according to claim 2, characterized in that: The specific method for performing two types of calculations to obtain the initial defect confidence map at the corresponding scale is as follows: For high-frequency detail images at each scale, a neighborhood window of a preset size slides across the image. Within each window, the gradient magnitude and gradient direction are calculated, and a local orientation histogram is constructed. From the histogram, the main orientation energy representing the main structural direction within the window and the clutter energy representing the other directions are extracted. The ratio of the main orientation energy to the clutter energy is used as the orientation consistency index. Simultaneously, the local root mean square contrast within the window is calculated. The orientation consistency index is multiplied by the local root mean square contrast and normalized to obtain the initial defect confidence value of the center pixel of the window at that scale, forming the initial defect confidence map for the corresponding scale.

4. The method for multi-scale detection and process root cause tracing of micro-defects in low-contrast workpieces according to claim 3, characterized in that: The specific method for performing two types of calculations to obtain linearity maps at corresponding scales, and marking them as morphological inversion candidate points based on the difference in linearity between the fine and coarse scales, is as follows: A local structure tensor matrix is ​​constructed in the same window. Eigenvalue decomposition is performed on the structure tensor matrix to obtain two eigenvalues, λ1 and λ2, where λ1 ≥ λ2. The ratio of λ1 and λ2 to the sum of the stability terms is used as a local linearity index to form a linearity map corresponding to this scale. Then, the linearity values ​​of the same pixel location at different scales are combined into a linearity scale change sequence according to the scale order. When it is detected that the linearity of a certain fine scale is higher than the first preset threshold and the linearity of a certain coarse scale is lower than the second preset threshold in the linearity scale change sequence, the pixel is marked as a morphological inversion candidate point.

5. The method for multi-scale detection and process root cause tracing of micro-defects in low-contrast workpieces according to claim 4, characterized in that: The specific method for determining whether a candidate region is a defect region requiring compensation is as follows: For the candidate regions formed by spatially connected morphological inversion candidate points, thresholding and skeletonization are performed on the candidate regions in the initial defect confidence map at the finest scale to extract the set of linear structure centerline points composed of pixels with high initial defect confidence values; at the same time, local root mean square contrast is calculated in the high-frequency detail image at the coarse scale using a neighborhood window to form a coarse-scale contrast map. The centerline point set of the linear structure is mapped to a coarse-scale contrast map. The proportion of pixels with contrast values ​​higher than the third preset threshold is counted to the total number of points in the centerline point set. If the proportion exceeds the preset proportion threshold, the corresponding candidate region is determined to be a defect region that needs compensation; otherwise, it is determined to be a pseudo-defect region.

6. The method for multi-scale detection and process root cause tracing of micro-defects in low-contrast workpieces according to claim 5, characterized in that: The specific method for generating a multi-scale defect fusion confidence map based on the fusion confidence values ​​of all pixels in both the non-compensation defect region and the compensation defect region is as follows: The initial defect confidence maps at each scale are input into the bilinear interpolation module, and spatial resampling is performed according to the original image size to obtain the full-resolution initial defect confidence maps corresponding to each scale; the mask map of the defect area to be compensated is read, and cross-scale confidence replacement processing is performed on the pixels within the mask area; in the defect area that does not need to be compensated, the original coarse-scale confidence value remains unchanged. According to the formula Calculate the fusion confidence value, where, This represents the final fusion confidence value. Represents the entire scale set. Indicates the first The initial defect confidence value at full resolution is calculated, where x represents the horizontal pixel coordinate and y represents the vertical pixel coordinate; finally, a multi-scale defect fusion confidence map is generated from the fusion confidence values ​​of all pixels.

7. The method for multi-scale detection and process root cause tracing of micro-defects in low-contrast workpieces according to claim 6, characterized in that: The specific method for reconstructing and fusing the enhanced image is as follows: The multi-scale defect fusion confidence map is scaled according to the actual size of the high-frequency detail images at each scale to generate an adaptive enhancement weight map that matches the spatial size of the high-frequency detail images at each scale. The high-frequency detail images at the corresponding scale are then weighted pixel by pixel using the adaptive enhancement weight map at each scale. In defect areas with high confidence values, the high-frequency coefficients are increased to enhance the defect contour and internal filling, while the high-frequency coefficients are attenuated in background areas with low confidence values ​​to suppress noise. The weighted high-frequency detail images at each scale are then superimposed with the low-frequency approximation image enhanced by homomorphic filtering to reconstruct a fusion enhancement image with a complete defect region, continuous contour, and uniform background.

8. The method for multi-scale detection and process root cause tracing of micro-defects in low-contrast workpieces according to claim 7, characterized in that: The specific method for constructing the defect feature vector is as follows: The fused and enhanced image is subjected to threshold segmentation and connected component filtering to extract the location and contour of the defect region, and the geometric features of the defect region and its reflectance change features in the multi-illumination angle image sequence are calculated to form a defect feature vector. The defect feature vector is matched with a pre-built production process fault feature library, and the production process node with the highest similarity to the defect feature vector and the corresponding process parameter deviation range are output to complete the root cause tracing.

9. A computer device, characterized in that: It includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The device stores a computer program that, when executed by a processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • A metal surface defect detection method, device and storage medium

    CN116721066B

  • Chip surface defect area judgment method in combination with depth map abnormal point aggregation degree

    CN121685517A