A surface defect detection system and method for artificial quartz stone slabs
By decomposing the image of artificial quartz stone slabs into global background, local texture, and defect parts, and combining the CIELAB color space and anisotropy, the problem of existing detection methods misjudging texture as defects is solved, achieving high accuracy and high reliability in defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MACHENG ZHONGLEI NEW BUILDING MATERIALS CO LTD
- Filing Date
- 2025-10-23
- Publication Date
- 2026-06-23
Smart Images

Figure CN121329945B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of defect detection, specifically relating to a system and method for detecting surface defects in artificial quartz stone slabs. Background Technology
[0002] During the production of artificial quartz stone slabs, fluctuations in raw material ratios, pressing processes, and surface polishing inevitably lead to various defects on the surface, such as blemishes, impurities, scratches, and cracks. With the development of machine vision technology, automated inspection methods are gradually replacing traditional manual inspection. Currently, mainstream methods primarily include those based on statistics, spectral analysis, and deep learning. However, the surface texture of artificial quartz stone slabs is complex and varied, with the background itself containing numerous granular structures and detailed textures. These detailed textures are difficult to distinguish from certain defects in terms of color, shape, and other features, posing challenges to defect segmentation and identification.
[0003] While deep learning methods demonstrate high detection accuracy in many scenarios, they typically rely on training with a large number of finely labeled defect samples, which is costly to collect and label. Furthermore, existing models still need improvement in generalization ability and their ability to detect unknown types of defects.
[0004] Low-rank matrix factorization (LGF) theory offers a novel approach to solving this problem. The basic idea is that a normal, defect-free board surface image, due to the repetitiveness and structure of its texture, can be approximated as a low-rank matrix; while defects, as localized anomalies, correspond to a sparse matrix. By decomposing the acquired image matrix into the sum of a low-rank background matrix and a sparse defect matrix, preliminary extraction of the defect region can be achieved. However, the background of actual boards is not a single smooth region, but rather composed of a global color base and complex local textures. A single low-rank constraint cannot accurately represent these two different scale background components simultaneously, easily leading to some complex textures being misjudged as defects.
[0005] Furthermore, the texture on the board surface is not uniformly distributed; the texture complexity (or anisotropy) varies in different regions. Low-rank models fail to fully utilize this prior information, imposing the same constraints on all regions and reducing the model's adaptability to different background regions. After extracting potential defect regions from the sparse matrix, distinguishing between real defects and pseudo-defects caused by background residue or noise is also crucial for improving detection accuracy. Summary of the Invention
[0006] This invention provides a surface defect detection system and method for artificial quartz stone slabs to solve the technical problem that existing detection methods easily misjudge normal textures as defects.
[0007] In a first aspect, the present invention provides a surface defect detection system for artificial quartz stone slabs, comprising:
[0008] The acquisition module acquires a color image of the board surface and converts it to the CIELAB color space; it extracts the color components of each pixel in the CIELAB color space, calculates the local structure tensor of the pixel to obtain the degree of anisotropy, combines the color components and the degree of anisotropy into multidimensional features, and arranges the multidimensional features of all pixels into an observation matrix.
[0009] A construction module is used to establish a joint optimization model, which decomposes the observation matrix into a linear superposition of a global background low-rank matrix, a local texture low-rank matrix, and a defect sparse matrix. The objective function of the joint optimization model includes a kernel norm term constraining the global background low-rank matrix, a weighted kernel norm term constraining the local texture low-rank matrix, and an L1 norm term constraining the defect sparse matrix. The weights of the weighted kernel norm term are positively correlated with the local mean of the anisotropy degree.
[0010] The extraction module, based on the defect sparse matrix obtained by solving the joint optimization model, generates a preliminary defect map through threshold segmentation, performs connected component analysis on the preliminary defect map, and extracts multiple candidate defect connected components; it calculates the area, aspect ratio of the bounding rectangle, average color difference, and average anisotropy of each candidate defect connected component.
[0011] The determination module adaptively determines the area threshold and color difference threshold based on the average anisotropy of each candidate defect connected region. When the aspect ratio of the bounding rectangle of a candidate defect connected region is greater than the preset aspect ratio threshold, and the area is greater than the area threshold and / or the average color difference is greater than the color difference threshold, the candidate defect connected region is determined to be a surface defect of the board.
[0012] Furthermore, the local structure tensor of the pixel is calculated to obtain the degree of anisotropy, including:
[0013] L in the CIELAB color space * Calculate the gradient vector of each pixel (x, y) in the channel image. ;
[0014] Centered on a pixel, a local neighborhood window of size 5×5 is selected. The average value of the outer product of the gradients of all pixels within the local neighborhood window is calculated to obtain a 2×2 structure tensor J.
[0015] Eigenvalue decomposition of the structure tensor J yields two eigenvalues. and ,and ;
[0016] Through formula Calculate the anisotropy degree A of the pixel, where It is a value of 10 -6 The constant.
[0017] Furthermore, a joint optimization model is established, the specific model of which is as follows: , ;
[0018] Where D is the observation matrix, B is the global background low-rank matrix, T is the local texture low-rank matrix, and E is the defect sparsity matrix. Represents the nuclear norm. Represents the weighted norm. Describing the L1 norm, This is the regularization parameter, and its value is set to... , where m and n are the number of rows and columns of the observation matrix D.
[0019] Furthermore, the weights of the weighted norm terms are specifically calculated as follows:
[0020] Reconstruct the anisotropy level map by using a one-dimensional vector composed of the anisotropy levels of all pixels, resulting in an anisotropy level map with the same size as the original image. ;
[0021] Anisotropy level diagram For each pixel in the image, mean filtering is used to calculate the mean value of the pixel within a 9×9 neighborhood. ;
[0022] The weight With the local mean Proportional, the calculation formula is: ,in It is a value of 10 -6 The constant.
[0023] Further, a preliminary defect map is generated through threshold segmentation, including:
[0024] For the defect sparse matrix E, calculate the L2 norm of the multidimensional feature vector corresponding to each pixel, and rearrange the L2 norm values to form a grayscale image with the same size as the original image. ;
[0025] The grayscale image was analyzed using the Otsu's method. Perform calculations to automatically determine the global segmentation threshold. ;
[0026] grayscale image Medium pixel value greater than The pixel value is set to 255, and the rest of the pixels are set to 0 to generate a preliminary binarized defect image.
[0027] Furthermore, the calculation of the average color difference includes:
[0028] A morphological dilation operation of 5 pixels is performed on the candidate defect connected region, and the original candidate defect connected region is subtracted from the dilated region to obtain a ring-shaped background region.
[0029] In the CIELAB color space, calculate the L value of all pixels within the background region. * a * b * arithmetic mean of three components ;
[0030] Calculate each pixel within the candidate defect connected region Average color of the background CIE2000 color difference values between ;
[0031] Connect all pixels within the candidate defect connected region. The arithmetic mean is used to obtain the average color difference of the candidate defect connected domain.
[0032] Furthermore, the area threshold and color difference threshold are adaptively determined, including:
[0033] The average anisotropy of the candidate defect connected components is set as follows: ;
[0034] Area threshold Determined by the following function: ;
[0035] Color difference threshold Determined by the following function: .
[0036] Secondly, the present invention provides a method for detecting surface defects in artificial quartz stone slabs, comprising:
[0037] S1. Obtain the surface color image of the board and convert it to the CIELAB color space; extract the color component of each pixel in the CIELAB color space, calculate the local structure tensor of the pixel to obtain the degree of anisotropy, combine the color component and the degree of anisotropy into a multidimensional feature, and arrange the multidimensional features of all pixels into an observation matrix.
[0038] S2. A joint optimization model is established, which decomposes the observation matrix into a linear superposition of a global background low-rank matrix, a local texture low-rank matrix, and a defect sparse matrix. The objective function of the joint optimization model includes a kernel norm term constraining the global background low-rank matrix, a weighted kernel norm term constraining the local texture low-rank matrix, and an L1 norm term constraining the defect sparse matrix. The weights of the weighted kernel norm term are positively correlated with the local mean of the anisotropy degree.
[0039] S3. Based on the defect sparse matrix obtained by solving the joint optimization model, a preliminary defect map is generated by threshold segmentation. Connectivity analysis is performed on the preliminary defect map to extract multiple candidate defect connected regions. The area, aspect ratio of the bounding rectangle, average color difference, and average anisotropy of each candidate defect connected region are calculated.
[0040] S4. Based on the average anisotropy of each candidate defect connected region, adaptively determine the area threshold and color difference threshold; when the aspect ratio of the circumscribed rectangle of a candidate defect connected region is greater than the preset aspect ratio threshold, and the area is greater than the area threshold and / or the average color difference is greater than the color difference threshold, then the candidate defect connected region is determined to be a surface defect of the board.
[0041] Furthermore, the local structure tensor of the pixel is calculated to obtain the degree of anisotropy, including:
[0042] L in the CIELAB color space * Calculate the gradient vector of each pixel (x, y) in the channel image. ;
[0043] Centered on a pixel, a local neighborhood window of size 5×5 is selected. The average value of the outer product of the gradients of all pixels within the local neighborhood window is calculated to obtain a 2×2 structure tensor J.
[0044] Eigenvalue decomposition of the structure tensor J yields two eigenvalues. and ,and ;
[0045] Through formula Calculate the anisotropy degree A of the pixel, where It is a value of 10 -6 The constant.
[0046] Furthermore, a joint optimization model is established, the specific model of which is as follows: , ;
[0047] Where D is the observation matrix, B is the global background low-rank matrix, T is the local texture low-rank matrix, and E is the defect sparsity matrix. Represents the nuclear norm. Represents the weighted norm. Describing the L1 norm, This is the regularization parameter, and its value is set to... , where m and n are the number of rows and columns of the observation matrix D.
[0048] The beneficial effects are as follows: This invention constructs a feature representation by combining CIELAB color components, which can represent color information, with the degree of anisotropy, which reflects the texture structure characteristics, thereby enhancing the ability to distinguish between defects and complex backgrounds. This invention proposes an improved dual low-rank decomposition model, which explicitly decomposes the board image into three parts: global background, local texture, and defects. The dual low-rank decomposition model structure can accurately separate and model smooth global substrates and complex local granular textures, reducing the misclassification of normal textures as defects and lowering the false alarm rate. Simultaneously, the weighted nuclear norm constraint applied to the local texture matrix in the model utilizes anisotropy information to apply different constraint strengths to different regions, better preserving background texture details and improving the fidelity of background reconstruction and the accuracy of defect separation. In the defect screening stage, multiple geometric and physical features such as area, aspect ratio, and color difference are comprehensively utilized, and screening criteria are obtained based on the texture characteristics of the candidate regions themselves. This reduces false defects caused by noise or background residue, ensuring high accuracy and reliability of the detection results. Attached Figure Description
[0049] Figure 1 A schematic diagram of a surface defect detection system for artificial quartz stone slabs;
[0050] Figure 2 This is a schematic diagram of color space conversion. Detailed Implementation
[0051] Embodiments of the surface defect detection system for artificial quartz stone slabs provided by the present invention:
[0052] like Figure 1 As shown, a surface defect detection system for artificial quartz stone slabs includes:
[0053] The acquisition module acquires a color image of the board surface and converts it to the CIELAB color space; it extracts the color components of each pixel in the CIELAB color space, calculates the local structure tensor of the pixel to obtain the degree of anisotropy, combines the color components and the degree of anisotropy into multidimensional features, and arranges the multidimensional features of all pixels into an observation matrix.
[0054] A camera equipped with a uniform strip LED light source is mounted above the production line to scan the moving sheet material at a constant speed, capturing distortion-free RGB format surface color images. Using a standard color space conversion formula, the acquired RGB format surface color image is first converted to the XYZ color space, and then from the XYZ color space to the CIELAB color space, resulting in an image containing three color components: L, a, and b. The L component represents luminance, and the a and b components represent color information, such as... Figure 2 As shown.
[0055] In an optional embodiment, calculating the local structure tensor of a pixel to obtain the degree of anisotropy includes:
[0056] L in the CIELAB color space * Calculate the gradient vector of each pixel (x, y) in the channel image. ;
[0057] Centered on a pixel, a local neighborhood window of size 5×5 is selected. The average value of the outer product of the gradients of all pixels within the local neighborhood window is calculated to obtain a 2×2 structure tensor J.
[0058] Eigenvalue decomposition of the structure tensor J yields two eigenvalues. and ,and ;
[0059] Through formula Calculate the anisotropy degree A of the pixel, where It is a value of 10 -6 The constant.
[0060] The first step is to use L which only contains brightness information * Operations are performed on the channel image, for L * For any pixel in the channel image, such as the pixel with coordinates (100, 150), calculate the gradient in the horizontal direction using gradient operators such as the Sobel operator. and the gradient in the vertical direction Assuming the calculation yields... It is 50. If the value is 20, then the gradient vector of that pixel is (50, 20). The gradient vector represents the direction and intensity of the fastest change in the pixel's brightness.
[0061] Centered on pixel (100, 150), a 5×5 neighborhood of 25 pixels is defined. For each of these 25 pixels, the gradient calculation is repeated, resulting in 25 gradient vectors. For each gradient vector, the outer product of these gradient vectors is calculated, resulting in a 2×2 matrix. For example, for the gradient vector at center (50, 20), the outer product matrix has rows (2500, 1000) and rows (1000, 400). These 25 outer product matrices are summed element-wise and averaged to obtain a 2×2 structure tensor J. This structure tensor J represents the dominant gradient distribution direction and intensity within the local neighborhood.
[0062] Eigenvalue decomposition of the structure tensor J yields two eigenvalues. and ,make sure Greater than or equal to The two eigenvalues represent the energy of the gradient in the two principal directions. For example, it is calculated that... It is 2800. The value is 100. The anisotropy level A is calculated using the formula, and the result is approximately 0.93. An A value close to 1 indicates that there is a very strong directional texture in the local region, while an A value close to 0 indicates that the region is flat or isotropic.
[0063] A construction module is used to establish a joint optimization model, which decomposes the observation matrix into a linear superposition of a global background low-rank matrix, a local texture low-rank matrix, and a defect sparse matrix. The objective function of the joint optimization model includes a kernel norm term constraining the global background low-rank matrix, a weighted kernel norm term constraining the local texture low-rank matrix, and an L1 norm term constraining the defect sparse matrix. The weights of the weighted kernel norm term are positively correlated with the local mean of the anisotropy degree.
[0064] In an optional embodiment, a joint optimization model is established, the specific model of which is as follows: , ;
[0065] Where D is the observation matrix, B is the global background low-rank matrix, T is the local texture low-rank matrix, and E is the defect sparsity matrix. Represents the nuclear norm. Represents the weighted norm. Describing the L1 norm, This is the regularization parameter, and its value is set to... , where m and n are the number of rows and columns of the observation matrix D.
[0066] Assuming the input is a CIELAB color image of size 200×300 pixels, with L * a * b * The image from each of the three channels is unfolded into a one-dimensional vector of length 60,000. These three vectors are then stacked as columns to form a 60,000-row, 3-column matrix, which is the observation matrix D. Therefore, D has 60,000 rows (m) and 3 columns (n).
[0067] The goal of the joint optimization model is to decompose the observation matrix D into the sum of three parts: background, texture, and defects. The background is the overall background of the image, typically a region with smooth color and structure, and can therefore be represented by a low-rank matrix. The joint optimization model enforces low rank by minimizing the kernel norm of the global background low-rank matrix. Texture represents repetitive, directional local textures in the image, such as patterns, and can also be represented by a low-rank matrix. Low rank is enforced by minimizing the weighted kernel norm of the local texture low-rank matrix, where the weights are adjusted according to the saliency of the texture. Defects represent imperfections in the image, such as stains or damage. These defects typically occupy only a small portion of the image and are a sparse matrix. The model ensures sparsity by minimizing the L1 norm of the defect sparse matrix, meaning that most elements in the matrix are zero.
[0068] The minimization problem is solved using an optimization algorithm (such as the alternating direction multiplier method). Parameters This is used to balance the sparsity of defects and the accuracy of decomposition. In the example, m is 60000 and n is 3. It is approximately 0.004. Iterative solutions are used to obtain the optimal B, T, and E matrices, where the E matrix contains the detected defect information.
[0069] In an optional embodiment, the calculation process of the weights of the weighted norm terms includes:
[0070] Reconstruct the anisotropy level map by using a one-dimensional vector composed of the anisotropy levels of all pixels, resulting in an anisotropy level map with the same size as the original image. ;
[0071] Anisotropy level diagram For each pixel in the image, mean filtering is used to calculate the mean value of the pixel within a 9×9 neighborhood. ;
[0072] The weight With the local mean Proportional, the calculation formula is: ,in It is a value of 10 -6 constants
[0073] The anisotropy level A value for each pixel is calculated using the steps described above. Assuming the original image is 200×300 pixels, this yields 60,000 A values. These A values are then rearranged according to the spatial location of the pixels in the original image to form a 200×300 single-channel image, i.e., the anisotropy level map. In this image, the grayscale value of a pixel directly corresponds to the degree of anisotropy, and textured areas will appear brighter.
[0074] To make the weight distribution smoother, The graph is subjected to mean filtering. For each pixel in the image, for example, the point with coordinates (50, 80), a 9×9 neighborhood window is taken centered on it. The neighborhood window covers 81 pixels from (46, 76) to (54, 84). The 81 pixels are then read... Calculate the arithmetic mean of the anisotropy values in the graph. Assuming the calculated mean is 0.65, this value is assigned as the local mean of the point (50, 80). .right This process is repeated for all pixels to obtain a smoothed local mean map.
[0075] Based on local mean To calculate weights For the pixels in the example, the weights It is 0.650001. Weight The weighted kernel norm term is used to adjust the constraints on the local texture low-rank matrix T. In regions where the texture is salient, the values of A and... The value will be higher, imposing a stronger constraint on the low-rank property of T, allowing the textured parts to be separated more accurately.
[0076] The extraction module, based on the defect sparse matrix obtained by solving the joint optimization model, generates a preliminary defect map through threshold segmentation, performs connected component analysis on the preliminary defect map, and extracts multiple candidate defect connected components; it calculates the area, aspect ratio of the bounding rectangle, average color difference, and average anisotropy of each candidate defect connected component.
[0077] In an optional embodiment, a preliminary defect map is generated by threshold segmentation, including:
[0078] For the defect sparse matrix E, calculate the L2 norm of the multidimensional feature vector corresponding to each pixel, and rearrange the L2 norm values to form a grayscale image with the same size as the original image. ;
[0079] The grayscale image was analyzed using the Otsu's method. Perform calculations to automatically determine the global segmentation threshold. ;
[0080] grayscale image Medium pixel value greater than The pixel value is set to 255, and the rest of the pixels are set to 0 to generate a preliminary binarized defect image.
[0081] After model optimization, a defect sparse matrix E is obtained. Assuming the original image is 200×300 pixels, E is a 60,000-row, 3-column matrix. Each row of the matrix corresponds to a pixel in the original image, and the three column values represent the defect components of the pixel in the L*, a*, and b* color channels, respectively. For example, the data in the i-th row might be -15, 22, and 8, representing the defect feature vector of the i-th pixel. The L2 norm of this vector is calculated, yielding a scalar value of approximately 28.1. This process is repeated for all 60,000 rows of matrix E, resulting in 60,000 L2 norm values. These values are then rearranged into a 200×300 grayscale image, serving as the defect saliency map. .
[0082] After obtaining the defect saliency map, a threshold is needed to convert it into a black-and-white binary image to clearly mark the defect areas. The Otsu's method (maximum inter-class variance method) is used to automatically determine the threshold. Specifically, the analysis... The algorithm plots a histogram of grayscale values for all pixels and calculates a grayscale threshold that optimally classifies all pixels into foreground and background classes. The optimal threshold maximizes the variance between the two classes of pixels after segmentation. For example, after analyzing the saliency map, the algorithm might determine the optimal global segmentation threshold. The grayscale value is 50. Iterate through... For each pixel in the image, the pixel grayscale value is compared with the calculated threshold. The comparison is performed. If a pixel's grayscale value is greater than 50, the pixel's position is set to 255 (white) in the preliminary defect map. If a pixel's grayscale value is less than or equal to 50, the pixel's position is set to 0 (black). Through this process, a binarized preliminary defect map is generated, where white areas represent detected candidate defect connected components.
[0083] In an optional embodiment, the calculation of the average color difference includes:
[0084] A morphological dilation operation of 5 pixels is performed on the candidate defect connected region, and the original candidate defect connected region is subtracted from the dilated region to obtain a ring-shaped background region.
[0085] In the CIELAB color space, calculate the L value of all pixels within the background region. * a * b * arithmetic mean of three components ;
[0086] Calculate each pixel within the candidate defect connected region Average color of the background CIE2000 color difference values between ;
[0087] Connect all pixels within the candidate defect connected region. The arithmetic mean is used to obtain the average color difference of the candidate defect connected domain.
[0088] To accurately assess the color difference between the connected component and the surrounding background, a background region adjacent to the defect is defined. The shape of the connected component is then morphologically dilated, expanding its boundary outwards by 5 pixels to form a larger region. From this expanded region, the original connected component is removed, leaving a 5-pixel-wide annular region surrounding the original defect. This annular region serves as the local background of the defect.
[0089] Calculate the average color of the local background region. Returning to the original CIELAB image, extract the color values of all pixels located within the annular background region. Assuming this region contains 1000 pixels, calculate the L value of these 1000 pixels. * Add all the values together and then divide by 1000 to get the average brightness. Similarly, the average a is calculated. * value and b * value This yields a three-dimensional color vector representing the average color of the local background. For example, the calculation result might be 70, 5, or -10.
[0090] Calculate the average color difference between all pixels within the defect region and the average color of the background. For each pixel i within the connected component of the candidate defect, obtain the pixel's CIELAB color value. , , The CIE2000 color difference formula is used to calculate the pixel color and the average background color. Perceived color difference value between It can better simulate the color perception of the human eye. It calculates the color values of all pixels within the connected region. The values are added together and then divided by the total number of pixels in the connected region to obtain the average color difference of the candidate defective connected region.
[0091] The determination module adaptively determines the area threshold and color difference threshold based on the average anisotropy of each candidate defect connected region. When the aspect ratio of the bounding rectangle of a candidate defect connected region is greater than the preset aspect ratio threshold, and the area is greater than the area threshold and / or the average color difference is greater than the color difference threshold, the candidate defect connected region is determined to be a surface defect of the board.
[0092] In an optional embodiment, adaptively determining the area threshold and color difference threshold includes:
[0093] The average anisotropy of the candidate defect connected components is set as follows: ;
[0094] Area threshold Determined by the following function: ;
[0095] Color difference threshold Determined by the following function: .
[0096] Based on the texture characteristics of the region where each candidate defect is located, the screening criteria used to determine whether a region is a true defect are adjusted. The first step is to calculate the average anisotropy of a connected component of a candidate defect. Find all pixels that constitute the connected region. In the previously calculated anisotropy map, query and accumulate the anisotropy values A corresponding to these pixels, and divide by the total number of pixels in the connected region to obtain the area. For example, the average anisotropy of a candidate defect region... The calculated value is 0.4, indicating that the region has a certain degree of texture features.
[0097] The second step is to calculate the The values are substituted into two preset functions to calculate the region-specific area threshold and color difference threshold, respectively. In the example, The value is 0.4, and the calculated result is equal to 10, which is the area threshold for candidate defects. It is 10. (Regarding the color difference threshold) Substituting 0.4 into the calculation, the result is 7, which is the color difference threshold. The threshold is 7. The actual area and average color difference of the candidate defect are compared to two adaptively calculated thresholds. If the actual area of the candidate defect is less than 10 and / or the average color difference is less than 7, it is judged as a pseudo-defect caused by the background texture and filtered out. Conversely, a true defect is defined as one where both the area is greater than or equal to 10 and the average color difference is greater than or equal to 7. For regions with complex textures... In areas with high values, the threshold will adaptively decrease, allowing smaller defects or less noticeable color differences to be detected; while in flat areas... In areas with low values, the threshold will be higher to avoid misjudging minute background noise as defects.
[0098] An embodiment of the surface defect detection method for artificial quartz stone slabs provided by the present invention:
[0099] A method for detecting surface defects in artificial quartz stone slabs, comprising:
[0100] S1. Obtain the surface color image of the board and convert it to the CIELAB color space; extract the color component of each pixel in the CIELAB color space, calculate the local structure tensor of the pixel to obtain the degree of anisotropy, combine the color component and the degree of anisotropy into a multidimensional feature, and arrange the multidimensional features of all pixels into an observation matrix.
[0101] S2. A joint optimization model is established, which decomposes the observation matrix into a linear superposition of a global background low-rank matrix, a local texture low-rank matrix, and a defect sparse matrix. The objective function of the joint optimization model includes a kernel norm term constraining the global background low-rank matrix, a weighted kernel norm term constraining the local texture low-rank matrix, and an L1 norm term constraining the defect sparse matrix. The weights of the weighted kernel norm term are positively correlated with the local mean of the anisotropy degree.
[0102] S3. Based on the defect sparse matrix obtained by solving the joint optimization model, a preliminary defect map is generated by threshold segmentation. Connectivity analysis is performed on the preliminary defect map to extract multiple candidate defect connected regions. The area, aspect ratio of the bounding rectangle, average color difference, and average anisotropy of each candidate defect connected region are calculated.
[0103] S4. Based on the average anisotropy of each candidate defect connected region, adaptively determine the area threshold and color difference threshold; when the aspect ratio of the circumscribed rectangle of a candidate defect connected region is greater than the preset aspect ratio threshold, and the area is greater than the area threshold and / or the average color difference is greater than the color difference threshold, then the candidate defect connected region is determined to be a surface defect of the board.
[0104] In an optional embodiment, calculating the local structure tensor of a pixel to obtain the degree of anisotropy includes:
[0105] L in the CIELAB color space * Calculate the gradient vector of each pixel (x, y) in the channel image. ;
[0106] Centered on a pixel, a local neighborhood window of size 5×5 is selected. The average value of the outer product of the gradients of all pixels within the local neighborhood window is calculated to obtain a 2×2 structure tensor J.
[0107] Eigenvalue decomposition of the structure tensor J yields two eigenvalues. and ,and ;
[0108] Through formula Calculate the anisotropy degree A of the pixel, where It is a value of 10 -6 The constant.
[0109] In an optional embodiment, a joint optimization model is established, the specific model of which is as follows: , ;
[0110] Where D is the observation matrix, B is the global background low-rank matrix, T is the local texture low-rank matrix, and E is the defect sparsity matrix. Represents the nuclear norm. Represents the weighted norm. Describing the L1 norm, This is the regularization parameter, and its value is set to... , where m and n are the number of rows and columns of the observation matrix D.
[0111] In addition, in the description of this specification, "multiple" means at least two, such as two, three or more, etc., unless otherwise expressly and specifically defined.
Claims
1. A surface defect detection system for artificial quartz stone slabs, characterized in that, include: The acquisition module acquires a color image of the board surface and converts it to the CIELAB color space; it extracts the color components of each pixel in the CIELAB color space, calculates the local structure tensor of the pixel to obtain the degree of anisotropy, combines the color components and the degree of anisotropy into multidimensional features, and arranges the multidimensional features of all pixels into an observation matrix. A construction module is used to establish a joint optimization model, which decomposes the observation matrix into a linear superposition of a global background low-rank matrix, a local texture low-rank matrix, and a defect sparse matrix. The objective function of the joint optimization model includes a kernel norm term constraining the global background low-rank matrix, a weighted kernel norm term constraining the local texture low-rank matrix, and an L1 norm term constraining the defect sparse matrix. The weights of the weighted kernel norm term are positively correlated with the local mean of the anisotropy degree. The extraction module, based on the defect sparse matrix obtained by solving the joint optimization model, generates a preliminary defect map through threshold segmentation, performs connected component analysis on the preliminary defect map, and extracts multiple candidate defect connected components; it calculates the area, aspect ratio of the bounding rectangle, average color difference, and average anisotropy of each candidate defect connected component. The determination module adaptively determines the area threshold and color difference threshold based on the average anisotropy of each candidate defect connected region. When the aspect ratio of the bounding rectangle of a candidate defect connected region is greater than the preset aspect ratio threshold, and the area is greater than the area threshold and / or the average color difference is greater than the color difference threshold, the candidate defect connected region is determined to be a surface defect of the board.
2. The artificial quartz stone slab surface defect detection system according to claim 1, characterized in that, Calculate the local structure tensor of a pixel to obtain the degree of anisotropy, including: L in the CIELAB color space Calculate the gradient vector of each pixel (x, y) in the channel image. ; Let (x, y) be the gradient of pixel (x, y) in the horizontal direction. The gradient of pixel (x, y) in the vertical direction; Centered on a pixel, a local neighborhood window of size 5×5 is selected. The average value of the outer product of the gradients of all pixels within the local neighborhood window is calculated to obtain a 2×2 structure tensor J. Eigenvalue decomposition of the structure tensor J yields two eigenvalues. and ,and ; Through formula Calculate the anisotropy degree A of the pixel, where It is a value of 10 -6 The constant.
3. The artificial quartz stone slab surface defect detection system according to claim 1, characterized in that, Establish a joint optimization model, the specific model is as follows: , ; Where D is the observation matrix, B is the global background low-rank matrix, T is the local texture low-rank matrix, and E is the defect sparsity matrix. Represents the nuclear norm. Represents the weighted norm. Describing the L1 norm, This is the regularization parameter, and its value is set to... , where m and n are the number of rows and columns of the observation matrix D.
4. The artificial quartz stone slab surface defect detection system according to claim 3, characterized in that, The calculation process for the weights of the weighted norm terms includes: Reconstruct the anisotropy level map by using a one-dimensional vector composed of the anisotropy levels of all pixels, resulting in an anisotropy level map with the same size as the original image. ; Anisotropy level diagram For each pixel in the image, mean filtering is used to calculate the mean value of the pixel within a 9×9 neighborhood. ; The weight With the local mean Proportional, the calculation formula is: ,in It is a value of 10 -6 The constant.
5. The artificial quartz stone slab surface defect detection system according to claim 1, characterized in that, A preliminary defect map is generated through threshold segmentation, including: For the defect sparse matrix, calculate the L2 norm of the multidimensional feature vector corresponding to each pixel, and rearrange the L2 norm values to form a grayscale image with the same size as the original image. ; The grayscale image was analyzed using the Otsu's method. Perform calculations to automatically determine the global segmentation threshold. ; grayscale image Medium pixel value greater than The pixel value is set to 255, and the rest of the pixels are set to 0 to generate a preliminary binarized defect image.
6. The artificial quartz stone slab surface defect detection system according to claim 5, characterized in that, The calculation of average color difference includes: A morphological dilation operation of 5 pixels is performed on the candidate defect connected region, and the original candidate defect connected region is subtracted from the dilated region to obtain a ring-shaped background region. In the CIELAB color space, calculate the L value of all pixels within the background region. a b arithmetic mean of three components ; Calculate each pixel within the candidate defect connected region Average color of the background CIE2000 color difference values between ; Connect all pixels within the candidate defect connected region. The arithmetic mean is used to obtain the average color difference of the candidate defect connected domain.
7. The surface defect detection system for artificial quartz stone slabs according to any one of claims 1-6, characterized in that, Adaptively determine area thresholds and color difference thresholds, including: The average anisotropy of the candidate defect connected components is set as follows: ; Area threshold Determined by the following function: ; Color difference threshold Determined by the following function: .
8. A method for detecting surface defects in artificial quartz stone slabs, characterized in that, include: S1. Obtain the surface color image of the board and convert it to the CIELAB color space; extract the color component of each pixel in the CIELAB color space, calculate the local structure tensor of the pixel to obtain the degree of anisotropy, combine the color component and the degree of anisotropy into a multidimensional feature, and arrange the multidimensional features of all pixels into an observation matrix. S2. A joint optimization model is established, which decomposes the observation matrix into a linear superposition of a global background low-rank matrix, a local texture low-rank matrix, and a defect sparse matrix. The objective function of the joint optimization model includes a kernel norm term constraining the global background low-rank matrix, a weighted kernel norm term constraining the local texture low-rank matrix, and an L1 norm term constraining the defect sparse matrix. The weights of the weighted kernel norm term are positively correlated with the local mean of the anisotropy degree. S3. Based on the defect sparse matrix obtained by solving the joint optimization model, a preliminary defect map is generated by threshold segmentation. Connectivity analysis is performed on the preliminary defect map to extract multiple candidate defect connected components. Calculate the area of each candidate defect's connected region, the aspect ratio of its circumscribed rectangle, the average color difference, and the average anisotropy. S4. Based on the average anisotropy of each candidate defect connected region, adaptively determine the area threshold and color difference threshold; when the aspect ratio of the circumscribed rectangle of a candidate defect connected region is greater than the preset aspect ratio threshold, and the area is greater than the area threshold and / or the average color difference is greater than the color difference threshold, then the candidate defect connected region is determined to be a surface defect of the board.
9. The method for detecting surface defects in artificial quartz stone slabs according to claim 8, characterized in that, Calculate the local structure tensor of a pixel to obtain the degree of anisotropy, including: L in the CIELAB color space Calculate the gradient vector of each pixel (x, y) in the channel image. ; Let (x, y) be the gradient of pixel (x, y) in the horizontal direction. The gradient of pixel (x, y) in the vertical direction; Centered on a pixel, a local neighborhood window of size 5×5 is selected. The average value of the outer product of the gradients of all pixels within the local neighborhood window is calculated to obtain a 2×2 structure tensor J. Eigenvalue decomposition of the structure tensor J yields two eigenvalues. and ,and ; Through formula Calculate the anisotropy degree A of the pixel, where It is a value of 10 -6 The constant.
10. The method for detecting surface defects in artificial quartz stone slabs according to claim 8, characterized in that, Establish a joint optimization model, the specific model is as follows: , ; Where D is the observation matrix, B is the global background low-rank matrix, T is the local texture low-rank matrix, and E is the defect sparsity matrix. Represents the nuclear norm. Represents the weighted norm. Describing the L1 norm, This is the regularization parameter, and its value is set to... , where m and n are the number of rows and columns of the observation matrix D.