Wavelet transform-based self-adaptive copper foil defect rapid detection method
The pyramid is constructed through wavelet transformation, the low-frequency and diagonal energy maps of copper foil surface defects are extracted, and the difference and weight maps are calculated, which solves the accuracy and speed problems of surface defect detection of multi-special copper foil, and achieves fast and accurate online detection.
Patent Information
- Application Number
- CN202510500724.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-08-01
AI Technical Summary
The prior art is difficult to detect defects on the surface of copper foils of various specifications at the same time, especially in the case of background changes or uneven lighting, traditional methods are prone to missed detection, and the calculation is complex and slow, making it difficult to use for online detection.
A three-layer pyramid was constructed using wavelet transformation, low-frequency and diagonal detail energy maps were extracted, the difference and weight maps were calculated, and the segmentation threshold was calculated based on the mean and variance, and the binarization was performed to extract the copper foil defect area.
It realizes fast and accurate defect detection under different specifications and lighting conditions. It is suitable for online inspection, with fast processing speed, strong applicability, and a detection accuracy of 89.6%.
Smart Images

Figure CN120411023A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a computer vision image processing method, and more particularly to a fast adaptive copper foil defect detection method using wavelet transform. Background Art
[0002] With the rapid development of the industrial field, the demand for copper foil and the quality requirements are also getting higher and higher. The traditional method of manually detecting defects on the copper foil surface not only affects the production speed but also easily misses small defects. In recent years, with the gradual improvement of computer vision in the industrial field, image algorithms are gradually replacing manual labor as the main means of detecting copper foil surface defects.
[0003] Computer vision in copper foil detection is mainly divided into two types:
[0004] Defect detection methods based on deep learning. The common method is to manually calibrate images with defects, train through a neural network, and use the trained weights to process the images to obtain defects. This technology can accurately detect obvious and larger-sized defects. However, in order to improve the training and detection speed, the image needs to be compressed before being processed by the neural network, resulting in the easy loss of small defects after compression. If the compression ratio is reduced, it will lead to too long processing time or the need to stack graphics cards, resulting in a large increase in costs.
[0005] Defect detection methods using traditional image algorithms. The common method is to obtain defects by the difference from the background or using template matching. The method of obtaining defects by difference can detect defects well when the background is uniform, but it is difficult to extract defects when the background changes significantly, especially when the defects are similar to the background. The same is true for template matching. Due to the uneven illumination and the randomness of the copper foil surface material, the normal image is still likely to have a large difference from the template, resulting in a large number of false defect detections.
[0006] Most importantly, the imaging of copper foil varies greatly under different specifications, and it is difficult for both deep learning and traditional algorithms to handle copper foil defect detection under multiple specifications at the same time. Existing methods have problems such as limited types of detected surface defects, complex calculation methods, slow speed, difficulty in being used for online detection, or relying on complex hardware imaging technologies with high costs. Therefore, a new copper foil defect detection method is needed. Summary of the Invention
[0007] In order to solve the problem of difficult detection of copper foil defects under multiple specifications, the purpose of the present invention is to provide a fast adaptive copper foil defect detection method using wavelet transform. Compared with the background art, the recognition method is simple, and it can quickly and accurately detect defects such as bumps and black dots, and is suitable for online detection occasions.
[0008] The technical solution adopted by the present invention is:
[0009] A rapid detection method for copper foil defects is as follows:
[0010] S1. Take a photo of the copper foil surface and perform grayscale processing to obtain a grayscale image of the copper foil;
[0011] S2. Use the haar wavelet transform to construct a three - layer pyramid for the grayscale image of the copper foil, and then extract features from each layer of the pyramid to obtain their respective normalized energy maps;
[0012] S3. Perform differential operations on the normalized energy maps of adjacent layers of the pyramid to obtain difference maps. A total of two difference maps are obtained, and then weight calculations are performed on each difference map to obtain their respective weight maps;
[0013] S4. Jointly process the normalized energy maps and weight maps of all layers of the pyramid to obtain an image to be segmented, and then perform binarization processing on the image to be segmented to obtain a binary image;
[0014] S5. Extract the connected regions in the binary image, and filter the connected regions according to a preset connected region threshold to obtain the copper foil defect region.
[0015] Specifically, S2 is as follows:
[0016] S2.1. Use the haar wavelet transform to construct a three - layer pyramid for the grayscale image of the copper foil, and extract the low - frequency image and diagonal detail image from each layer of the pyramid respectively according to the following formula;
[0017]
[0018] In the formula, S(x, y) and P(x, y) represent the gray values of the pixel points in the x - th row and y - th column of the low - frequency image and the diagonal detail image respectively, l(i) represents the low - frequency filter coefficient, h(j) is the high - frequency filter coefficient, L l and L h represent the lengths of the low - frequency filter and the high - frequency filter respectively, mod represents the remainder operation, M and N represent the width and height of the image respectively, R(x, y) represents the gray value of the pixel point in the x - th row and y - th column of the grayscale image of the copper foil, f l and f h represent the coefficient matrices of the low - frequency filter and the high - frequency filter respectively;
[0019] S2.2. Perform feature extraction on the low - frequency image and diagonal detail image of each layer respectively to obtain the low - frequency energy map and diagonal detail energy map, and then perform normalization processing to obtain the normalized energy map.
[0020] In S2.2, the low - frequency energy map and diagonal detail energy map are processed according to the following formula:
[0021] F S(x, y) = S(x, y) 2
[0022] F P (x, y) = P(x, y) 2
[0023] Wherein, F S (x, y) and F P (x, y) respectively represent the gray values of the pixel points at the x-th row and y-th column in the energy maps of the low-frequency image and the diagonal detail image, and S(x, y) and P(x, y) respectively represent the gray values of the pixel points at the x-th row and y-th column in the low-frequency image and the diagonal detail image.
[0024] The normalized energy map in S2.2 is obtained by processing according to the following formula:
[0025]
[0026] Wherein, E(x, y) represents the gray value of the pixel point at the x-th row and y-th column in the normalized energy map, F S (x, y) and F P (x, y) respectively represent the gray values of the pixel points at the x-th row and y-th column in the energy maps of the low-frequency image and the diagonal detail image.
[0027] The difference map in S3 is obtained by processing according to the following formula:
[0028]
[0029] Wherein, D t (x, y) represents the gray value of the pixel point at the x-th row and y-th column in the difference map of the t-th layer, E t (x, y) represents the gray value of the pixel point at the x-th row and y-th column in the normalized energy map of the t-th layer, W represents the window size, and k represents the window radius.
[0030] The weight map in S3 is obtained by processing according to the following formula:
[0031]
[0032] Wherein, W t (x, y) represents the gray value of the pixel point at the x-th row and y-th column in the weight map of the t-th layer, D t (x, y) represents the gray value of the pixel point at the x-th row and y-th column in the difference map of the t-th layer, and e represents the natural logarithm base.
[0033] The image to be segmented in S4 is obtained by processing according to the following formula:
[0034] G(x,y) = E1(x,y) + E2(x,y) * W1(x,y) + E3(x,y) * W2(x,y)
[0035] Wherein, G(x,y) represents the gray value of the pixel at the x-th row and y-th column in the image to be segmented, E1(x,y), E2(x,y), and E3(x,y) respectively represent the gray values of the pixels at the x-th row and y-th column in the normalized energy maps of the first layer, the second layer, and the third layer, W1(x,y) and W2(x,y) respectively represent the gray values of the pixels at the x-th row and y-th column in the weight maps of the first layer and the second layer, and * represents convolution.
[0036] The binary processing in S4 is specifically as follows:
[0037] 1) Calculate the mean and standard deviation of the pixel gray values in the image to be segmented according to the following formula:
[0038]
[0039]
[0040] Wherein, μ represents the mean of the pixel gray values in the image to be segmented, G(x,y) represents the gray value of the pixel at the x-th row and y-th column in the image to be segmented, m and n respectively represent the width and height of the image to be segmented, and σ represents the standard deviation of the pixel gray values in the image to be segmented;
[0041] 2) Calculate the segmentation threshold according to the mean and standard deviation of the pixel gray values in the image to be segmented according to the following formula, and then perform binary operation on the gray value of each pixel in the image to be segmented according to the segmentation threshold respectively to generate a binary image:
[0042] q = μ + kσ
[0043] Wherein, q represents the segmentation threshold, μ represents the mean of the pixel gray values in the image to be segmented, σ represents the standard deviation of the pixel gray values in the image to be segmented, and k represents a preset weight coefficient.
[0044] The beneficial effects of the present invention are:
[0045] In view of the large number of copper foil specifications and significant imaging differences, the present invention constructs a three-layer pyramid through Haar wavelet transform, calculates the low-frequency part and the diagonal detail energy map, and normalizes the diagonal energy map using the low-frequency energy map. It calculates the difference between the energy maps of adjacent layers, calculates the weight map of adjacent layers based on the difference, processes the three-layer energy map and the weight map together and sums them, and calculates the segmentation threshold according to the mean and variance of the result map, finally obtaining the defect image. The present invention uses the joint processing of the energy map and the weight map to alleviate the problem of light influence on image defect detection during shooting. The method is simple, can be applied to images of different specifications, is conducive to engineering implementation, has a fast processing speed, and has high application value in copper foil defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 is a flowchart of the method of the present invention.
[0047] Figure 2 is the original image in Embodiment 1 of the present invention.
[0048] Figure 3 is the first-layer low-frequency part after Haar wavelet transform of the original image.
[0049] Figure 4 is the first-layer horizontal detail after Haar wavelet transform of the original image.
[0050] Figure 5 is the first-layer vertical detail after Haar wavelet transform of the original image.
[0051] Figure 6 is the first-layer diagonal detail after Haar wavelet transform of the original image.
[0052] Figure 7 is the first-layer diagonal detail energy map after Haar wavelet transform of the original image.
[0053] Figure 8 is the second-layer diagonal detail weight map.
[0054] Figure 9 is the image to be segmented after joint processing of the three-layer energy map and the weight map.
[0055] Figure 10 is Figure 2 the defect detection result map of
[0056] Figure 11 is the original image with fingerprint defects of a darker specification.
[0057] Figure 12 is Figure 11 the defect detection result map of
[0058] Figure 13 is the original image with foil leakage defects of a darker specification.
[0059] Figure 14 is Figure 13 the defect detection result diagram of
[0060] Figure 15 is the original image of a brighter steamed roll with fingerprint defects.
[0061] Figure 16 is Figure 15 the defect detection result diagram of
[0062] Figure 17 is the original image of a darker specification with indentation defects.
[0063] Figure 18 is Figure 17 the defect detection result diagram of Specific Embodiments
[0064] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0065] A rapid copper foil defect detection method is as Figure 1 shown, including the following steps:
[0066] S1. As Figure 2 shown, photograph the copper foil surface and perform grayscale processing to obtain the copper foil grayscale image R(x, y);
[0067] S2. Apply Haar wavelet transform to the copper foil grayscale image to construct a three-layer pyramid, and then extract features from each layer of the pyramid to obtain the normalized energy map Ei(x, y) of each layer of the pyramid;
[0068] The construction of the three-layer pyramid is to perform three Haar wavelet transform decompositions on the copper foil grayscale image.
[0069] S2.1. As Figures 3 - 6 shown, apply Haar wavelet transform to the copper foil grayscale image to construct a three-layer pyramid, and extract the low-frequency image and diagonal detail image of each layer respectively according to the following formula;
[0070]
[0071] In the formula, S(x, y) and P(x, y) respectively represent the gray values of the pixel points in the x-th row and y-th column of the low-frequency image and the diagonal detail image, and H(x, y) and V(x, y) respectively represent the gray values of the pixel points in the x-th row and y-th column of the horizontal detail image and the vertical detail image. l(i) represents the low-frequency filter coefficient, h(j) is the high-frequency filter coefficient, L l and Lh respectively represent the lengths of the low - frequency filter and the high - frequency filter, mod represents the modulo operation, M and N respectively represent the width and height of the image, R(x, y) represents the gray value of the pixel at the x - th row and y - th column of the copper - foil gray - scale image, and f l and f h respectively represent the coefficient matrices of the low - frequency filter and the high - frequency filter;
[0072] S2.2. Feature extraction is respectively performed on the low - frequency image and the diagonal - detail image of each layer to obtain the low - frequency energy map and the diagonal - detail energy map as Figure 7 shown, and then normalization processing is performed to obtain the normalized energy map.
[0073] The low - frequency energy map and the diagonal - detail energy map are obtained by the following formula:
[0074] F S (x, y) = S(x, y) 2
[0075] F P (x, y) = P(x, y) 2
[0076] In the formula, F S (x, y) and F P (x, y) respectively represent the gray values of the pixels at the x - th row and y - th column in the energy maps of the low - frequency image and the diagonal - detail image, and S(x, y) and P(x, y) respectively represent the gray values of the pixels at the x - th row and y - th column in the low - frequency image and the diagonal - detail image.
[0077] The normalized energy map is obtained by the following formula:
[0078]
[0079] In the formula, E(x, y) represents the gray value of the pixel at the x - th row and y - th column in the normalized energy map, F S (x, y) and F P (x, y) respectively represent the gray values of the pixels at the x - th row and y - th column in the energy maps of the low - frequency image and the diagonal - detail image.
[0080] S3. The difference operation is performed on the normalized energy maps of adjacent - layer pyramids to obtain difference maps. A total of two difference maps D1(x, y) and D2(x, y) are obtained, and then the weight calculation is respectively performed on each difference map to obtain the respective weight maps W1(x, y) and W2(x, y) of each difference map, as Figure 8 shown;
[0081] The difference map is obtained by the following formula:
[0082]
[0083] Wherein, D t (x, y) represents the gray value of the pixel at the x-th row and y-th column in the difference map of the t-th layer, E t (x, y) represents the gray value of the pixel at the x-th row and y-th column in the normalized energy map of the t-th layer of the pyramid, W represents the window size, k represents the window radius, and t can take values of 1 and 2.
[0084] The weight map is obtained by processing according to the following formula:
[0085]
[0086] Wherein, W t (x, y) represents the gray value of the pixel at the x-th row and y-th column in the weight map of the t-th layer, D t (x, y) represents the gray value of the pixel at the x-th row and y-th column in the difference map of the t-th layer, and e represents the natural base.
[0087] That is, calculate the energy for each point in the low-frequency part and diagonal part of each layer of the pyramid, and construct the corresponding energy map. Divide the diagonal energy map of each layer by the low-frequency energy map to obtain the normalized diagonal difference energy map of each layer. Adjust the three-layer energy maps to the same size, and find the difference between the energy maps of adjacent layers to obtain two-layer difference maps.
[0088] S4. Jointly process the normalized energy maps and weight maps of all layers of the pyramid to obtain the image to be segmented G(x, y), as Figure 9 shown, and then perform binarization processing on the image to be segmented to obtain the binary image B(x, y);
[0089] The image to be segmented is obtained by processing according to the following formula:
[0090] G(x, y) = E1(x, y) + E2(x, y) * W1(x, y) + E3(x, y) * W2(x, y)
[0091] Wherein, G(x, y) represents the gray value of the pixel at the x-th row and y-th column in the image to be segmented, E1(x, y), E2(x, y), and E3(x, y) respectively represent the gray values of the pixels at the x-th row and y-th column in the normalized energy maps of the first layer, second layer, and third layer of the pyramid, W1(x, y) and W2(x, y) respectively represent the gray values of the pixels at the x-th row and y-th column in the weight maps of the first layer and second layer, and * represents convolution
[0092] The binarization processing is specifically as follows:
[0093] 1) Calculate the mean and standard deviation of the pixel gray values in the image to be segmented according to the following formula:
[0094]
[0095] Wherein, μ represents the mean of the pixel gray values in the image to be segmented, G(x, y) represents the gray value of the pixel at the x-th row and y-th column in the image to be segmented, m and n respectively represent the width and height of the image to be segmented, and σ represents the standard deviation of the pixel gray values in the image to be segmented;
[0096] 2) Calculate the segmentation threshold according to the mean and standard deviation of the pixel gray values in the image to be segmented according to the following formula, and then perform binaryzation operations on the gray values of each pixel point in the image to be segmented respectively according to the segmentation threshold to generate a binary image:
[0097] q = μ + kσ
[0098] Wherein, q represents the segmentation threshold, μ represents the mean of the pixel gray values in the image to be segmented, σ represents the standard deviation of the pixel gray values in the image to be segmented, and k represents a preset weight coefficient.
[0099]
[0100] Wherein, B(x, y) is the gray value of the pixel at the x-th row and y-th column in the binary image, G(x, y) represents the gray value of the pixel at the x-th row and y-th column in the image to be segmented, and q represents the segmentation threshold.
[0101] S5. Extract the connected regions in the binary image, and filter the connected regions in the binary image according to a preset connected region threshold to obtain the copper foil defect region.
[0102] Specifically, that is, traverse all the connected regions in the binary image, filter out non-compliant contours according to a preset size, and finally retain the connected regions as the copper foil defect regions. The preset connected region threshold is the preset size. Subsequently, obtain all the connected regions in the image B(x, y), and filter out fine impurities according to the actual defect size, and finally obtain the defects, as Figure 10 shown.
[0103] Figures 10 - 18 For detecting images of different defect types under different lighting conditions. Figure 11 and Figure 12 are respectively the original image with a fingerprint defect of a darker specification and the defect detection result image, Figure 13 and Figure 14 are respectively the original image with a foil leakage defect of a darker specification and the defect detection result image, Figure 15 and Figure 16 are respectively the original image with a fingerprint defect of a brighter specification and the defect detection result image, Figure 17 and Figure 18They are respectively the original image with a dark specification and a pit defect and the defect detection result image.
[0104] After being implemented multiple times by the embodiments, the accuracy rate of the method of the present invention reaches 89.6%.
[0105] As can be seen from the comparison between the original images and the detection result images of the above various embodiments, the present invention can accurately locate various types of defects on the surfaces of copper foils of different specifications. In addition, the image processing speed is fast. On a desktop computer with an i7-12700 processor as the CPU, the detection time of a copper foil grayscale image with a size of 8192×6000 per frame is not more than 130 ms. If there are no a large number of defects, the time can be controlled within 105 ms, which has great application value in the detection of copper foil surface defects.
[0106] The above specific embodiments are used to explain and illustrate the present invention, rather than to limit the present invention. Any modifications and changes made to the present invention within the spirit and scope of the claims of the present invention fall within the protection scope of the present invention.
Claims
1. An adaptive fast detection method for copper foil defects based on wavelet transform, characterized in that The method includes the following steps: S1. Take a picture of the copper foil surface and perform grayscale processing to obtain a grayscale image of the copper foil; S2. Use Haar wavelet transform on the grayscale image of the copper foil to construct a three-layer pyramid, and then extract features from each layer of the pyramid to obtain their respective normalized energy maps; S3. Perform differential operations on the normalized energy maps of adjacent layers of the pyramid to obtain difference maps. A total of two difference maps are obtained, and then weight calculations are performed on each difference map to obtain their respective weight maps; S4. Jointly process the normalized energy maps and weight maps of all layers of the pyramid to obtain the image to be segmented, and then perform binarization processing on the image to be segmented to obtain a binary image; S5. Extract the connected regions in the binary image, and filter the connected regions according to a preset connected region threshold to obtain the copper foil defect region.
2. The adaptive rapid copper foil defect detection method based on wavelet transform according to claim 1, characterized in that: The specific content of S2 is as follows: S2.
1. Use Haar wavelet transform on the grayscale image of the copper foil to construct a three-layer pyramid, and extract the low-frequency image and diagonal detail image from each layer of the pyramid respectively according to the following formula; Wherein, S(x, y) and P(x, y) respectively represent the gray values of the pixel points at the x-th row and y-th column in the low-frequency image and the diagonal detail image, l(i) represents the low-frequency filter coefficient, h(j) is the high-frequency filter coefficient, L l and L h respectively represent the lengths of the low-frequency filter and the high-frequency filter, mod represents the modulo operation, M and N respectively represent the width and height of the image, R(x, y) represents the gray value of the pixel point at the x-th row and y-th column in the copper foil gray image, f l and f h respectively represent the coefficient matrices of the low-frequency filter and the high-frequency filter; S2.
2. Perform feature extraction on the low-frequency image and diagonal detail image of each layer respectively to obtain the low-frequency energy map and diagonal detail energy map, and then perform normalization processing to obtain the normalized energy map.
3. An adaptive rapid detection method for copper foil defects by wavelet transform according to claim 1, characterized in that: The low-frequency energy map and diagonal detail energy map in S2.2 are processed according to the following formula: F S (x,y) = S(x,y) 2 F P (x,y) = P(x,y) 2 where F S (x, y) and F P (x, y) represent the gray values of the pixel points in the x-th row and y-th column of the energy maps of the low-frequency image and the diagonal detail image respectively, and S(x, y) and P(x, y) represent the gray values of the pixel points in the x-th row and y-th column of the low-frequency image and the diagonal detail image respectively.
4. The adaptive rapid copper foil defect detection method using wavelet transform according to claim 1, characterized in that: The normalized energy map in S2.2 is processed according to the following formula: where E(x, y) represents the gray value of the pixel at the x-th row and y-th column in the normalized energy map, and F S (x, y) and F P (x, y) represent the gray values of the pixels at the x-th row and y-th column in the energy maps of the low-frequency image and the diagonal detail image, respectively.
5. The adaptive copper foil defect rapid detection method by wavelet transform according to claim 1, wherein: The difference map in S3 is processed according to the following formula: where D t (x, y) represents the gray value of the pixel at the x-th row and y-th column in the t-th layer difference map, and E t (x, y) represents the gray value of the pixel at the x-th row and y-th column in the t-th layer normalized energy map, W represents the window size, and k represents the window radius.
6. The adaptive copper foil defect rapid detection method based on wavelet transform according to claim 1, characterized in that: The weight map in S3 is processed according to the following formula: where, W t (x, y) represents the gray value of the pixel at the x-th row and y-th column in the weight map of the t-th layer, D t (x, y) represents the gray value of the pixel at the x-th row and y-th column in the difference map of the t-th layer, and e represents the natural base number.
7. An adaptive rapid defect detection method for copper foil based on wavelet transform according to claim 1, characterized in that: The image to be segmented in S4 is processed according to the following formula: G(x,y) = E1(x,y) + E2(x,y) * W1(x,y) + E3(x,y) * W2(x,y) In the formula, G(x,y) represents the grayscale value of the pixel at the x-th row and y-th column in the image to be segmented, E1(x,y), E2(x,y), and E3(x,y) respectively represent the grayscale values of the pixels at the x-th row and y-th column in the normalized energy maps of the first layer, the second layer, and the third layer, W1(x,y) and W2(x,y) respectively represent the grayscale values of the pixels at the x-th row and y-th column in the weight maps of the first layer and the second layer, and * represents convolution.
8. An adaptive rapid defect detection method for copper foil by wavelet transform according to claim 1, characterized in that: The specific binarization processing in S4 is as follows: 1) Calculate the mean and standard deviation of the pixel grayscale values in the image to be segmented according to the following formula: In the formula, μ represents the mean of the pixel grayscale values in the image to be segmented, G(x,y) represents the grayscale value of the pixel at the x-th row and y-th column in the image to be segmented, m and n respectively represent the width and height of the image to be segmented, and σ represents the standard deviation of the pixel grayscale values in the image to be segmented; 2) Calculate the segmentation threshold according to the mean and standard deviation of the pixel grayscale values in the image to be segmented according to the following formula, and then perform binarization operations on the grayscale values of each pixel in the image to be segmented according to the segmentation threshold to generate a binary image: q = μ + kσ In the formula, q represents the segmentation threshold, μ represents the mean of the pixel grayscale values in the image to be segmented, σ represents the standard deviation of the pixel grayscale values in the image to be segmented, and k represents a preset weight coefficient.
Citation Information
Cited By
Copper foil defect detection system
CN121481923A
