Wallpaper surface defect detection method

By acquiring images under standard illumination and performing Gamma correction and reflection compensation, combining multi-scale texture decomposition and adaptive threshold segmentation, the defect detection problem of complex texture areas is solved, efficient identification of small defects and light adaptability detection is achieved, and the error detection rate is reduced.

CN120407826AInactive Publication Date: 2025-08-01ZHEJIANG FANGWEI DECORATION MATERIALS CO LTD

Patent Information

Application Number
CN202510912059.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-03
Publication Date
2025-08-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional wallpaper defect detection methods are difficult to distinguish between real defects and decorative patterns in complex texture areas. The detection sensitivity of small defects is insufficient, and changes in lighting conditions affect the detection accuracy. The existing systems lack effective background modeling and dynamic update mechanisms.

Method used

The linear array camera was used to acquire images under standard illumination, and the RGB and LAB color spaces were separated through Gamma correction and reflection compensation. The background texture was decomposed using Daubechies8 wavelet fundamentally, combined with dual-channel Ostu segmentation and morphological filtering, dynamically updated the background model, and defect area identification was performed.

Benefits of technology

Effectively distinguish decorative patterns from real defects, improve the sensitivity of detection of micro defects, adapt to light changes, reduce error detection rates, and be suitable for high-speed production inspection in complex industrial environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407826A_ABST
    Figure CN120407826A_ABST
Patent Text Reader

Abstract

The invention relates to a wallpaper surface defect detection method, which comprises the following steps of: acquiring a wallpaper surface image by using a line-scan digital camera, correcting the image, establishing an average background model, and performing reflection compensation based on the average background model; s200, the image after reflection compensation is separated into R, G and B color channels, a gray level co-occurrence matrix (GLCM) of each channel is calculated to extract contrast features, the dynamic weight of each sub-block is calculated, a weighted RGB image is obtained, then the RGB image is converted into an LAB color space, an L channel is extracted, and # imgabs0 # is obtained; fusing the weighted RGB image and the L channel; carrying out three-layer decomposition by using a Daubechies8 wavelet basis, and carrying out reconstruction to obtain a background image; and carrying out dual-channel Ostu segmentation on the defect candidate image, carrying out decision fusion after segmenting the two channels, and carrying out noise removal and non-defect region filtering to obtain a defect region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of industrial machine vision technology, and specifically relates to a wallpaper surface defect detection method and system based on multi-scale texture decomposition and adaptive threshold segmentation, which is particularly suitable for wallpaper surface defect detection with complex texture background. Background Art

[0002] Wallpaper is an important material for modern interior decoration, and its surface quality directly affects the value of the product. Traditional wallpaper defect detection mainly faces the following technical difficulties: First, the complex decorative patterns of wallpaper will cause serious texture interference, especially in curved texture areas. Traditional algorithms have difficulty distinguishing between real defects and decorative patterns, resulting in a high false detection rate. Secondly, for small defects such as cracks and pinholes, the detection sensitivity is insufficient under complex background patterns, and existing methods have difficulty in achieving effective identification. Furthermore, changes in lighting conditions in the production environment can cause interference such as reflections and shadows on the wallpaper surface, seriously affecting the quality of image acquisition and thus reducing the accuracy of defect segmentation. In addition, the existing detection system lacks effective background modeling and dynamic update mechanisms, making it difficult to adapt to the subtle differences between different batches of wallpaper. These technical bottlenecks have seriously restricted the level of automated detection of wallpaper production quality.

[0003] In view of the above problems, the existing technology is in urgent need of improvement. Summary of the Invention

[0004] The purpose of the present invention is to provide a wallpaper surface defect detection method to solve the above technical problems.

[0005] To achieve the above object, the present invention provides the following technical solutions: A method for detecting surface defects of wallpaper comprises the following steps: S100: Use a line scan camera to capture wallpaper surface images under an illumination of 5000±100 Lux, perform gamma correction on the images, establish an average background model, and perform reflection compensation based on the average background model. S200, the reflection-compensated image is separated into three color channels: R, G, and B. Each channel image is divided into 32×32 pixel sub-blocks, and the gray-level co-occurrence matrix (GLCM) of each channel is calculated; the contrast features are extracted, and the dynamic weights of each sub-block are calculated to obtain a weighted RGB image. The RGB image is then converted to the LAB color space, the L channel is extracted, and normalized to the range of [0,1] to obtain ; Fuse the weighted RGB image and L channel; S300, using the Daubechies8 wavelet basis to perform a three-layer decomposition, retaining only the third-layer approximate coefficient A3, performing an inverse wavelet transform on A3, and reconstructing a background image; and calculating a defect candidate image, and performing high-frequency enhancement on the defect candidate image; For the defect candidate image, perform dual-channel Otsu segmentation, make decision fusion after segmenting the two channels, and remove noise and filter non-defect regions to obtain the defect region.

[0006] The present invention further sets that the formula during Gamma correction is: In the above formula is the original pixel value, which is determined by minimizing the illumination uneven variance.

[0007] The present invention further sets that the two channels include Channel 1 and Channel 2. Channel 1 is global adaptive Otsu, and its process is as follows: Calculate the grayscale histogram of the enhanced defect candidate image where i = 0, 1, 2…, 255; calculate the probability of each gray level i, where is the number of pixels corresponding to gray level j; then calculate the global contrast C and entropy H of the image, where , Normalize the contrast C and entropy H, where , In the formula , , and set the exponential parameter: , ; then divide the image into two categories: the foreground with defects and the background without defects: Foreground: pixel value ≤ t; Background: pixel value > t; t is the candidate threshold; calculate the foreground probability and background probability respectively. The foreground probability is , and the background probability ; calculate the average grayscale of the foreground: ; ; calculate the between-class variance and then determine the optimal global threshold. The between-class variance is calculated as follows: ; the optimal global threshold is: ; apply threshold segmentation to the image: .

[0008] The present invention further sets that Channel 2 is local CLAHE-Otsu, and its steps are as follows: Divide the enhanced defect candidate image into non-overlapping 32×32 pixel blocks, and process each pixel block: Apply CLAHE; set the parameters: clip limit = 2.0, and further divide each block into 8×8 small grids; perform histogram equalization within the block, but limit the increase of each gray level not to exceed the value specified by clip limit; apply Otsu threshold segmentation to the block after CLAHE processing to obtain the binary mask of the block; splice the binary masks of all blocks into a complete local mask map LocalMask.

[0009] The present invention further provides that the segmentation results of Channel 1 and Channel 2 are subjected to a logical AND operation: CombinedMask(x,y)=GlobalMask(x,y)∩LocalMask(x,y).

[0010] The present invention further provides that the image CombinedMask(x,y) is processed and optimized, and the steps are as follows: first perform an opening operation on the image: erode and then dilate using a circular structuring element; then perform a closing operation: dilate and then erode using a cross-shaped structuring element; subsequently mark all connected regions, and calculate the shape factor for each connected region , represents the area of the connected region, represents the perimeter of the connected region; among them, the regions where (ShapeFactor < 0.3) ∪ (ShapeFactor > 0.7) are retained, where for crack / wrinkle defects: ShapeFactor < 0.3, and for hole / black spot defects: ShapeFactor > 0.7.

[0011] The present invention further provides that its gray-level co-occurrence matrix is calculated When calculating, the directions are 0°, 45°, 90°, 135°, and the distance is 1 pixel; the following formula is used to calculate the contrast feature: ; Subsequently, the dynamic weight is calculated, and the formula is as follows: where the contrasts of the R, G, and B channels are respectively , , , , and then the weighted RGB image is calculated: , and then the image is fused with the image , and the fused image is: .

[0012] The present invention further provides that the average background model is constructed in the following manner: collect N ≥ 10 defect-free wallpaper sample images, perform sub-pixel image registration using SIFT feature point matching, and calculate the average value pixel by pixel: ; is the pixel gray value of the i-th image at the position (x,y), and the sample image needs to be converted to a gray value; and the background model is updated. For every 1000 meters of wallpaper produced, 5 new defect-free images are added to update the model once, and the update formula is: .

[0013] The present invention further provides a reflection compensation formula: where: = 0.85, ; The present invention is further configured to perform three - layer wavelet decomposition on the fused image using the Daubechies8 wavelet basis, obtaining the high - frequency detail coefficients and low - frequency approximation coefficients of each layer; Only retain the low - frequency approximation coefficient of the third layer, denoted as A3, and set the other coefficients to zero; perform inverse wavelet transform on A3 to reconstruct the background image , and calculate the defect candidate image: , and then perform high - frequency enhancement on : Use a Laplacian filter (5×5 kernel) for sharpening, and its matrix K is: Subsequently, perform convolution operation: . .

[0014] The present invention includes at least one of the following beneficial effects: A wallpaper defect detection method and system provided by this application, through multi - spectral fusion analysis, dynamic background modeling, wavelet decomposition and reconstruction, and dual - channel segmentation decision - making fusion technology, can effectively distinguish decorative patterns from real defects, improve the detection sensitivity of micro - defects, adapt to illumination change interference, and has the advantage of reducing the false detection rate. Specific Embodiments

[0015] The following will elaborate on the implementation manners of this application in conjunction with embodiments, clearly and completely describe the technical solutions in this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of them. Usually, the components of this application described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of this application that is required to be protected, but only represents the selected embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of this application.

[0016] In the prior art, the detection of wallpaper surface defects has long faced problems such as complex texture interference, difficulty in identifying micro - defects, and uneven illumination affecting the detection accuracy. Traditional methods rely on single - color space or fixed - threshold segmentation, making it difficult to distinguish real defects from decorative patterns, prone to misjudgment in reflective areas, and having a high miss - detection rate for sub - millimeter - level defects. In actual production lines, when detecting PVC wallpapers with embossed textures, existing algorithms often misidentify concave - convex patterns as cracks and are unable to effectively capture micro - pinhole defects on semi - transparent substrates.

[0017] To solve the above problems, the R & D personnel found that there are differences in the frequency domain distribution of texture features and defect morphologies, and considered separating the background texture through multi-scale analysis. Further observation shows that the luminance channel in the LAB color space is robust to surface reflection, while dynamic weight fusion can enhance the contrast of the defect area. Regarding the lighting problem, it is proposed to establish an updatable background model to eliminate environmental interference, and combine wavelet reconstruction technology to extract the high-frequency components of defects.

[0018] Therefore, this application proposes a detection method including image acquisition and preprocessing, multi-channel feature fusion, wavelet decomposition and reconstruction, and dual-threshold segmentation. After the line array camera acquires an image under standard illuminance, Gamma correction and reflection compensation are used to eliminate lighting interference. The image is decomposed into the RGB and LAB spaces for feature fusion, wavelet transform is used to separate the background texture and enhance the defect signal, and finally an improved Otsu algorithm is adopted to achieve precise segmentation.

[0019] The specific method is as follows: A method for detecting defects on the surface of wallpaper, including the following steps: A method for detecting defects on the surface of wallpaper, including the following steps: S100. Use a line array camera to collect images of the wallpaper surface under an illuminance of 5000 ± 100 Lux, perform Gamma correction on the images, establish an average background model, and perform reflection compensation based on the average background model; S200. The image after reflection compensation is separated into three color channels of R, G, and B. Each channel image is divided into 32×32 pixel sub-blocks, and the gray-level co-occurrence matrix (GLCM) of each channel is calculated; the contrast feature is extracted, and the dynamic weight of each sub-block is calculated and the weighted RGB image is obtained. Subsequently, the RGB image is converted into the LAB color space, the L channel is extracted, and it is normalized to the range of [0,1] to obtain ; fuse the weighted RGB image and the L channel; S300. Use the Daubechies8 wavelet basis for 3-layer decomposition, only retain the 3rd layer approximation coefficient A3, perform wavelet inverse transform on A3 to reconstruct the background image; and calculate the defect candidate image, and perform high-frequency enhancement on the defect candidate image; S400. Perform dual-channel Otsu segmentation on the defect candidate image, perform decision fusion after segmenting the two channels, and remove noise and filter non-defect areas to obtain the defect area.

[0020] In this embodiment, the formula for Gamma correction is: , in the above formula is the original pixel value, is determined by minimizing the uneven illumination variance.

[0021] The dual-channel consists of two channels, namely, channel one and channel two. Channel one is global adaptive Otsu, and its process is as follows: Calculate the gray-level histogram of the enhanced defect candidate image , where i = 0, 1, 2…, 255; Calculate the probability of each gray level i, , where is the number of pixels corresponding to gray level j; Subsequently, calculate the global contrast C and entropy H of the image, where , , The contrast C and entropy H are normalized, where , , in the formula , , and set the exponential parameter: , ; Subsequently, the image is divided into two categories: the foreground with defects and the background without defects: Foreground: pixel value ≤ t; Background: pixel value > t; t is the candidate threshold; Calculate the foreground probability and background probability respectively. The foreground probability is , and the background probability ; Calculate the average gray level of the foreground: ; ; Calculate the between-class variance and then determine the optimal global threshold. The between-class variance is calculated as follows: ; The optimal global threshold is: ; Apply threshold segmentation to the image: .

[0022] In this embodiment, channel two is local CLAHE-Otsu, and its steps are as follows: Divide the enhanced defect candidate image into non-overlapping 32×32 pixel blocks, and process each pixel block: Apply CLAHE; Set parameters: clip limit = 2.0, and each block is further divided into 8×8 small grids; Perform histogram equalization within the block, but limit the increase of each gray level not exceeding the value specified by clip limit; Apply Otsu threshold segmentation to the block processed by CLAHE to obtain the binary mask of the block; Stitch the binary masks of all blocks into a complete local mask map LocalMask. Subsequently, perform a logical AND operation on the segmentation results of channel one and channel two: The formula is as follows CombinedMask(x,y)=GlobalMask(x,y)∩LocalMask(x,y).

[0023] After obtaining the image CombinedMask(x,y), the image CombinedMask(x,y) is processed and optimized. The steps are as follows: First, perform an opening operation on the image: erode using a circular structuring element and then dilate; then perform a closing operation: dilate using a cross-shaped structuring element and then erode; subsequently, label all connected regions, and calculate the shape factor for each connected region , represents the area of the connected region, represents the perimeter of the connected region; among them, the regions where (ShapeFactor < 0.3) ∪ (ShapeFactor > 0.7) are retained, where for crack / wrinkle defects: ShapeFactor < 0.3, and for hole / black spot defects: ShapeFactor > 0.7.

[0024] Calculate its gray-level co-occurrence matrix When calculating, the directions are 0°, 45°, 90°, 135°, and the distance is 1 pixel. The specific algorithm is the content in the prior art and will not be elaborated here in detail; the contrast feature is calculated using the following formula: ; Subsequently, calculate the dynamic weight, and its formula is as follows: where the contrasts of the R, G, and B channels are respectively , , , and is the sum of the contrasts of the R, G, and B channels, , subsequently calculate the weighted RGB image: , and then fuse the image with the image , and the fused image is: .

[0025] In this embodiment, the average background model is constructed in the following manner: Collect N ≥ 10 defect-free wallpaper sample images, perform sub-pixel image registration using SIFT feature point matching, and calculate the average value pixel by pixel: ; is the pixel gray value of the i-th image at the position (x,y), and the sample image needs to be converted to a gray value; and update the background model. For every 1000 meters of wallpaper produced, add 5 defect-free images to update the model once, and the update formula is: , where the reflection compensation formula used in this embodiment is: , where: = 0.85, ; Use the Daubechies8 wavelet basis to perform 3-layer wavelet decomposition on the fused image to obtain the high-frequency detail coefficients and low-frequency approximation coefficients of each layer; Only retain the low-frequency approximation coefficients of the third layer, denoted as A3, and set the other coefficients to zero. Perform inverse wavelet transform on A3 to reconstruct the background image. , calculate the defect candidate image: , and then for perform high-frequency enhancement: Use a Laplacian filter (5×5 kernel) for sharpening, and its matrix K is: Then perform convolution operation: .

[0026] In this embodiment, Gamma correction refers to adjusting the brightness distribution of the image through a non-linear transformation, which can be specifically implemented by a power function transformation to compensate for the response deviation of the line array camera under different lighting conditions. The average background model refers to a reference image established by pixel-level averaging of multiple defect-free samples to eliminate the interference of the inherent texture of the wallpaper on defect detection. The gray-level co-occurrence matrix refers to a texture analysis tool that describes the spatial relationship of pixels and quantifies the local texture complexity by calculating the contrast feature. Dynamic weight fusion refers to automatically assigning weight coefficients according to the contrast contribution of each color channel to enhance the saliency expression of the defect area. Inverse wavelet transform reconstruction refers to retaining specific frequency band coefficients to reconstruct the image to separate the background texture and retain the high-frequency components of the defect. Dual-channel Otsu segmentation refers to a threshold decision method that combines global and local features and fuses the two segmentation results through a logical AND operation to reduce mis-segmentation caused by complex backgrounds.

[0027] Specifically, in the image acquisition stage, a stable input is established through a standardized lighting environment and reflection compensation. In the multi-channel processing stage, texture features are extracted in the RGB space, brightness information is obtained in the LAB space, and an enhanced feature expression is formed through weighted fusion. In the wavelet decomposition stage, the low-frequency background is filtered out through three-level decomposition, and the defect candidate area is obtained after reconstruction. High-frequency enhancement processing amplifies the defect edge information, dual-threshold segmentation combines global statistics and local contrast features, and morphological filtering combines shape factors to finally determine the defect area. This scheme effectively distinguishes real defects from complex textures through joint analysis in the frequency domain space and multi-dimensional feature fusion.

[0028] Compared with the prior art, traditional methods using a single color space or fixed threshold are difficult to adapt to variable textures, while this scheme enhances the defect contrast through complementary features in the LAB and RGB dual spaces. Conventional wavelet denoising directly uses high-frequency coefficients, and this method innovatively uses inverse transform reconstruction to retain effective defect information. The existing Otsu algorithm only considers the gray-level histogram distribution, and this scheme introduces a dynamic weight adjustment threshold selection strategy for contrast and entropy to improve the segmentation accuracy.

[0029] Through the above technical solutions, this application effectively overcomes the problem of false detection caused by complex textures, improves the recognition sensitivity to micro-defects, and significantly reduces the impact of uneven illumination on the detection results. The multi-channel feature fusion mechanism enhances the distinguishability of the defect area. The wavelet reconstruction technology accurately separates the background texture. The improved segmentation algorithm reduces the consumption of computing resources while ensuring the detection accuracy, and is applicable to the industrial detection scenario of high-speed continuous production.

[0030] Among them, the global adaptive Otsu refers to a threshold segmentation method that dynamically adjusts the between-class variance weight coefficient. Specifically, it can be implemented by constructing an exponential model using the normalized contrast parameter and the entropy parameter. The contrast parameter reflects the overall light and dark difference of the image, and the entropy parameter characterizes the texture complexity. The local CLAHE-Otsu refers to a combined method of block-limited contrast histogram equalization and threshold segmentation. Specifically, it can be implemented by dividing the image into 32×32 pixel blocks and performing CLAHE enhancement within each block and then applying Otsu segmentation. Setting the clip limit parameter to 2.0 can prevent local over-enhancement. The logical AND operation refers to performing an intersection operation on the global and local segmentation results. Specifically, it can be implemented by pixel-level Boolean operations, and the regions that satisfy both segmentation conditions are retained.

[0031] Specifically, in the global adaptive Otsu channel, by calculating the probability distribution of the grayscale histogram, a dynamic threshold model is constructed in combination with the normalized contrast and entropy parameters. The contrast parameter is quantified as the probability-weighted sum of the squared gray levels, and the entropy parameter is quantified as the information entropy value. After normalization, the exponential parameters k and m are generated to adjust the foreground and background probability weights in the between-class variance formula. When the texture complexity of the image is high, the increase in the entropy parameter causes the k value to decrease, reducing the weight coefficient of the foreground probability. When the overall contrast of the image is low, the m value decreases, increasing the weight coefficient of the background probability. By traversing the candidate threshold t to calculate the maximum between-class variance, the global segmentation threshold adapted to different illumination and texture conditions is obtained. In the local CLAHE-Otsu channel, after the image is divided into 32×32 pixel blocks, CLAHE enhancement based on an 8×8 sub-grid is performed within each block. The cliplimit parameter limits the histogram equalization amplitude of each sub-grid to avoid overexposure or underexposure in local areas. The enhanced image blocks generate local binary masks through Otsu segmentation, and finally are stitched together to form the complete local segmentation result. The global and local masks are fused through a logical AND operation, and only the regions determined to be defective in both channels are retained.

[0032] Compared with the prior art, traditional methods usually adopt single global threshold or block processing with fixed parameters, making it difficult to adapt to complex texture and illumination changes simultaneously. For example, the standard Otsu algorithm determines the threshold only based on the maximization of the between-class variance, without considering the impact of texture complexity on segmentation; conventional CLAHE processing uses fixed block size and clip limit parameters, which are prone to artifacts in the wallpaper pattern area. This solution dynamically adjusts the weight coefficient of the between-class variance, enabling global threshold segmentation to automatically balance contrast and texture factors according to image characteristics; local processing adopts a dual-grid division strategy, nesting 8×8 sub-grids within a 32×32 main block, which not only ensures the fineness of local contrast enhancement but also avoids the problem of over-segmentation.

[0033] Through the above technical solution, this application effectively solves the problem of threshold drift caused by complex texture interference, suppressing mis-segmentation in the pattern area through a global dynamic weight adjustment mechanism; local dual-grid CLAHE enhancement improves the contrast difference between micro-defects and the background, and combines logical AND operation to filter pseudo-defect areas that only exist in a single channel. While maintaining the complete detection of large-area defects, it significantly improves the detection rate of micro-defects such as cracks and pinholes, and reduces the false detection phenomenon caused by uneven illumination or complex texture.

[0034] Among them, the global contrast C refers to an index of the brightness difference of an image calculated by weighted probability of gray levels squared, which can be specifically realized by second-order moment statistics of the gray histogram, and is used to quantify the overall brightness distribution characteristics of the image. The entropy H refers to an information quantity index reflecting the complexity of the gray distribution of the image, which can be specifically realized by weighted summation calculation of logarithms of probabilities, and is used to characterize the randomness of the texture structure. Normalization processing refers to mapping the numerical ranges of contrast and entropy to the [0,1] interval, which can be specifically realized by the maximum normalization method, and is used to eliminate the dimension difference and establish comparability between parameters. The exponential parameters k and m refer to weight factors dynamically adjusted according to the normalized entropy and contrast, which can be specifically generated by the linear transformation formula k = 1 - H_norm and m = C_norm, and are used to balance the influence of foreground probability and background contrast in the between-class variance calculation. The between-class variance formula refers to an adaptive discriminant function that fuses probability weights and gray differences, which can be specifically constructed in the form of a power function product, and is used to optimize the threshold selection accuracy of the traditional Otsu method under complex textures.

[0035] Specifically, by analyzing the gray-scale distribution characteristics of the enhanced defect candidate images, this method first quantifies the global contrast and entropy value to characterize the illumination conditions and texture complexity of the images. Normalization enables parameters with different dimensions to participate in the weight calculation collaboratively. The setting of the exponential parameter k reversely correlates the entropy value to the foreground probability weight, automatically reducing the influence of the foreground probability on the between-class variance when the texture complexity is high; the exponential parameter m positively correlates the contrast to the background probability weight, enhancing the distinguishability of the background area when the illumination is uneven. Through the improved between-class variance formula, the traditional fixed-weight model is transformed into a dynamic adjustment mechanism, enabling the optimal threshold T_g to adaptively change according to the statistical characteristics of the actual image. For example, in complex texture regions with low contrast and high entropy, this method automatically reduces the weight proportion of the foreground probability, avoiding misjudging dense textures as defects; while in regions with uneven illumination with high contrast and low entropy, it enhances the role of the background contrast, improving the segmentation accuracy of the defect edges. The finally generated GlobalMask effectively separates the defect area from the background through threshold segmentation.

[0036] Compared with the prior art, the traditional Otsu method only selects a fixed threshold based on the maximization of the between-class variance and cannot handle the gray-scale distribution shift caused by uneven illumination and the missegmentation problem caused by complex textures. This solution introduces a dynamic parameter adjustment mechanism for global contrast and entropy, integrating the image statistical characteristics and texture complexity information into the between-class variance calculation, enabling the threshold selection process to be adaptively optimized according to the actual scenario. Compared with static threshold segmentation methods, this technology solves the robustness problem of defect detection in complex industrial environments.

[0037] Through the above technical solutions, this application can effectively overcome the interference of abnormal gray-scale distribution under uneven illumination conditions on threshold segmentation, and at the same time suppress the false detection phenomenon caused by complex texture backgrounds. By dynamically adjusting the probability weights in the between-class variance calculation, the distinguishability between the defect area and the normal background is significantly improved, enabling accurate segmentation of small defects such as holes and cracks under complex illumination conditions. While ensuring the detection accuracy, this method enhances the adaptability of the algorithm to diverse production environments.

[0038] This application further proposes to divide the enhanced defect candidate images into non-overlapping 32×32 pixel blocks and process each pixel block: apply CLAHE; set parameters: clip limit = 2.0, and further divide each block into 8×8 small grids; perform histogram equalization within the block, but limit the increase amplitude of each gray level not to exceed the value specified by the clip limit; apply Otsu threshold segmentation to the block after CLAHE processing to obtain the binary mask of the block; splice the binary masks of all blocks into a complete local mask map LocalMask.

[0039] Among them, CLAHE refers to Contrast Limited Adaptive Histogram Equalization. Specifically, it can be implemented by dividing the image into blocks and performing histogram equalization on each sub-block while limiting the contrast increase. By controlling the clip limit parameter, noise over-amplification is prevented, and image smoothness is maintained while enhancing local contrast. The block processing means dividing the image into multiple non-overlapping 32×32 pixel regions, which can be specifically implemented by a fixed-size division method. By locally independent processing, it adapts to the brightness change characteristics of different regions. The clip limit refers to the maximum increase limit of the number of pixels of a single gray level during the histogram equalization process, which can be specifically set to 2.0 times the original distribution value. By limiting the local contrast enhancement amplitude, artifacts are avoided. The small grid refers to the 8×8 pixel units further divided within each 32×32 pixel block, which can be specifically implemented by a grid processing method. By refining the processing units, the accuracy of local histogram statistics is improved.

[0040] Specifically, by dividing the entire image into multiple 32×32 pixel blocks and independently executing the CLAHE algorithm within each sub-block, first the sub-block is subdivided into 8×8 pixel small grids for local histogram statistics, and the histogram is clipped and redistributed under the constraint that the clip limit is 2.0, effectively enhancing the gray difference between the defect area and the background. Subsequently, the Otsu threshold segmentation algorithm is separately applied to each enhanced sub-block, and the optimal segmentation threshold is automatically determined according to the local gray distribution characteristics, avoiding the mis-segmentation problem caused by a global single threshold in complex texture regions. Finally, the binary masks of all sub-blocks are seamlessly stitched together to form a complete local mask image, which not only retains the high sensitivity of local processing but also ensures the continuity of the overall segmentation result.

[0041] Compared with the prior art, traditional methods usually adopt global histogram equalization combined with fixed threshold segmentation, which is difficult to cope with local uneven illumination and complex texture interference. However, this solution combines block processing with local adaptive enhancement, enabling each image region to obtain optimal contrast adjustment. Coupled with dynamic threshold segmentation based on local gray distribution, the detection accuracy in reflective regions and regions with dense patterns is significantly improved.

[0042] Through the above technical solution, this application effectively solves the problem of threshold drift caused by local uneven illumination, enhances the separability of defect features while maintaining the integrity of image details, significantly improves the detection rate of micro-cracks and pinhole defects, and at the same time reduces the misjudgment probability under complex texture backgrounds.

[0043] Among them, the opening operation refers to a morphological processing method that removes small noise points through erosion followed by dilation operations. Specifically, it can be implemented using a circular structuring element with a radius of 3 pixels. Its function is to eliminate isolated noise points while maintaining the integrity of the defect area. The closing operation refers to a morphological processing method that fills internal voids through dilation followed by erosion operations. Specifically, it can be implemented using a 3×3 cross-shaped structuring element. Its function is to smooth the defect edges and connect broken areas. The shape factor is a geometric characteristic parameter that quantifies the degree of regularity of the region shape through the ratio of the perimeter to the area. Specifically, it can be calculated using the formula, and its function is to distinguish the physical shape differences between slender cracks and circular holes.

[0044] Specifically, first, perform the opening operation on the binary segmentation result. The isotropic property of the circular structuring element can effectively eliminate randomly distributed isolated noise points and avoid misjudging them as defects. Subsequently, perform the closing operation using the cross-shaped structuring element. Its direction selectivity can fill the internal voids of the hole defects along the horizontal and vertical directions while avoiding over-dilation that causes distortion of the defect shape. In the connected region analysis stage, quantify the geometric characteristics of each region by calculating the shape factor. When ShapeFactor < 0.3, it is determined as a crack or wrinkle defect with a high aspect ratio. When ShapeFactor > 0.7, it is determined as a hole or black spot defect close to a circle. By setting a double-threshold interval, the physical characteristics of different defect types are distinguished.

[0045] Compared with the prior art, traditional methods usually use a single morphological filter to process noise, making it difficult to balance noise elimination and defect shape preservation. Existing shape analysis mostly uses area thresholds or aspect ratio metrics and cannot effectively distinguish irregular defects in complex texture backgrounds. This solution combines morphological operations with different structuring elements to retain the geometric characteristics of real defects while eliminating noise, and combines a double-threshold screening mechanism based on circularity to achieve the distinction of the physical characteristics of defect types.

[0046] Through the above technical solution, this application can effectively remove isolated noise points and pseudo-defect areas in the segmentation result and avoid misjudging texture interference as real defects. Through the shape factor double-threshold screening mechanism, it accurately distinguishes defect types with different geometric characteristics, solves the problem that traditional methods confuse crack and hole-like defects, and improves the accuracy of defect classification and detection.

[0047] Among them, collecting N≥10 defect-free wallpaper sample images means establishing a reference model by obtaining a sufficient number of normal sample images. Specifically, it can be achieved by continuously shooting defect-free wallpaper segments on the production line using an industrial camera. This method can cover the statistical characteristics of the natural texture of the wallpaper and avoid model deviation caused by insufficient samples. SIFT feature point matching for sub-pixel image registration means achieving high-precision alignment by extracting image feature points. Specifically, the SIFT algorithm can be used to extract rotation-invariant feature points and then perform sub-pixel offset compensation. This method can eliminate pixel-level misalignment caused by mechanical vibration or conveyor belt offset. Calculating the average value pixel by pixel means performing pixel-level gray value statistics on the registered sample images. Specifically, it can be achieved by pixel-by-pixel arithmetic mean operation. This method can suppress random noise interference and retain stable background texture information. The dynamic update mechanism means periodically fusing new sample data according to the production progress. Specifically, the weighted average formula can be used to fuse the historical model and the newly collected samples in proportion. This method can adapt to the slow change of the background caused by the gradual change of material properties or the drift of environmental parameters.

[0048] Specifically, in the construction stage, by collecting multiple defect-free sample images and using SIFT feature point matching technology to achieve sub-pixel registration, it is ensured that different sample images are accurately aligned in space. The registered images generate an initial background model through pixel-by-pixel gray average operation, effectively eliminating the random noise and instantaneous interference of a single image. In the model update stage, the update process is triggered according to the production length threshold, and the local statistical information of the new samples is fused into the historical model with a preset weight coefficient, enabling the background model to continuously track the slow change of the material surface characteristics. This dual mechanism not only ensures the statistical stability in the model construction stage but also realizes the adaptive adjustment during the long-term operation.

[0049] Compared with the prior art, traditional methods usually use a single sample to construct a static background model, which cannot eliminate mechanical displacement errors and lacks the ability to update. This solution improves the spatial alignment accuracy through the multi-sample registration averaging method and keeps the model synchronized with the actual state of the production line through the periodic incremental update mechanism. Compared with the sliding average update method with a fixed weight, this solution adopts a combined strategy of the historical data retention coefficient and the new data introduction coefficient, suppressing short-term fluctuations while gradually absorbing effective change information.

[0050] Through the above technical solutions, this application effectively solves the misdetection problem caused by sample registration errors and background model aging in traditional detection methods. The multi-sample registration averaging method controls the image alignment error at the sub-pixel level, avoiding false defect determination caused by texture misalignment; the dynamic update mechanism enables the background model to follow the slow change of the material surface characteristics, preventing model failure caused by long-term operation. This composite modeling method realizes the high-precision construction and continuous optimization of the background model in a complex industrial environment, providing a reliable reference for defect detection.

[0051] Among them, SIFT feature point matching refers to extracting and matching key points of an image through the Scale-Invariant Feature Transform algorithm, which can be specifically implemented by multi-scale space extreme value detection and direction assignment, and is used to eliminate registration errors caused by shooting angle deviation.

[0052] Among them, sub-pixel image registration refers to improving the image alignment accuracy to below the pixel level, which can be specifically implemented by bilinear interpolation or cubic spline interpolation, and is used to improve the spatial alignment accuracy of the background model.

[0053] Among them, N≥10 refers to the lower limit of the number of defect-free samples collected, which can be specifically determined by statistical laws, and is used to ensure the generalization and noise resistance of the background model.

[0054] Among them, gray value conversion refers to converting a color image into a single-channel gray image, which can be specifically implemented by the weighted average method, and is used to eliminate the influence of color channel differences on background modeling.

[0055] Among them, the production length associated update mechanism refers to dynamically adjusting the model update frequency according to the wallpaper production progress, which can be specifically implemented by the encoder recording the production length and triggering the update operation, and is used to balance the model stability and adaptability.

[0056] Specifically, sub-pixel registration is achieved through SIFT feature point matching to ensure the precise alignment of multiple sample images in the spatial dimension and avoid pixel misalignment caused by mechanical vibration or transmission jitter. Converting the registered sample images into gray values and performing pixel-by-pixel average calculation can effectively suppress random noise interference and retain the stable features of the wallpaper texture. Setting a sample size of N≥10 can meet the requirements of the central limit theorem and make the background model statistically reliable. Adopting the production length associated update mechanism, new sample data is introduced every 1000 meters of wallpaper production, and the progressive fusion of historical data and new data is achieved through the weighting coefficients of 0.9 and 0.1, which not only prevents the background model from deviating due to changes in material batches but also avoids model oscillations caused by frequent updates.

[0057] Compared with the prior art, traditional background modeling methods usually adopt a fixed number of samples and lack a dynamic update mechanism, and are easily affected by equipment aging or material property changes during long-term production. In the prior art, image registration mostly adopts edge feature-based methods, which are prone to matching errors in complex texture scenes. This solution improves the registration accuracy through SIFT feature point matching and combines the model update strategy associated with the production progress, which can continuously maintain the timeliness of the background model.

[0058] Through the above technical solutions, the present application can effectively eliminate the background modeling error caused by uneven illumination, and solve the background drift problem caused by wear of production equipment or material batch differences. By precise sub-pixel registration, the spatial consistency of multi-sample images is ensured, and through a dynamic update mechanism, the background model is maintained in synchronization with the actual production status, thereby improving the stability and accuracy of the defect detection system in a complex industrial environment.

[0059] Specifically, in the initial modeling stage, stable feature points in the sample images are extracted by the SIFT algorithm, such as pattern intersection points or high-curvature regions, to establish cross-image matching point pairs. The sub-pixel registration technology is used to align multiple samples to the same coordinate system. For example, by calculating the sub-pixel correction value of the feature point offset, the textures of each sample at the same coordinate position are completely overlapped. After the gray conversion of the registered samples, the average value is calculated pixel by pixel to generate the initial background model. For example, the gray values of 10 sample images at the coordinate (100, 200) are added and then divided by 10 to obtain the background reference value at this position. During the production process, every time 1000 meters of wallpaper is produced, 5 new sample images are collected for the same processing. For example, a length counter is set in the continuous production process to trigger sampling. The background data is updated through the weighted fusion formula of the old and new models. For example, each pixel value of the original model is multiplied by 0.9, and the new sample mean is multiplied by 0.1 and then added together to form a background model adapted to the latest production status.

[0060] Compared with the prior art, the traditional static background model will have a texture reference offset after long-term use. For example, after the production line runs for 8 hours, the pattern position drifts by 2-3 pixels due to the change in material tension. This solution enables the background model to continuously track the actual production status through a periodic update mechanism, such as replenishing new samples every 20 minutes. Compared with the background modeling method with a fixed threshold, the weighted fusion formula can avoid introducing transient noise due to an overly large single update amplitude. For example, when there is a slight color difference in a certain batch of raw materials, the model only absorbs 10% of the new data to maintain the stability of the detection system.

[0061] Through the above technical solutions, the present application solves the problem of sample registration error caused by equipment vibration in traditional detection, such as improving the pattern alignment accuracy to within 0.5 pixels; overcomes the defect that the background model gradually becomes inaccurate during long-term production, such as still maintaining a defect detection rate of over 95% after continuous production for 8 hours; reduces the risk of false detection caused by material batch changes. For example, when the wallpaper background color changes by ±5%, the model can automatically adjust the reference value to adapt to the new color tone.

[0062] As used in the specification and claims, certain terms are used to refer to specific components. Those skilled in the art should understand that hardware manufacturers may use different terms to refer to the same component. The specification and claims do not use the difference in names as a way to distinguish components, but rather use the difference in the functions of components as the criterion for distinction. As used throughout the specification and claims, "comprising" is an open-ended term and should be interpreted as "comprising but not limited to". "Substantially" means within an acceptable error range, and those skilled in the art can solve technical problems within a certain error range and basically achieve the technical effects.

[0063] It should be noted that the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a commodity or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent in such a commodity or system. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the commodity or system including the element.

[0064] The above description shows and describes several preferred embodiments of the present invention. However, as mentioned above, it should be understood that the present invention is not limited to the form disclosed herein, should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the inventive concept of the present invention through the above teachings or the technology or knowledge in the relevant field. And the changes and modifications made by those skilled in the art that do not depart from the spirit and scope of the present invention shall fall within the protection scope of the appended claims of the present invention.

Claims

1. A method for detecting surface defects of wallpaper, characterized in that, It includes the following steps: S100. Use a line array camera to collect the wallpaper surface image under the illuminance of 5000±100 Lux, perform Gamma correction on the image, establish an average background model, and perform reflection compensation based on the average background model; The image after reflection compensation is separated into three color channels of R, G, and B. Each channel image is divided into 32×32 pixel sub-blocks, and the gray-level co-occurrence matrix GLCM of each channel is calculated; the contrast feature is extracted, and the dynamic weight of each sub-block is calculated to obtain the weighted RGB image. Subsequently, the RGB image is converted to the LAB color space, the L channel is extracted, and it is normalized to the range of [0,1] to obtain ; fuse the weighted RGB image and the L channel; S300. Use Daubechies8 wavelet basis for 3-layer decomposition, only retain the 3rd layer approximation coefficient A3, perform inverse wavelet transform on A3 to reconstruct the background image; and calculate the defect candidate image, and perform high-frequency enhancement on the defect candidate image; S400. Perform dual-channel Otsu segmentation on the defect candidate image, perform decision fusion after segmenting the two channels, and remove noise and filter non-defect regions to obtain the defect region.

2. The method for detecting surface defects of wallpaper according to claim 1, characterized in that, The formula during gamma correction is as follows: , in the above formula is the original pixel value, which is determined by minimizing the variance of uneven illumination.

3. A method for detecting surface defects of wallpaper according to claim 1, characterized in that, The two channels include Channel 1 and Channel 2. Channel 1 is global adaptive Otsu, and its process is as follows: Calculate the grayscale histogram of the enhanced defect candidate image , where i = 0, 1, 2…, 255; Calculate the probability of each gray level i, , where is the number of pixels corresponding to gray level j; Subsequently, calculate the global contrast C and entropy H of the image, where , , The contrast C and entropy H are normalized, where , , in the formula , , and set the exponential parameter: , , Subsequently, the image is divided into two categories: the foreground with defects and the background without defects Foreground: Pixel value ≤ t; Background: Pixel value > t; t is the candidate threshold; Calculate the foreground probability and the background probability respectively. The foreground probability is , and the background probability ; Calculate the average foreground gray value: ; ; Determine the optimal global threshold after calculating the between-class variance. The between-class variance is calculated as follows: ; The optimal global threshold is: ; Apply threshold segmentation to the image: .

4. A method for detecting surface defects of wallpaper according to claim 3, characterized in that, Among them, Channel 2 is local CLAHE-Otsu, and the steps are as follows: the enhanced defect candidate image is divided into non-overlapping 32×32 pixel blocks, and each pixel block is processed: applying CLAHE; Set parameters: clip limit = 2.0, and each block is further divided into 8×8 small grids; perform histogram equalization within the block, but limit the increase amplitude of each gray level not to exceed the value specified by clip limit; apply Otsu threshold segmentation to the block after CLAHE processing to obtain the binary mask of the block; splice the binary masks of all blocks into a complete local mask map LocalMask.

5. A wallpaper surface defect detection method according to claim 4, characterized in that, Perform a logical AND operation on the segmentation results of channel one and channel two: CombinedMask(x,y)=GlobalMask(x,y)∩LocalMask(x,y).

6. A wallpaper surface defect detection method according to claim 5, characterized in that Optimize the processing of the image CombinedMask(x,y) with the following steps: First, perform an opening operation on the image: erode it using a circular structuring element and then dilate it; then perform a closing operation: dilate it using a cross-shaped structuring element and then erode it; subsequently, label all connected regions and calculate the shape factor for each connected region , represents the area of the connected region, represents the perimeter of the connected region; among them, retain the regions where (ShapeFactor < 0.3) ∪ (ShapeFactor > 0.7), where for crack / wrinkle defects: ShapeFactor < 0.3, and for hole / black spot defects: ShapeFactor > 0.

7.

7. A wallpaper surface defect detection method according to claim 1, characterized in that, Calculate its gray-level co-occurrence matrix When the directions are 0°, 45°, 90°, 135° and the distance is 1 pixel; the contrast feature is calculated using the following formula: ; Subsequently, calculate the dynamic weight, and its formula is as follows: where the contrasts of the three channels R, G, and B are respectively , , , is the sum of the contrasts of the three channels R, G, and B; , and then calculate the weighted RGB image: , and then combine the image with the image Perform fusion, and the fused image is: 。 8. A wallpaper surface defect detection method according to claim 1, characterized in that, The average background model is constructed as follows: collect N ≥ 10 defect-free wallpaper sample images, perform sub-pixel image registration using SIFT feature point matching, and calculate the average value pixel by pixel: ; where is the pixel gray value of the i-th image at the position (x, y), and the sample image needs to be converted to a gray value; and the background model is updated. For every 1000 meters of wallpaper produced, 5 new defect-free images are added to update the model once, and the update formula is: .

9. A method for detecting surface defects of wallpaper according to claim 1, characterized in that, Reflection compensation formula: Where: = 0.85, .

10. A method for detecting surface defects of wallpaper according to claim 7, characterized in that: Perform 3-level wavelet decomposition on the fused image using the Daubechies 8 wavelet basis to obtain the high-frequency detail coefficients and low-frequency approximation coefficients of each level; ​ Only retain the low-frequency approximation coefficients of the third layer, denoted as A3, and set the other coefficients to zero; For A 3, perform the inverse wavelet transform to reconstruct the background image , and calculate the defect candidate image: , then For , perform high-frequency enhancement: Use a Laplacian filter with a 5×5 kernel for sharpening, and its matrix K is: ; Subsequently, a convolution operation is performed: .

Citation Information

Patent Citations

  • A method for detecting and recognizing wallpaper defects based on OTSU and GA-BP neural network

    CN109242848A

  • Automatic optical detection method and system based on gasket surface defects

    CN119643448A

  • Methods and systems for image processing

    US20170301095A1

Cited By

  • Image processing method based on wavelet transform

    CN121169778A