Method and system for detecting defects in wallpaper based on machine vision
By constructing a directional residual model and a directional difference distribution map, and combining the local principal direction deviation value with the neighborhood gradient difference, the problem of accuracy in defect identification in complex textured wallpaper was solved, realizing the automated discrimination and differentiation of multiple types of defects, and improving detection accuracy and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JIANGXI ZHUOAO TECH CO LTD
- Filing Date
- 2025-11-17
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies struggle to accurately distinguish between complex textures and abnormal defects, leading to false positives and false negatives in wallpaper defect detection and a lack of multi-type defect classification and identification capabilities.
By constructing a directional residual model and a directional difference distribution map, and combining the local principal direction deviation value with the difference in neighborhood directional gradient, texture disturbance areas are identified, and a regional scoring matrix is established for defect classification, generating a wallpaper defect credibility distribution map and defect classification image output.
It improves the accuracy of wallpaper image texture damage recognition, enhances the response capability and positioning accuracy of weak defects, supports the automatic identification and differentiation of multiple types of defects in complex texture backgrounds, and improves the overall accuracy and robustness of detection results.
Smart Images

Figure CN121544548B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of defect detection, and more specifically to a method and system for detecting wallpaper defects based on machine vision. Background Technology
[0002] Wallpaper, as a commonly used interior decoration material in building decoration, has a significant impact on the interior visual effect and user experience. In recent years, with the diversification of wallpaper production and application scenarios, its patterns and styles have shown stronger decorativeness, texture and multi-scale complexity. Wallpaper defect detection technology based on machine vision has been gradually introduced into the wallpaper manufacturing process. Through image acquisition, image processing and defect recognition, intelligent detection of defect types such as cracks, holes and stains can be achieved, realizing intelligent manufacturing and quality control upgrades.
[0003] Chinese patent CN109242848A discloses a method for detecting and identifying wallpaper defects based on OTSU and GA-BP neural networks. The method includes: acquiring a detection image of the wallpaper to be detected, and preprocessing the detection image using an RGB color function to obtain a preprocessed image; calculating the proportion of pixels in the preprocessed image whose pixel values are less than a pixel threshold; when the proportion is greater than a set threshold, performing defect segmentation on the preprocessed image using the OTSU threshold segmentation method; calculating the grayscale features and geometric features of the defective portion in the segmented image; inputting the grayscale features and geometric features into a pre-trained GA-BP neural network for detection to obtain the type of defect in the wallpaper; and when the proportion is less than or equal to a set threshold, it indicates that the wallpaper to be detected is defect-free.
[0004] In existing technologies, most methods rely on simple edge detection or grayscale thresholding strategies, which are difficult to handle wallpaper images with complex texture structures or gradient patterns. Existing methods have limited ability to model texture structures, making it difficult to accurately distinguish between normal texture changes and abnormal defect disturbances, which can easily lead to false detections and false negatives. The lack of multi-type defect classification and recognition is a problem that we need to solve. Summary of the Invention
[0005] The purpose of this invention is to address the problems existing in the background art by proposing a method and system for detecting wallpaper defects based on machine vision.
[0006] The technical solution of this invention: a wallpaper defect detection method based on machine vision, comprising the following steps:
[0007] S1. Analyze the acquired wallpaper image data to be detected, obtain the regional texture variance, edge density and brightness gradient indices, and generate a set of scale image layers; extract significant edge points in the images at each scale and generate a set of edge anchor points.
[0008] S2. Perform multi-directional sliding window analysis on the set of scale image layers and the set of edge anchor points, calculate the local texture information entropy and gray-level co-occurrence matrix eigenvalues, obtain the texture difference index of each window, analyze based on the set of edge anchor points, and generate a set of texture feature maps; perform local contrast enhancement on the set of texture feature maps to generate a texture saliency distribution map.
[0009] S3. Based on the texture saliency distribution map, extract the main direction distribution of each pixel's neighborhood, calculate the neighborhood direction deviation value and direction gradient difference, and construct the direction residual model based on the direction consistency change between adjacent regions to generate the residual map and direction difference distribution map.
[0010] S4. Analyze the texture saliency distribution map and residual map, calculate the regional saliency score based on the orientation difference distribution map, establish the regional scoring matrix, and generate the wallpaper defect credibility distribution map and defect classification image output set based on the regional scoring matrix.
[0011] Preferably, the acquired wallpaper image data to be detected is analyzed to obtain regional texture variance, edge density, and brightness gradient indices, and a set of scale image layers is generated; the process of extracting significant edge points and generating a set of edge anchor points in images at each scale includes:
[0012] The process involves acquiring wallpaper image data for testing and performing grayscale conversion, image denoising, and brightness normalization. Based on the brightness-normalized wallpaper image data, local grayscale statistical features are calculated using a fixed-size sliding window to obtain the regional texture variance. The gradient components of the wallpaper image data in the horizontal and vertical directions are calculated using the Sobel operator, and the square root of the sum of squares of the horizontal and vertical gradient components is calculated to obtain the gradient magnitude map. The edge density is calculated based on the ratio of the number of non-zero pixels in the gradient magnitude map to the area of the fixed sliding window region. The gradient magnitude map is then normalized to obtain the brightness gradient intensity index.
[0013] By combining regional texture variance, edge density, and brightness gradient intensity indices, the wallpaper image data is scaled proportionally and filtered through multiple levels using a Gaussian pyramid method to construct a set of scale image layers. In each scale image layer, the edge response intensity is detected using the Sobel operator and non-maximum suppression algorithm, and local significant edge points are screened using a high and low dual threshold method to generate an edge response map. Based on the edge response map, the pixels at the geometric center of the connected region are extracted as candidate edge points, and the two-dimensional image coordinates of each candidate edge point in its corresponding scale image layer are recorded. An edge anchor point set is generated based on the set edge intensity threshold.
[0014] Preferably, the process of performing multi-directional sliding window analysis on the set of scale image layers and the set of edge anchor points, calculating the local texture information entropy and gray-level co-occurrence matrix eigenvalues, obtaining the texture difference index of each window, and generating a texture feature map set based on the set of edge anchor points includes:
[0015] For each scale image in the scale image layer set, a multi-directional oblique sliding window is used for acquisition. The local texture information entropy is calculated based on each image sub-block. The local texture information entropy is calculated based on the image gray-level distribution histogram. A gray-level co-occurrence matrix is constructed based on the image sub-blocks, and matrix feature values are extracted from the gray-level co-occurrence matrix.
[0016] The local texture information entropy and matrix eigenvalues at each sliding window position are combined sequentially to form a texture feature vector. A texture difference index set containing texture feature vectors at all window positions is constructed. Based on the positional correspondence of anchor points in the edge anchor point set at different scales, the texture difference index set is scale-space registered to obtain a texture feature map set at a unified scale.
[0017] Preferably, the process of performing local contrast enhancement on the texture feature map set to generate a texture saliency distribution map is as follows:
[0018] Local contrast enhancement is performed on each texture feature map. Local contrast enhancement refers to calculating the pixel mean, standard deviation, and local extreme value difference within the neighborhood window of each pixel. A contrast enhancement mapping function is constructed based on the local extreme value of each pixel to adjust the pixel-level grayscale mapping of the original texture feature map.
[0019] The texture feature map after local contrast enhancement is normalized and edge smoothed to obtain a texture saliency distribution map.
[0020] Preferably, the process of extracting the main orientation distribution of each pixel's neighborhood based on the texture saliency distribution map, calculating the neighborhood orientation deviation value and orientation gradient difference, and constructing an orientation residual model based on the orientation changes between adjacent regions includes:
[0021] Based on the texture saliency distribution map, the set of main directions of the local neighborhood of each pixel is extracted. The absolute value of the difference between the main direction of the current pixel and the average main direction of the neighborhood is calculated and denoted as the direction deviation value. The direction deviation value is combined with the gradient direction change rate of the neighboring pixels to establish a direction function. The direction residual function is defined according to the direction deviation output by the direction function, and the direction residual intensity matrix is generated according to the value distribution of the direction residual function in the image space. The direction residual intensity matrix is normalized and smoothed to construct the direction residual model. The output of the direction residual model is mapped to a visual residual map. The direction difference distribution map is generated based on the direction deviation statistics in the direction residual model.
[0022] Preferably, the process of generating the residual map and the orientation difference distribution map includes:
[0023] Using the directional residual intensity matrix generated in the directional residual model, high-intensity residual regions are extracted based on a set residual response threshold. For each high-intensity residual region, the connected region area, boundary contour length, and centroid position are calculated to construct a set of perturbation regions. Contour point sequences are extracted from this set, and the variation amplitude of the contour point normal vector direction is analyzed. The irregularity index of the perturbation contour is calculated, and pixels with the largest local directional deviation value and whose boundary irregularity index exceeds a set irregularity threshold are selected as candidate perturbation center points. The candidate perturbation center point with the largest directional deviation value is selected as the perturbation center point. Starting from the perturbation center point, the directional... For propagation, if the difference in principal direction between consecutive pixels is less than a set direction difference threshold, and the grayscale value of the corresponding texture saliency distribution map is greater than a preset grayscale threshold, a perturbation propagation path is constructed. The perturbation propagation paths are then integrated to construct a perturbation propagation path map. The direction deviation values of pixels within the perturbation propagation path map are extracted to construct a direction offset intensity matrix. The length of the path segment and the mean of the pixel values of all its pixels in the saliency distribution map are calculated as the propagation weight of the path segment. Path weights are set, and the direction offset intensity of all path segments is analyzed in relation to the propagation weights to generate a direction difference response map. The direction residual intensity matrix is processed and analyzed with the propagation path weight matrix to obtain a residual map.
[0024] Preferably, the process of analyzing the texture saliency distribution map and residual map, calculating the regional saliency score based on the orientation difference distribution map, establishing a regional scoring matrix, and generating a wallpaper defect confidence distribution map and defect classification image output set based on the regional scoring matrix includes:
[0025] Align the pixel coordinates of the texture saliency distribution map and the residual map in the image coordinate space to construct an initial defect response map; calculate the gradient direction in the neighborhood of each pixel based on the initial defect response map, and mark the pixel pair as a gradient connected pixel pair when the gradient direction deviation value is less than a set gradient deviation threshold; mark the connected components of the gradient connected pixel pairs in the entire image to obtain a set of gradient connected regions.
[0026] By combining the directional deviation of each pixel in the directional difference distribution map, the average saliency value, average directional deviation, and gradient connectivity ratio within each gradient connected region are calculated to obtain a region saliency score. The region saliency scores of all regions are mapped to a two-dimensional matrix with the same size as the input image using spatial coordinates to generate a region scoring matrix. The region scoring matrix is normalized, and mean filtering is performed between adjacent matrix units to generate a wallpaper defect confidence distribution map. The wallpaper defect confidence distribution map is a two-dimensional matrix with the same size as the input image, where each pixel value represents the confidence probability of belonging to a defect region. Based on regions in the wallpaper defect confidence distribution map with confidence probabilities higher than a set confidence threshold, region contours are extracted, and the gray-level mean, texture variance, and directional consistency index within the region are calculated to generate feature vectors. The feature vectors are used to determine the defect category, and defect mask images for cracks, holes, and stains are output according to a preset classification model. These defect mask images are combined to form a defect classification image output set.
[0027] This invention also discloses a wallpaper defect detection system based on machine vision, including a management center, which is communicatively connected to an image acquisition and analysis module, an image processing module, an image orientation analysis module, and a defect detection module.
[0028] The image acquisition and analysis module is used to analyze the acquired wallpaper image data to be detected, obtain regional texture variance, edge density and brightness gradient indices, and generate a set of scale image layers; extract significant edge points in the images at each scale and generate a set of edge anchor points.
[0029] The image processing module is used to perform multi-directional sliding window analysis on the set of scale image layers and the set of edge anchor points, calculate the local texture information entropy and gray-level co-occurrence matrix eigenvalues, obtain the texture difference index of each window, analyze based on the set of edge anchor points, generate a set of texture feature maps, and perform local contrast enhancement on the set of texture feature maps to generate a texture saliency distribution map.
[0030] The image orientation analysis module is used to extract the main orientation distribution of each pixel's neighborhood based on the texture saliency distribution map, calculate the neighborhood orientation deviation value and orientation gradient difference, and construct an orientation residual model based on the orientation consistency change between adjacent regions to generate a residual map and an orientation difference distribution map.
[0031] The defect detection module is used to analyze the texture saliency distribution map and residual map, calculate the regional saliency score based on the orientation difference distribution map, establish a regional scoring matrix, and generate a wallpaper defect credibility distribution map and defect classification image output set based on the regional scoring matrix.
[0032] Compared with the prior art, the above-mentioned technical solution of the present invention has the following beneficial technical effects: By constructing a directional residual model and a directional difference distribution map, and combining the local principal direction deviation value and the neighborhood directional gradient difference, it is possible to perform directional sensitivity modeling on potential texture disturbance areas in wallpaper images, and identify the directional offset path and the location of the disturbance center, which helps to improve the accuracy of wallpaper image texture damage degree recognition, and improve the response capability and positioning accuracy of weak defects; By establishing a region scoring matrix and fusing significance value, directional deviation degree and gradient connectivity, a comprehensive credibility assessment of potential defect areas in wallpaper images can be achieved, and on this basis, defect classification output of crack, hole and stain types can be completed, which can support the automatic discrimination and differentiation of multiple types of defects in complex texture backgrounds, and enhance the expression accuracy and robustness of the overall defect detection results. Attached Figure Description
[0033] Figure 1 This is a flowchart of one embodiment of the present invention. Detailed Implementation
[0034] Example 1, as Figure 1 As shown, the wallpaper defect detection method based on machine vision proposed in this invention includes the following steps:
[0035] S1. Analyze the acquired wallpaper image data to be detected, obtain the regional texture variance, edge density and brightness gradient indices, and generate a set of scale image layers; extract significant edge points in the images at each scale and generate a set of edge anchor points.
[0036] S2. Perform multi-directional sliding window analysis on the set of scale image layers and the set of edge anchor points, calculate the local texture information entropy and gray-level co-occurrence matrix eigenvalues, obtain the texture difference index of each window, analyze based on the set of edge anchor points, and generate a set of texture feature maps; perform local contrast enhancement on the set of texture feature maps to generate a texture saliency distribution map.
[0037] S3. Based on the texture saliency distribution map, extract the main direction distribution of each pixel's neighborhood, calculate the neighborhood direction deviation value and direction gradient difference, and construct the direction residual model based on the direction consistency change between adjacent regions to generate the residual map and direction difference distribution map.
[0038] S4. Analyze the texture saliency distribution map and residual map, calculate the regional saliency score based on the orientation difference distribution map, establish the regional scoring matrix, and generate the wallpaper defect credibility distribution map and defect classification image output set based on the regional scoring matrix.
[0039] It should be further explained that, in the specific implementation process, the acquired wallpaper image data to be detected is analyzed to obtain regional texture variance, edge density, and brightness gradient indices, and a set of scale image layers is generated; the process of extracting significant edge points from images at each scale and generating a set of edge anchor points is as follows:
[0040] The process involves acquiring wallpaper image data for testing and performing grayscale conversion, image denoising, and brightness normalization to reduce the impact of illumination fluctuations and noise interference during image acquisition on subsequent analysis. Based on the brightness-normalized wallpaper image data, local grayscale statistical features are calculated using a fixed-size sliding window to obtain the regional texture variance, which measures the severity of texture changes in the image. The gradient components of the wallpaper image data in the horizontal and vertical directions are calculated using the Sobel operator, and the square root of the sum of squares of the horizontal and vertical gradient components is calculated to obtain a gradient magnitude map, which is a combination of the square roots of the sum of squares of the horizontal and vertical gradient components of all pixels. The edge density is calculated based on the ratio of the number of non-zero pixels in the gradient magnitude map to the area of the fixed sliding window region; this edge density measures the density of local edge line distribution. Finally, the gradient magnitude map is normalized to obtain a brightness gradient intensity index, which reflects the distribution characteristics of the brightness change rate in the image space.
[0041] By combining regional texture variance, edge density, and brightness gradient intensity indices, the wallpaper image data is scaled proportionally and filtered through multiple levels using a Gaussian pyramid method to construct a set of scale image layers. Within each scale image layer, the Sobel operator and non-maximum suppression algorithm are used to detect edge response intensity, and a dual-threshold method (high and low thresholds) is used to filter locally significant edge points, generating an edge response map. Based on the edge response map, pixels at the geometric center of connected regions are extracted as candidate edge points. A connected region refers to a group of pixels in the wallpaper image data that have the same pixel value and are spatially adjacent or connected. The two-dimensional image coordinates of each candidate edge point in its corresponding scale image layer are recorded. An edge anchor point set is generated based on a set of set edge intensity thresholds. This set of edge anchor points includes scale level numbers and two-dimensional image coordinates, used for scale alignment and regional structure matching analysis in subsequent steps.
[0042] It should be further explained that, in the specific implementation process, multi-directional sliding window analysis is performed on the set of scale image layers and the set of edge anchor points to calculate the local texture information entropy and gray-level co-occurrence matrix eigenvalues, obtain the texture difference index of each window, and generate a texture feature map set based on the set of edge anchor points. The process of locally enhancing the contrast of the texture feature map set to generate a texture saliency distribution map is as follows:
[0043] For each scale image in the scale image layer set, a multi-directional oblique sliding window is used for acquisition. The multi-directional oblique sliding window slides sequentially in the horizontal, vertical, and diagonal directions in each scale image, and extracts the corresponding image sub-block data at each sliding position. Local texture information entropy is calculated based on each image sub-block. The local texture information entropy is calculated based on the image gray-level distribution histogram and is used to reflect the texture complexity of the local region. A gray-level co-occurrence matrix is constructed based on the image sub-blocks, and matrix feature values are extracted from the gray-level co-occurrence matrix. The matrix feature values include energy, contrast, correlation, and entropy, which are used to describe the directional and structural features of gray-level changes within the region.
[0044] Specifically, each scale image in the scale image layer set is divided into several image sub-blocks. The pixel grayscale value pairs within each sub-block are statistically analyzed, and a grayscale co-occurrence matrix is generated based on a preset direction and distance. This grayscale co-occurrence matrix records the co-occurrence frequency of specific grayscale value combinations under specific spatial relationships, used to characterize local texture patterns. The image grayscale distribution histogram statistically analyzes the probability of each grayscale value appearing in the image sub-block. Based on information theory principles, the information entropy value is calculated for the grayscale probability distribution within the image sub-block, which is the local information entropy. The energy is used to describe the uniformity of the texture. The contrast reflects the intensity of grayscale changes. The correlation represents the linear relationship between grayscale values between pixels. The entropy is used to measure the complexity and randomness of the region.
[0045] The local texture information entropy and matrix eigenvalues at each sliding window position are combined sequentially to form a texture feature vector. A texture difference index set containing texture feature vectors at all window positions is constructed. Based on the positional correspondence of anchor points in the edge anchor point set at different scales, the texture difference index set is scale-space registered to obtain a texture feature map set at a unified scale.
[0046] Specifically, the scale-space registration refers to establishing a spatial correspondence between images by extracting edge anchors with high response intensity from images at various scales, and mapping the anchor positions in images at various scales to a unified reference scale according to the scaling ratio of the image pyramid, thereby achieving scale alignment and spatial registration of texture features.
[0047] Local contrast enhancement is performed on each texture feature map. This local contrast enhancement refers to calculating the pixel mean, standard deviation, and local extreme value difference within the neighborhood window of each pixel to measure the significant difference between the location and the surrounding texture. A contrast enhancement mapping function is constructed based on the local extreme value of each pixel to perform pixel-level grayscale mapping adjustment on the original texture feature map, thereby enhancing the contrast gradient between abrupt regions and smooth regions at texture boundaries.
[0048] The texture feature map after local contrast enhancement is normalized and edge smoothed to avoid high-frequency noise or edge artifacts in the saliency map due to local outliers; a texture saliency distribution map is obtained, which preserves the boundary continuity and intensity difference of texture anomaly concentration areas.
[0049] It should be further explained that, in the specific implementation process, based on the texture saliency distribution map, the main direction distribution of each pixel's neighborhood is extracted, the neighborhood direction deviation value and direction gradient difference are calculated, and a direction residual model is constructed based on the change in direction consistency between adjacent regions. The process of generating the residual map and the direction difference distribution map is as follows:
[0050] Based on the texture saliency distribution map, the set of main directions of the local neighborhood of each pixel is extracted, and the difference between the main direction of the current pixel and the average main direction of the neighborhood is calculated, which is denoted as the direction deviation value. The direction deviation value is combined with the gradient direction change rate of the neighboring pixels to establish a direction function, which is used to characterize the stability of the local direction structure. The direction residual function is defined according to the direction deviation output by the direction function, and the direction residual intensity matrix is generated according to the value distribution of the direction residual function in the image space. The direction residual intensity matrix records the output value of the direction residual function of each pixel, that is, the difference between the current pixel direction and the average direction of the neighborhood, using the image pixel coordinates as the index. The direction residual intensity matrix is normalized and smoothed to construct a direction residual model. The output result of the direction residual model is mapped to a visual residual map to represent the direction change trend between adjacent regions, that is, to compare the difference between each pixel residual value and its neighborhood average residual value. Based on the direction deviation statistics in the direction residual model, a direction difference distribution map is generated to characterize the degree of disturbance of the texture direction on the wallpaper surface.
[0051] It should be noted that the construction process of the direction function is as follows: taking each pixel in the texture saliency distribution map as the center, extract the set of main directions in its neighborhood window, calculate the difference between the main direction of the current pixel and the average main direction of the neighborhood, and combine it with the neighborhood gradient direction change rate to form a direction function; the direction deviation output by the direction function is a numerical measure of the local direction stability of the pixel, and its value is normalized and mapped to the [0,1] interval.
[0052] Using the directional residual intensity matrix generated in the directional residual model, high-intensity residual regions are extracted based on a set residual response threshold. For each high-intensity residual region, the connected region area, boundary contour length, and centroid position are calculated. The centroid position refers to the weighted average position of the coordinates of all pixels within the connected region in the image, constructing a set of perturbed regions. Contour point sequences are extracted from the perturbed region set, and the variation amplitude of the contour point normal vector direction is analyzed. The contour point normal vector direction refers to the unit normal vector direction of the current contour point, calculated based on the perpendicular direction of the tangent line after extracting adjacent points from each contour point in the perturbed region boundary contour point sequence, used to measure the local directional change of the perturbed region boundary. An irregularity index of the perturbed contour is calculated. The perturbed contour refers to the boundary contour of the connected region exceeding the set residual response threshold in the directional residual intensity matrix. The irregularity index is the square of the contour length of the perturbed region boundary and the pixel connectivity of the perturbed region. The ratio of the area to the product of 4π indicates the degree to which the contour of the perturbed region deviates from the regular shape. Pixels with the largest local directional deviation value and whose boundary irregularity index is higher than a set irregularity threshold are selected as candidate perturbed center points. The candidate perturbed center point with the largest directional deviation value is selected as the perturbed center point. Starting from the perturbed center point, directional propagation is carried out along the main direction. If the difference in the main direction between consecutive pixels is less than a set directional difference threshold, and the gray value of the corresponding texture saliency distribution map is greater than a preset gray value threshold, a perturbed propagation path is constructed. The perturbed propagation paths are integrated to construct a perturbed propagation path map. The directional deviation values of pixels in the perturbed propagation path map are extracted to construct a directional offset intensity matrix. The length of the path segment and the mean of the pixel values of all its pixels in the saliency distribution map are calculated as the propagation weight of the path segment. The path weight is set, and the directional offset intensity of all path segments is weighted and calculated with the propagation weight to generate a directional difference response map.
[0053] The directional residual intensity matrix is normalized and then multiplied with the propagation path weight matrix and normalized again to obtain a residual map. The directional difference distribution map is used to characterize the degree of damage to the overall texture direction consistency of the wallpaper. The residual map is used for subsequent defect area extraction and judgment.
[0054] It should be further explained that, in the specific implementation process, the process of analyzing the texture saliency distribution map and residual map, calculating the regional saliency score based on the orientation difference distribution map, establishing a regional scoring matrix, and generating the wallpaper defect confidence distribution map and defect classification image output set based on the regional scoring matrix is as follows:
[0055] The texture saliency distribution map and the residual map are aligned with pixel coordinates in the image coordinate space to construct an initial defect response map. Each pixel value in the initial defect response map is a weighted combination of texture saliency value and orientation residual value, which is used to represent the degree of local texture change and orientation perturbation at the pixel.
[0056] The gradient direction in the neighborhood of each pixel is calculated based on the initial defect response map, and the gradient direction deviation between adjacent pixels is judged. When the gradient direction deviation is less than the set gradient deviation threshold, the pixel pair is marked as a gradient connected pixel pair. The gradient connected pixel pairs of the entire image are marked as connected components to obtain a gradient connected region set. The gradient connected region set is used to represent regions in the image with consistent texture direction and continuous structure.
[0057] By combining the directional deviation of each pixel in the directional difference distribution map, the average saliency value, average directional deviation, and gradient connectivity ratio within each gradient connected region are calculated to obtain the corresponding region saliency score. The region saliency score is used to describe the stability of the texture structure and the degree of directional perturbation within the region.
[0058] The region saliency scores of all regions are mapped to a two-dimensional matrix with the same size as the input image according to their spatial coordinates to generate a region scoring matrix. Each matrix cell of the region scoring matrix records the region saliency score of the corresponding location.
[0059] The region scoring matrix is normalized and mean filtering is performed between adjacent matrix units to generate a wallpaper defect confidence distribution map. The wallpaper defect confidence distribution map is a two-dimensional matrix with the same size as the input image, and each pixel value represents the confidence probability that it belongs to the defect region.
[0060] Based on the regions with confidence probabilities higher than a set confidence threshold in the wallpaper defect confidence distribution map, the region contours are extracted, and the mean grayscale, texture variance, and orientation consistency index within the region are calculated. The orientation consistency index is calculated based on the angular difference between the principal direction of each pixel within the region and the average principal direction, referring to the degree of concentration or dispersion of the principal directions of all pixels within a region in the orientation space, generating feature vectors. The feature vectors are input into a classifier to determine the defect category, and defect mask images for cracks, holes, and stains are output according to a preset classification model. The defect mask images are combined to form a defect classification image output set, which includes the location identifier of each type of defect in the wallpaper image space and the corresponding confidence value.
[0061] Example 2: The wallpaper defect detection system based on machine vision proposed in this invention is applied to the wallpaper defect detection method based on machine vision described in Example 1. Specifically, it includes a management center, which is communicatively connected to an image acquisition and analysis module, an image processing module, an image orientation analysis module, and a defect detection module.
[0062] The image acquisition and analysis module is used to analyze the acquired wallpaper image data to be detected, obtain regional texture variance, edge density and brightness gradient indices, and generate a set of scale image layers; extract significant edge points in the images at each scale and generate a set of edge anchor points.
[0063] The image processing module performs multi-directional sliding window analysis on the set of scale image layers and the set of edge anchor points, calculates the local texture information entropy and gray-level co-occurrence matrix eigenvalues, obtains the texture difference index of each window, analyzes based on the set of edge anchor points, and generates a set of texture feature maps; it then performs local contrast enhancement on the set of texture feature maps to generate a texture saliency distribution map.
[0064] The image orientation analysis module is used to extract the main orientation distribution of each pixel's neighborhood based on the texture saliency distribution map, calculate the neighborhood orientation deviation value and orientation gradient difference, and construct an orientation residual model based on the orientation consistency change between adjacent regions to generate a residual map and an orientation difference distribution map.
[0065] The defect detection module is used to analyze the texture saliency distribution map and residual map, calculate the regional saliency score based on the orientation difference distribution map, establish a regional scoring matrix, and generate a wallpaper defect credibility distribution map and defect classification image output set based on the regional scoring matrix.
[0066] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited thereto. Various changes can be made within the scope of knowledge possessed by those skilled in the art without departing from the spirit of the present invention.
Claims
1. A method for detecting wallpaper defects based on machine vision, characterized in that, Includes the following steps: S1. Analyze the acquired wallpaper image data to be detected, obtain the regional texture variance, edge density and brightness gradient indices, and generate a set of scale image layers; extract significant edge points in the images at each scale and generate a set of edge anchor points. S2. Perform multi-directional sliding window analysis on the set of scale image layers and the set of edge anchor points, calculate the local texture information entropy and gray-level co-occurrence matrix eigenvalues, obtain the texture difference index of each window, analyze based on the set of edge anchor points, and generate a set of texture feature maps; perform local contrast enhancement on the set of texture feature maps to generate a texture saliency distribution map. S3. Based on the texture saliency distribution map, extract the main orientation distribution of each pixel's neighborhood, calculate the neighborhood orientation deviation value and orientation gradient difference, and construct an orientation residual model based on the orientation consistency change between adjacent regions, generating a residual map and an orientation difference distribution map, including: Based on the texture saliency distribution map, the set of main directions of the local neighborhood of each pixel is extracted. The absolute value of the difference between the main direction of the current pixel and the average main direction of the neighborhood is calculated and denoted as the direction deviation value. The direction deviation value is combined with the gradient direction change rate of the neighboring pixels to establish a direction function. The direction residual function is defined according to the direction deviation output by the direction function, and the direction residual intensity matrix is generated according to the value distribution of the direction residual function in the image space. The direction residual intensity matrix is normalized and smoothed to construct a direction residual model. The output of the direction residual model is mapped to a visual residual map. The direction difference distribution map is generated based on the direction deviation statistics in the direction residual model. The generation process of the residual map and the orientation difference distribution map includes: Using the directional residual intensity matrix generated in the directional residual model, high-intensity residual regions are extracted based on a set residual response threshold. For each high-intensity residual region, the connected region area, boundary contour length, and centroid position are calculated to construct a set of perturbation regions. Contour point sequences are extracted from this set, and the variation amplitude of the contour point normal vector direction is analyzed. The irregularity index of the perturbation contour is calculated, and pixels with the largest local directional deviation value and whose boundary irregularity index exceeds a set irregularity threshold are selected as candidate perturbation center points. The candidate perturbation center point with the largest directional deviation value is selected as the perturbation center point. Starting from the perturbation center point, the directional... For propagation, if the difference in principal direction between consecutive pixels is less than a set direction difference threshold, and the grayscale value of the corresponding texture saliency distribution map is greater than a preset grayscale threshold, a perturbation propagation path is constructed. These perturbation propagation paths are then integrated to construct a perturbation propagation path map. The direction deviation values of pixels within the perturbation propagation path map are extracted to construct a direction offset intensity matrix. The length of each path segment and the mean of its pixel values in the saliency distribution map are calculated as the propagation weight of the path segment. Path weights are set, and the direction offset intensity of all path segments is analyzed in relation to the propagation weights to generate a direction difference response map. The direction residual intensity matrix is processed and analyzed with the propagation path weight matrix to obtain a residual map. S4. Analyze the texture saliency distribution map and residual map, calculate the regional saliency score based on the orientation difference distribution map, establish the regional scoring matrix, and generate the wallpaper defect credibility distribution map and defect classification image output set based on the regional scoring matrix.
2. The wallpaper defect detection method based on machine vision according to claim 1, characterized in that, The acquired wallpaper image data to be detected is analyzed to obtain regional texture variance, edge density and brightness gradient indices, and a set of scale image layers is generated. The process of extracting significant edge points and generating a set of edge anchor points in images at various scales includes: Collect the wallpaper image data to be detected, and perform grayscale conversion, image denoising and brightness normalization on the wallpaper image data; Based on the brightness-normalized wallpaper image data, local gray-level statistical features are calculated using a fixed-size sliding window as a unit to obtain the regional texture variance; the gradient components of the wallpaper image data in the horizontal and vertical directions are calculated based on the Sobel operator, and the square root of the sum of squares of the horizontal and vertical gradient components is calculated to obtain the gradient magnitude map; the edge density is calculated based on the ratio of the number of non-zero pixels in the gradient magnitude map to the area of the fixed sliding window region; the gradient magnitude map is then normalized to obtain the brightness gradient intensity index. By combining regional texture variance, edge density, and brightness gradient intensity indices, the wallpaper image data is scaled proportionally and filtered through multiple levels using a Gaussian pyramid method to construct a set of scale image layers. In each scale image layer, the edge response intensity is detected using the Sobel operator and non-maximum suppression algorithm, and local significant edge points are screened using a high and low dual threshold method to generate an edge response map. Based on the edge response map, the pixels at the geometric center of the connected region are extracted as candidate edge points, and the two-dimensional image coordinates of each candidate edge point in its corresponding scale image layer are recorded. An edge anchor point set is generated based on the set edge intensity threshold.
3. The wallpaper defect detection method based on machine vision according to claim 2, characterized in that, The process of performing multi-directional sliding window analysis on the set of scale image layers and the set of edge anchor points, calculating the local texture information entropy and gray-level co-occurrence matrix eigenvalues, obtaining the texture difference index of each window, and generating a set of texture feature maps based on the set of edge anchor points includes: For each scale image in the scale image layer set, a multi-directional oblique sliding window is used for acquisition. The local texture information entropy is calculated based on each image sub-block. The local texture information entropy is calculated based on the image gray-level distribution histogram. A gray-level co-occurrence matrix is constructed based on the image sub-blocks, and matrix feature values are extracted from the gray-level co-occurrence matrix. The local texture information entropy and matrix eigenvalues at each sliding window position are combined sequentially to form a texture feature vector. A texture difference index set containing texture feature vectors at all window positions is constructed. Based on the positional correspondence of anchor points in the edge anchor point set at different scales, the texture difference index set is scale-space registered to obtain a texture feature map set at a unified scale.
4. The wallpaper defect detection method based on machine vision according to claim 3, characterized in that, The process of locally enhancing the contrast of a texture feature map set to generate a texture saliency distribution map is as follows: Local contrast enhancement is performed on each texture feature map. Local contrast enhancement refers to calculating the pixel mean, standard deviation, and local extreme value difference within the neighborhood window of each pixel. A contrast enhancement mapping function is constructed based on the local extreme value of each pixel to adjust the pixel-level grayscale mapping of the original texture feature map. The texture feature map after local contrast enhancement is normalized and edge smoothed to obtain a texture saliency distribution map.
5. The wallpaper defect detection method based on machine vision according to claim 4, characterized in that, The process of analyzing the texture saliency distribution map and residual map, calculating the region saliency score based on the orientation difference distribution map, establishing a region scoring matrix, and generating a wallpaper defect confidence distribution map and defect classification image output set based on the region scoring matrix includes: Align the pixel coordinates of the texture saliency distribution map and the residual map in the image coordinate space to construct an initial defect response map; calculate the gradient direction in the neighborhood of each pixel based on the initial defect response map, and mark the pixel pair as a gradient connected pixel pair when the gradient direction deviation value is less than a set gradient deviation threshold; mark the connected components of the gradient connected pixel pairs in the entire image to obtain a set of gradient connected regions. By combining the directional deviation of each pixel in the directional difference distribution map, the average saliency value, average directional deviation, and gradient connectivity ratio within each gradient connected region are calculated to obtain a region saliency score. The region saliency scores of all regions are mapped to a two-dimensional matrix with the same size as the input image using spatial coordinates to generate a region scoring matrix. The region scoring matrix is normalized, and mean filtering is performed between adjacent matrix units to generate a wallpaper defect confidence distribution map. The wallpaper defect confidence distribution map is a two-dimensional matrix with the same size as the input image, where each pixel value represents the confidence probability of belonging to a defect region. Based on regions in the wallpaper defect confidence distribution map with confidence probabilities higher than a set confidence threshold, region contours are extracted, and the gray-level mean, texture variance, and directional consistency index within the region are calculated to generate feature vectors. The feature vectors are used to determine the defect category, and defect mask images for cracks, holes, and stains are output according to a preset classification model. These defect mask images are combined to form a defect classification image output set.
6. A machine vision-based wallpaper defect detection system, specifically applied to the machine vision-based wallpaper defect detection method according to any one of claims 1 to 5, comprising a management center, characterized in that, The management center's communication connections include an image acquisition and analysis module, an image processing module, an image orientation analysis module, and a defect detection module. The image acquisition and analysis module is used to analyze the acquired wallpaper image data to be detected, obtain regional texture variance, edge density and brightness gradient indices, and generate a set of scale image layers; extract significant edge points in the images at each scale and generate a set of edge anchor points. The image processing module is used to perform multi-directional sliding window analysis on the set of scale image layers and the set of edge anchor points, calculate the local texture information entropy and gray-level co-occurrence matrix eigenvalues, obtain the texture difference index of each window, analyze based on the set of edge anchor points, generate a set of texture feature maps, and perform local contrast enhancement on the set of texture feature maps to generate a texture saliency distribution map. The image orientation analysis module is used to extract the main orientation distribution of each pixel's neighborhood based on the texture saliency distribution map, calculate the neighborhood orientation deviation value and orientation gradient difference, and construct an orientation residual model based on the orientation consistency change between adjacent regions to generate a residual map and an orientation difference distribution map. The defect detection module is used to analyze the texture saliency distribution map and residual map, calculate the regional saliency score based on the orientation difference distribution map, establish a regional scoring matrix, and generate a wallpaper defect credibility distribution map and defect classification image output set based on the regional scoring matrix.
Citation Information
Patent Citations
Complicated jacquard defect detecting method based on deep learning
CN105654121A
A method for detecting and recognizing wallpaper defects based on OTSU and GA-BP neural network
CN109242848A