Intelligent detection method and system for color difference defects of a textile
Patent Information
- Application Number
- CN202610992072.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-06
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2046-07-06
AI Technical Summary
[0005]本申请实施例通过提供一种纺织物色差缺陷的智能检测方法及系统,解决了现有纺织物色差缺陷检测方法在识别精度、特征适配、检测效率、区域定位等方面难以满足规模化、精细化生产检测需求的技术问题
本申请实施例通过提供一种纺织物色差缺陷的智能检测方法及系统,首先,通过颜色对比度图的计算与阈值分割,选取高概率存在色差的候选区域,避免了全局遍历带来的计算冗余。其次,采用超像素分割技术将候选区域细化为具有颜色一致性和边缘贴合性的局部单元,为精细化分析奠定了空间基础。再次,通过同时量化超像素块间的颜色差异值与纹理相似度值,并构建颜色-纹理解耦偏差指数,实现了色差特征与纹理特征的有效分离,有效抑制了复杂纹理背景对色差判别的干扰。最后,基于数据驱动的阈值设定策略与超像素级判定结果的合并输出,确保了色差区域定位的准确性与结果表达的直观性,满足了高端纺织物生产线上对色差检测高精度、高效率、高鲁棒性的综合需求。
Smart Images

Figure CN122505922B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of textile inspection technology, specifically to an intelligent detection method and system for color difference defects in textiles. Background Technology
[0002] Color difference in textiles is one of the most common surface defects, affecting the appearance quality and market value of products. Traditional textile color difference inspection mainly relies on manual visual inspection, where inspectors observe the textile surface with the naked eye and judge the presence of color difference areas based on experience. However, manual inspection has limitations: on the one hand, the human eye's ability to distinguish colors is affected by various factors such as lighting conditions, viewing angle, and fatigue, resulting in highly subjective and inconsistent inspection results; on the other hand, manual inspection is inefficient, making it difficult to meet the real-time inspection needs of high-speed production lines, and it has a high rate of missed detection for minor or hidden color differences.
[0003] In recent years, automated inspection technology based on machine vision has been gradually applied to the field of textile color difference recognition. Common methods for detecting textile color difference defects mainly include methods based on color space threshold segmentation and methods based on traditional machine learning classification. However, these methods lack robustness in recognizing color differences against complex texture backgrounds, easily misclassifying normal texture variations as color differences, leading to a high false detection rate. Traditional machine learning classification methods extract manually designed features such as color histograms and texture features, and combine them with classifiers such as support vector machines or random forests for color difference discrimination. While this improves detection accuracy to some extent, the generalization ability of feature design is limited, and it is difficult to effectively distinguish subtle differences between color differences and normal textures.
[0004] Existing methods often employ a globally uniform segmentation strategy when processing high-resolution textile images, neglecting the characteristic that color difference regions usually exhibit local anomalies. This leads to wasted computational resources and limited detection accuracy, resulting in weak recognition capabilities for subtle color differences and making it difficult to meet the refined detection requirements of high-end textiles. Summary of the Invention
[0005] This application provides an intelligent detection method and system for color difference defects in textiles, which solves the technical problems of existing methods for detecting color difference defects in textiles, which are difficult to meet the needs of large-scale and refined production inspection in terms of recognition accuracy, feature adaptation, detection efficiency, and regional positioning.
[0006] The technical solution to the above-mentioned technical problems in this application is as follows: In a first aspect, this application provides an intelligent detection method for color difference defects in textiles, the method comprising: A high-resolution color image of the textile to be detected is acquired, a color contrast map of the high-resolution color image is calculated, and threshold segmentation is performed on the color contrast map to extract a set of candidate color difference regions. Each candidate color difference region in the candidate color difference region set is segmented into multiple superpixel blocks. Calculate the color difference value and texture similarity value between each superpixel block and its neighboring superpixel blocks, and calculate the color-texture decoupling deviation index based on the color difference value and the texture similarity value; The color-texture decoupling deviation index is compared with a preset deviation threshold, and the superpixel block is determined to be a color difference region based on the comparison result. All superpixel blocks identified as color difference regions are merged to generate and output a binary mask and position information of the color difference regions, which serves as the color difference defect detection result for the textile to be inspected.
[0007] Secondly, this application provides an intelligent detection system for color difference defects in textiles, comprising: The image extraction module is used to acquire a high-resolution color image of the textile to be inspected, calculate the color contrast map of the high-resolution color image, perform threshold segmentation on the color contrast map, and extract a set of candidate color difference regions. The superpixel segmentation module is used to perform superpixel segmentation on each candidate color difference region in the candidate color difference region set to obtain multiple superpixel blocks; The deviation index calculation module is used to calculate the color difference value and texture similarity value between each superpixel block and its neighboring superpixel blocks, and to calculate the color-texture decoupling deviation index based on the color difference value and the texture similarity value. The color difference region determination module is used to compare the color-texture decoupling deviation index with a preset deviation threshold, and determine whether the superpixel block belongs to the color difference region based on the comparison result. The recognition result output module is used to merge all superpixel blocks that are determined to be color difference regions, generate and output the binary mask and position information of the color difference regions, as the color difference defect detection result of the textile to be detected.
[0008] This application provides one or more technical solutions, which have at least the following technical effects or advantages: This application provides an intelligent detection method and system for color difference defects in textiles. First, by calculating the color contrast map and using threshold segmentation, candidate regions with a high probability of color difference are selected, avoiding computational redundancy caused by global traversal. Second, superpixel segmentation technology is used to refine the candidate regions into local units with color consistency and edge fit, laying a spatial foundation for refined analysis. Third, by simultaneously quantifying the color difference value and texture similarity value between superpixel blocks and constructing a color-texture decoupling deviation index, effective separation of color difference features and texture features is achieved, effectively suppressing the interference of complex texture backgrounds on color difference judgment. Finally, the data-driven threshold setting strategy and the merging output of superpixel-level judgment results ensure the accuracy of color difference region location and the intuitiveness of result expression, meeting the comprehensive requirements of high-precision, high-efficiency, and high-robustness color difference detection on high-end textile production lines.
[0009] Through the above technical solutions, this application forms a complete technical solution for detecting color difference defects in textiles based on preprocessing and screening of color contrast maps, local fine analysis of superpixel segmentation, multi-feature fusion discrimination of color-texture decoupling deviation index, and adaptive threshold judgment and result merging output. This effectively solves the technical problems of existing textile color difference defect detection methods, such as high false detection rate, weak ability to identify subtle color differences, and difficulty in balancing detection efficiency and accuracy in complex texture backgrounds. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart illustrating an intelligent detection method for color difference defects in textiles provided in an embodiment of this application. Figure 2 This is a schematic diagram of the structure of an intelligent detection system for color difference defects in textiles provided in an embodiment of this application.
[0012] The components represented by each number in the attached diagram are explained below: The module includes an image extraction module 11, a superpixel segmentation module 12, a deviation index calculation module 13, a color difference region determination module 14, and a recognition result output module 15. Detailed Implementation
[0013] This application provides an intelligent detection method and system for color difference defects in textiles, which addresses the technical problem that existing methods for detecting color difference defects in textiles are insufficient to meet the needs of large-scale and refined production inspection in terms of recognition accuracy, feature adaptation, detection efficiency, and regional positioning.
[0014] Example 1, as Figure 1 As shown in the figure, this application provides an intelligent detection method for color difference defects in textiles, including: S10: Acquire a high-resolution color image of the textile to be detected, calculate the color contrast map of the high-resolution color image, perform threshold segmentation on the color contrast map, and extract a set of candidate color difference regions. In this embodiment of the application, high-resolution color images can be obtained by taking pictures of the surface of the textile to be inspected using an industrial camera under standardized lighting conditions. The resolution of the industrial camera is not less than 12 million pixels to ensure that the subtle color difference features of the textile surface can be captured.
[0015] Secondly, a color contrast map of the high-resolution color image is calculated, and threshold segmentation is performed. An adaptive threshold segmentation method is adopted, taking each pixel in the color contrast map as the center and calculating a local threshold based on a preset confidence coefficient. When the color contrast value of a pixel is greater than the local threshold, the pixel is marked as a candidate color difference pixel. The region formed by all connected candidate color difference pixels forms a set of candidate color difference regions.
[0016] The process includes acquiring a high-resolution color image of the textile to be detected and calculating the color contrast map of the high-resolution color image, including: The high-resolution color image is converted from the RGB color space to the Lab color space to obtain a Lab image; Calculate the arithmetic mean of all pixels in the Lab image on the L channel, a channel, and b channel respectively to obtain the average L value, average a value, and average b value. Calculate the first difference between the L value of each pixel and the average L value, calculate the second difference between the a value of each pixel and the average a value, and calculate the third difference between the b value of each pixel and the average b value. The sum of the squares of the first difference, the second difference, and the third difference for each pixel is calculated to obtain the sum of squares of the differences for each pixel. The color contrast value of each pixel is obtained by taking the square root of the sum of the squared differences of each pixel. The color contrast values of all pixels in the Lab image are arranged according to their respective pixel positions to obtain a color contrast map with the same size as the high-resolution color image.
[0017] In this embodiment, the high-resolution color image is first converted from the RGB color space to the Lab color space. This conversion process follows the CIE 1976 standard. First, the RGB values are normalized to the range of 0 to 1. Then, they are converted to XYZ tristimulus values through matrix transformation. Finally, the L component (lightness), a component (red-green axis), and b component (yellow-blue axis) in the Lab color space are obtained based on nonlinear transformation relationships. The Lab color space is designed to conform to the characteristics of human visual perception. The L channel is related to color brightness, while the a and b channels are related to color chromaticity. Furthermore, the numerical differences among the three channels have a good linear correspondence with the color differences perceived by the human eye, making it more suitable for color difference quantification analysis.
[0018] Secondly, after obtaining the Lab image, the arithmetic mean of all pixels in the L channel, a channel, and b channel is calculated respectively. Specifically, for an image with a resolution of M×N, the average L value = ( , where i and j represent the row index and column index of the pixel, respectively, and L(i,j) represents the L channel value of the pixel in the i-th row and j-th column; the average a value and average b value are calculated in the same way, and the average value represents the overall color reference of the current textile image.
[0019] Next, for each pixel, calculate the first difference ΔL between its L value and the average L value. Calculate the second difference Δa between its a value and the average a value. Calculate the third difference Δb between its b value and the average b value. The three differences describe the deviation of the pixel's color from the overall average color in terms of brightness, red-green saturation, and yellow-blue saturation.
[0020] Furthermore, calculate the sum of squared differences for each pixel. This value comprehensively reflects the squared Euclidean distance of the pixel's color in the three-dimensional color space. The square root of the sum of the squared differences is then taken to obtain the color contrast value. This value represents the degree of deviation between the pixel's color and the overall average color. The larger the value, the higher the probability that the pixel's color is abnormal.
[0021] Finally, by arranging all the pixels according to their original spatial positions, a color contrast map with the same size as the input high-resolution color image can be obtained. In this map, the value of each pixel represents the salience of the color abnormality at the corresponding position.
[0022] Further, the color contrast map is thresholded to extract a set of candidate color difference regions, including: Collect color contrast images of a large number of normal textile samples, calculate the cumulative distribution function of color contrast values of all normal sample pixels, and use the value corresponding to the 95th quantile in the cumulative distribution function as the preset color contrast threshold. Pixels whose color contrast values in the color contrast map are greater than a preset color contrast threshold are marked as candidate pixels. Randomly select a candidate pixel as a seed point. Use a breadth-first search algorithm to group all candidate pixels that are spatially adjacent to the seed point into the same connected region and assign a unique region number to the connected region. Repeat the marking process until all candidate pixels are assigned region numbers to obtain multiple connected regions. Collect a large number of historical samples of known color difference regions, count the total number of pixels in each color difference region as the area of the color difference region, and use the 10th percentile of the area as the minimum area threshold. The total number of pixels in each connected region is counted, and this count is used as the area of each connected region. Connected regions whose area is greater than or equal to the minimum area threshold are selected as candidate color difference regions, and the set of all candidate color difference regions is selected as the candidate color difference region set.
[0023] In this embodiment, firstly, a preset color contrast threshold is determined based on statistical analysis of a large number of normal textile samples. This threshold can distinguish between normal color fluctuations and potential color differences. Specifically, by collecting color contrast maps of normal textile samples, the cumulative distribution function of the color contrast values of all normal sample pixels is calculated. The value corresponding to the 95th percentile of the cumulative distribution function is used as the preset color contrast threshold. This threshold indicates that in normal textile samples, only 5% of the pixel color contrast values will exceed this threshold, thereby effectively filtering out noise interference caused by normal color fluctuations while ensuring recall.
[0024] Specifically, the cumulative distribution function of the color contrast value of normal sample pixels is calculated by constructing a histogram of the color contrast value of normal samples, dividing the range of color contrast value into several continuous intervals, counting the frequency of pixels falling in each interval, calculating the proportion of the cumulative frequency of each interval to the total number of pixels, and obtaining the cumulative distribution function curve. The color contrast value corresponding to the cumulative probability reaching 95% is found from this curve, which is the preset color contrast threshold.
[0025] Secondly, after threshold segmentation, a breadth-first search algorithm is used to label connected regions. This algorithm starts from randomly selected seed candidate pixels and traverses the adjacent candidate pixels within their eight-neighbor range layer by layer until all pixels in the connected region have been traversed, and assigns a unique number to the region. This process can effectively identify spatially continuous color aberration regions, avoid discrete noise points being misjudged as independent color difference regions, and preserve the spatial topological structure information of color difference regions. The labeling process is repeated until all candidate pixels are assigned region numbers, resulting in multiple connected regions.
[0026] Furthermore, the minimum area threshold is determined based on the statistical analysis of the color difference area of historical samples. The 10th percentile is used as the screening criterion to filter out pseudo color difference areas that are too small and may be caused by tiny impurities such as dust and fiber fuzz, while retaining the truly existing subtle color difference defects. This adaptive area threshold mechanism takes into account both detection sensitivity and anti-interference ability.
[0027] Furthermore, the area of the connected regions is compared with the minimum area threshold. Connected regions whose area is greater than or equal to the minimum area threshold are selected as candidate color difference regions, and the set of all candidate color difference regions is selected as the candidate color difference region set.
[0028] S20: Perform superpixel segmentation on each candidate color difference region in the candidate color difference region set to obtain multiple superpixel blocks; In this embodiment, a simple linear iterative clustering algorithm is used to perform superpixel segmentation on candidate color difference regions. This algorithm uses color similarity and spatial proximity as the basis for clustering and generates superpixel blocks through iterative optimization.
[0029] Specifically, step S20 in the method includes: Within the candidate color difference region, multiple cluster centers are uniformly initialized according to a preset grid spacing, and the position coordinates and Lab color feature vector of each cluster center are determined. Move each cluster center within its local neighborhood to the position of minimum gradient; For each cluster center, within a preset search window around it, calculate the positional Euclidean distance and the Lab color Euclidean distance between each pixel in the search window and the cluster center, and calculate the weighted sum of the positional Euclidean distance and the Lab color Euclidean distance to obtain the weighted distance; Each pixel is assigned to the cluster center with the smallest weighted distance, forming multiple initial superpixel blocks; Calculate the average position coordinates and Lab color value of all pixels within each initial superpixel block, and use them as new cluster centers; Repeat the pixel allocation and cluster center update steps until the iteration converges, resulting in multiple superpixel blocks.
[0030] In this embodiment, firstly, within the candidate color difference region, multiple cluster centers are uniformly initialized according to a preset grid spacing, wherein the grid spacing S is calculated using the formula S= , where N is the total number of pixels in the candidate color difference region, and K is the number of superpixel blocks to be generated. This initialization method ensures that the cluster centers are evenly distributed in space, avoiding the problem of uneven segmentation caused by the initial positions being too concentrated. The position coordinates of each cluster center are its row and column indices in the image. The Lab color feature vector is composed of the L, a, and b channel values of the corresponding pixel at that position.
[0031] Secondly, the Lab color gradient magnitude of each pixel in the 3×3 neighborhood of the cluster center is calculated. The gradient magnitude is calculated by taking the difference in the horizontal and vertical directions of the three channels L, a, and b respectively, and then taking the square root of the sum of the squares of the gradient magnitudes of the three channels. The cluster center is moved to the position with the minimum gradient magnitude. This operation makes the cluster center avoid the color edge area and fall in the center of a relatively uniform local area.
[0032] Next, for each cluster center, pixels are allocated within a pre-defined search window. The search window is 2S×2S, which is a square region centered on the cluster center with sides equal to twice the grid spacing. Within the search window, the Euclidean distance ds between each pixel and the cluster center is calculated. Where (xi,yi) are the pixel coordinates, and (xc,yc) are the cluster center coordinates; calculate the Lab color Euclidean distance dc = , where (Li,ai,bi) are the Lab color values of the pixels, and (Lc,ac,bc) are the Lab color values of the cluster centers.
[0033] Specifically, the formula for calculating the weighted distance D is D= , where m is the spatial compactness parameter, used to balance the weights of color similarity and spatial proximity. The larger the value of m, the more regular the shape of the superpixel block; the smaller the value of m, the more the superpixel block fits the color boundary.
[0034] Furthermore, during the pixel allocation process, if a pixel is covered by the search windows of multiple cluster centers, its weighted distance to each cluster center is compared, and the cluster center with the smallest weighted distance is selected as the assigned pixel; if a pixel is not covered by any search window, it is assigned to the cluster center with the closest spatial distance, ensuring that all pixels in the candidate color difference region are assigned to the superpixel block.
[0035] Then, the average position coordinates and Lab color average of all pixels in each initial superpixel block are calculated as the new cluster centers. That is, the new position coordinates are the arithmetic mean of the row and column indices of the pixels in the block, and the new Lab color feature vector is the arithmetic mean of the L, a, and b channel values of the pixels in the block.
[0036] Furthermore, the pixel allocation and cluster center update steps are repeated until the position change of the cluster center is less than a preset threshold or the maximum number of iterations is reached, such as 10 iterations. After the iterations converge, multiple superpixel blocks are obtained. Each superpixel block has color consistency and edge fit, and the pixels within the block maintain a high degree of similarity in spatial and color features.
[0037] S30: Calculate the color difference value and texture similarity value between each superpixel block and its neighboring superpixel blocks, and calculate the color-texture decoupling deviation index based on the color difference value and the texture similarity value; In this embodiment, by comprehensively considering the coupling relationship between color difference and texture similarity, and calculating the color-texture decoupling deviation index, the heterogeneity within the color difference region is accurately quantified, effectively distinguishing between the visual difference caused by the actual color difference and the texture change.
[0038] This includes calculating the color difference value between each superpixel block and its neighboring superpixel blocks, including: Based on the color contrast map, the arithmetic mean of the color contrast values of all pixels in each superpixel block is calculated as the regional contrast mean of each superpixel block; For each superpixel block, the average regional contrast of each neighboring superpixel block that is adjacent to the superpixel block in the image space is obtained; Calculate the absolute value of the difference between the region contrast mean of the superpixel block and the region contrast mean of the neighboring superpixel blocks, and use the absolute value of the difference as the color difference value between the superpixel block and the neighboring superpixel blocks.
[0039] In this embodiment of the application, firstly, based on the color contrast map, for each superpixel block, all pixels contained in the superpixel block are traversed, the color contrast value of the corresponding position of each pixel is extracted, and the arithmetic mean of the color contrast values is calculated, that is, the regional contrast mean = ( This value reflects the degree of color anomaly of the superpixel block as a whole. The higher the value, the more significant the deviation of the superpixel block from the average color of the textile as a whole.
[0040] Secondly, the four-neighbor connectivity criterion is used to determine the adjacency relationship between superpixel blocks. Specifically, if two superpixel blocks have at least one pair of pixels in the image that satisfy the four-neighbor condition (i.e., spatial adjacency in the top, bottom, left, and right directions), then these two superpixel blocks are determined to be neighboring superpixel blocks. By traversing all pairs of superpixel blocks, a complete neighborhood relationship graph is constructed.
[0041] Next, for each superpixel block, iterate through all its neighboring superpixel blocks, obtain the average regional contrast of each neighboring superpixel block, and calculate the difference between the average regional contrast of the current superpixel block and the average regional contrast of its neighboring superpixel blocks. Take the absolute value as the color difference value, i.e., color difference value = This value quantifies the relative difference in the degree of color aberration between adjacent superpixel blocks. The larger the color difference value, the more obvious the color abrupt change in adjacent areas, which may correspond to the boundary or internal heterogeneous structure of the color difference area.
[0042] Further, the texture similarity value between each superpixel block and its neighboring superpixel blocks is calculated, including: Each superpixel block and each neighboring superpixel block adjacent to the superpixel block are scaled to the input size required by the pre-trained deep feature extraction network, and then sequentially input into the deep feature extraction network to output the depth feature vector of each superpixel block and the depth feature vector of each neighboring superpixel block. Calculate the cosine similarity between the depth feature vector of the superpixel block and the depth feature vector of the neighboring superpixel blocks, and use the cosine similarity as the texture similarity value between the superpixel block and the neighboring superpixel blocks.
[0043] In this embodiment, each superpixel block and its neighboring superpixel blocks are first scaled to the fixed input size required by the pre-trained deep feature extraction network, such as 224×224 pixels. This scaling operation uses bilinear interpolation to maintain the continuity of image content and avoids the loss of texture information caused by direct cropping. The scaled image blocks are then input into a ResNet-50 network pre-trained based on the existing ImageNet dataset. The output of the global average pooling layer before the last fully connected layer of the network is extracted to obtain a 2048-dimensional deep feature vector. This feature vector includes visual attributes unique to textiles, such as fiber orientation, weave density, and surface gloss.
[0044] Secondly, for each superpixel block and its neighboring superpixel blocks' depth feature vectors, the cosine similarity between them is calculated as the texture similarity value, i.e., texture similarity value = , where · represents the vector dot product operation, ||·|| represents the L2 norm of the vector, and the cosine similarity ranges from [-1, 1]. The closer the value is to 1, the more similar the texture structures of the two superpixel blocks are, and the closer the value is to -1, the greater the texture difference is. This metric is robust to changes in the magnitude of the feature vector.
[0045] Further, a color-texture decoupling bias index is calculated based on the color difference value and the texture similarity value, including: The color difference value and texture similarity value of the superpixel block and each neighboring superpixel block are concatenated into a two-dimensional feature vector. The two-dimensional feature vectors corresponding to all neighboring superpixel blocks are arranged in the order of the neighborhood to form the input feature matrix. The input feature matrix is input into a pre-trained deviation index calculation model, and the color-texture decoupling deviation index of the superpixel block is output. The training process of the deviation index calculation model includes: An initial deviation index calculation model is constructed based on a regression neural network, wherein the output layer of the initial deviation index calculation model contains a sigmoid activation function to output a scalar value between 0 and 1; Multiple textile color difference samples are collected. Each textile color difference sample includes a superpixel block and the color difference value and texture similarity value of all its neighboring superpixel blocks. The color difference value and texture similarity value are arranged in the same way as the input feature matrix to form a sample input feature matrix. The set of all sample input feature matrices is used as the training sample input set. For each sample input feature matrix, label the corresponding color-texture decoupling bias index, and use the set of all color-texture decoupling bias indices as the training sample output set; Using the training sample input set as input and the training sample output set as supervision labels, the initial bias index calculation model is trained in a supervised manner until it is verified to converge, thus obtaining the trained bias index calculation model.
[0046] In this embodiment, firstly, for each superpixel block, its color difference value and texture similarity value with all neighboring superpixel blocks are concatenated to form a two-dimensional feature vector [color difference value, texture similarity value]. This vector encodes the relative relationship between adjacent regions in the two dimensions of color and texture. The color difference value reflects the gradient change of the degree of color anomaly, and the texture similarity value reflects the continuity of the fabric surface structure. All neighboring feature vectors corresponding to the same superpixel block are arranged in spatial orientation order, such as clockwise order of top, bottom, left, and right, to construct an input feature matrix. The number of rows in this matrix is the number of neighboring superpixel blocks, and the number of columns is 2, which fully represents the feature association between the superpixel block and its surrounding environment.
[0047] Secondly, the above input feature matrix is processed using a deviation index calculation model based on a regression neural network. For example, the model contains two hidden layers: the first layer contains 64 neurons and the second layer contains 32 neurons. Both layers use the ReLU activation function to introduce non-linear mapping capabilities. The output layer contains a single neuron and is equipped with a Sigmoid activation function. The network output is compressed to the range of 0 to 1 as the quantization value of the color-texture decoupling deviation index. The closer the index is to 1, the more significant the color difference between the superpixel block and its neighborhood is, while the texture remains highly similar, indicating a higher probability of a true color difference. The closer the index is to 0, the more likely the color difference is caused by texture changes rather than a true color difference.
[0048] Secondly, during the model training phase, a large number of textile color difference samples were collected to construct a training dataset. Each sample included a real color difference region and a normal texture region that were manually labeled. The same superpixel segmentation and feature extraction process was performed on the samples to obtain color difference values and texture similarity values at the superpixel block level. The sample input feature matrix was then constructed. For each sample, a color-texture decoupling bias index between 0 and 1 was labeled as a supervision label based on the position of the superpixel block in the real color difference region and the degree of color anomaly. The position located in the center of the color difference region and with significant color anomaly was labeled as 1, the position located in the normal texture region or the position where the color difference was caused by texture change was labeled as 0, and the boundary transition region was labeled as 0.5.
[0049] For example, the mean squared error loss function is used to supervise the model training process. The optimizer is the Adam adaptive learning rate optimization algorithm, with the initial learning rate set to 0.001 and the batch size set to 32. Five-fold cross-validation is used during training to prevent overfitting. When the validation set loss no longer decreases for 5 consecutive rounds, an early stopping mechanism is triggered, and the model parameters with the best validation performance are saved. Finally, the bias index calculation model is obtained after training. This model can effectively learn the complex coupling relationship between color difference and texture similarity, and realize the discrimination of heterogeneity within color difference regions.
[0050] S40: Compare the color-texture decoupling deviation index with a preset deviation threshold, and determine whether the superpixel block belongs to a color difference region based on the comparison result; In this embodiment, by setting a preset deviation threshold as a discrimination criterion, the color-texture decoupling deviation index is binarized and classified to achieve accurate identification of color difference regions at the superpixel block level and effectively filter out pseudo color difference interference caused by fabric texture changes.
[0051] Specifically, step S40 in the method includes: Collect historical samples from multiple known color difference regions, calculate the color-texture decoupling deviation index of all superpixel blocks in each known color difference region sample, sort all the calculated deviation index values in ascending order, and take the value corresponding to the 95th quantile as the preset deviation threshold. For each superpixel block, the color-texture decoupling deviation index of the superpixel block is compared with the deviation threshold. If the color-texture decoupling deviation index is greater than the preset deviation threshold, the superpixel block is determined to belong to the color difference region.
[0052] In this embodiment, firstly, during the establishment of the preset deviation threshold, a statistical learning method based on historical samples is employed to ensure the threshold's adaptability and robustness. Specifically, multiple sets of known color difference region samples, confirmed by manual quality inspection, are selected from the historical production database. These samples cover typical color difference types under different textile materials, dyeing processes, and lighting conditions, including common defect forms such as stripes, color patches, and dye spots. The aforementioned complete superpixel segmentation and feature extraction process is then performed on each set of samples, calculating the color-texture decoupling deviation index of all superpixel blocks within the sample, and constructing a deviation index distribution set.
[0053] Secondly, percentile statistical analysis was performed on the deviation index distribution set, and the 95th percentile was selected as the preset deviation threshold. The rationale for this value selection strategy is that the 95th percentile can effectively distinguish the vast majority of normal texture areas from the real color difference areas, retain 5% error margin to deal with the ambiguity of the boundary transition area, and at the same time avoid using the maximum value to avoid the threshold being too aggressive and missing slight color differences.
[0054] Furthermore, in the real-time detection stage, for each superpixel block in the image to be detected, its color-texture decoupling deviation index is compared with a preset deviation threshold. If the deviation index is greater than the threshold, the superpixel block is determined to belong to the color difference region and is marked as a candidate defect pixel; if the deviation index is less than or equal to the threshold, it is determined to be a normal texture region. After the binarization classification process is completed, an initial color difference region mask map is obtained, in which the connected foreground regions constitute the initially identified color difference defects.
[0055] S50: Merge all superpixel blocks that are determined to be color difference regions, generate and output the binary mask and position information of the color difference regions, and use it as the color difference defect detection result of the textile to be inspected.
[0056] In this embodiment, superpixel blocks that are spatially adjacent and whose color-texture decoupling deviation indices are all greater than a preset deviation threshold are clustered and merged to construct a complete color difference region connected domain, and their geometric contours and position coordinates are extracted to form a structured color difference defect detection result.
[0057] Specifically, step S50 in the method includes: Create a blank binary mask image with the same width and height as the high-resolution color image, wherein the initial value of all pixels in the blank binary mask image is set to a second value; For each superpixel block determined to be a color difference region, the pixel values of all pixels in the superpixel block determined to be a color difference region at the corresponding positions in the blank binary mask image are set to the first value. The blank binary mask image after setting the second and first values is used as the binary mask of the color difference region; The connected components in the binary mask of the color difference region are analyzed, and the contour coordinates of each connected component are calculated. The contour coordinates are used as the position information of the color difference region. Output the binary mask of the color difference region and the position information of the color difference region as the color difference defect detection result of the textile to be inspected.
[0058] In this embodiment of the application, firstly, a blank binary mask image with the same size as the high-resolution color image is created, and all pixel values are initialized to 0, i.e., the second value. This mask image serves as the spatial carrier of the color difference region.
[0059] Secondly, all superpixel blocks identified as chromatic aberration regions are traversed. For each target superpixel block, the original image coordinates of all pixels contained within it are obtained. The pixel value is set to 1 at the corresponding position in the binary mask image, i.e., the first value. This filling operation maintains the original boundary shape of the superpixel block and avoids the loss of edge information caused by morphological processing. After the filling is completed, the area with a pixel value of 1 in the binary mask image constitutes the initial spatial distribution of the chromatic aberration region.
[0060] Next, connected component analysis is performed on the binary mask image. The eight-neighbor connectivity criterion is used to identify all interconnected foreground pixel sets. Each connected component corresponds to an independent color difference defect entity. For each connected component, a boundary tracking algorithm is used to extract its outer contour coordinate sequence. This sequence records the image coordinates of the edge pixels of the connected component in a clockwise direction. At the same time, the minimum bounding rectangle parameters of the connected component are calculated, including the coordinates of the top left corner, width and height, as well as the centroid coordinates and pixel area of the connected component. The above geometric parameters together constitute the positional information of the color difference region.
[0061] Furthermore, the extracted connected components are post-processed and optimized to remove noisy connected components with an area smaller than the preset minimum defect area. This preset minimum defect area is set according to textile inspection standards, for example, 100 pixels for high-precision inspection scenarios and 400 pixels for regular inspection scenarios, to avoid minor noise or texture details being misjudged as color difference defects. At the same time, for connected components with excessively large areas and elongated shapes, their aspect ratio and internal hole features are analyzed to determine whether there are multiple adhesion defects. If necessary, the watershed algorithm is used for region segmentation to improve the recognition accuracy of multi-defect scenarios.
[0062] Finally, the optimized binary mask image and the color difference region location information are packaged and output. The binary mask image is stored in a lossless compression format to facilitate subsequent visualization overlay and quality traceability. The location information is output in a structured data format, including a unique identifier for each color difference region, a list of contour coordinates, bounding rectangle parameters, centroid coordinates, pixel area, and statistical features of the color-texture decoupling deviation index. As the final result of textile color difference recognition, it supports downstream quality grading, automatic rejection, and process optimization decisions.
[0063] In summary, compared with existing technologies, this application achieves local aggregation of color features through superpixel segmentation, quantifies pixel-level color anomalies through color contrast maps, captures the essential attributes of textile texture through deep feature extraction networks, and realizes intelligent separation of color differences and texture changes through color-texture decoupling deviation index. Finally, it outputs structured color difference defect detection results through adaptive threshold determination and connected component analysis, forming a complete technical closed loop from image preprocessing, feature calculation, intelligent discrimination to result output.
[0064] In summary, the embodiments of this application have at least the following technical effects: This application provides an intelligent detection method for color difference defects in textiles. First, by calculating the color contrast map and using threshold segmentation, candidate regions with a high probability of color difference are selected, avoiding computational redundancy caused by global traversal. Second, superpixel segmentation technology is used to refine the candidate regions into local units with color consistency and edge fit, laying a spatial foundation for refined analysis. Third, by simultaneously quantifying the color difference value and texture similarity value between superpixel blocks and constructing a color-texture decoupling deviation index, effective separation of color difference features and texture features is achieved, effectively suppressing the interference of complex texture backgrounds on color difference discrimination. Finally, the data-driven threshold setting strategy and the merging output of superpixel-level judgment results ensure the accuracy of color difference region location and the intuitiveness of result expression, meeting the comprehensive requirements of high-precision, high-efficiency, and high-robustness color difference detection on high-end textile production lines.
[0065] Through the above technical solutions, this application forms a complete technical solution for detecting color difference defects in textiles based on preprocessing and screening of color contrast maps, local fine analysis of superpixel segmentation, multi-feature fusion discrimination of color-texture decoupling deviation index, and adaptive threshold judgment and result merging output. This effectively solves the technical problems of existing textile color difference defect detection methods, such as high false detection rate, weak ability to identify subtle color differences, and difficulty in balancing detection efficiency and accuracy in complex texture backgrounds.
[0066] Example 2, as Figure 2 As shown, based on the same inventive concept as the intelligent detection method for color difference defects in textiles provided in Embodiment 1, this application also provides an intelligent detection system for color difference defects in textiles, including: The image extraction module 11 is used to acquire a high-resolution color image of the textile to be inspected, calculate the color contrast map of the high-resolution color image, and perform threshold segmentation on the color contrast map to extract a set of candidate color difference regions. The superpixel segmentation module 12 is used to perform superpixel segmentation on each candidate color difference region in the candidate color difference region set to obtain multiple superpixel blocks; The deviation index calculation module 13 is used to calculate the color difference value and texture similarity value between each superpixel block and its neighboring superpixel blocks, and to calculate the color-texture decoupling deviation index based on the color difference value and the texture similarity value. The color difference region determination module 14 is used to compare the color-texture decoupling deviation index with a preset deviation threshold, and determine whether the superpixel block belongs to the color difference region based on the comparison result. The recognition result output module 15 is used to merge all superpixel blocks that are determined to be color difference regions, generate and output the binary mask and position information of the color difference regions as the color difference defect detection result of the textile to be detected.
[0067] Further, in one embodiment, acquiring a high-resolution color image of the textile to be detected and calculating a color contrast map of the high-resolution color image includes: The high-resolution color image is converted from the RGB color space to the Lab color space to obtain a Lab image; Calculate the arithmetic mean of all pixels in the Lab image on the L channel, a channel, and b channel respectively to obtain the average L value, average a value, and average b value. Calculate the first difference between the L value of each pixel and the average L value, calculate the second difference between the a value of each pixel and the average a value, and calculate the third difference between the b value of each pixel and the average b value. The sum of the squares of the first difference, the second difference, and the third difference for each pixel is calculated to obtain the sum of squares of the differences for each pixel. The color contrast value of each pixel is obtained by taking the square root of the sum of the squared differences of each pixel. The color contrast values of all pixels in the Lab image are arranged according to their respective pixel positions to obtain a color contrast map with the same size as the high-resolution color image.
[0068] Furthermore, in one embodiment, the color contrast map is thresholded to extract a set of candidate color difference regions, including: Collect color contrast images of a large number of normal textile samples, calculate the cumulative distribution function of color contrast values of all normal sample pixels, and use the value corresponding to the 95th quantile in the cumulative distribution function as the preset color contrast threshold. Pixels whose color contrast values in the color contrast map are greater than a preset color contrast threshold are marked as candidate pixels. Randomly select a candidate pixel as a seed point. Use a breadth-first search algorithm to group all candidate pixels that are spatially adjacent to the seed point into the same connected region and assign a unique region number to the connected region. Repeat the marking process until all candidate pixels are assigned region numbers to obtain multiple connected regions. Collect a large number of historical samples of known color difference regions, count the total number of pixels in each color difference region as the area of the color difference region, and use the 10th percentile of the area as the minimum area threshold. The total number of pixels in each connected region is counted, and this count is used as the area of each connected region. Connected regions whose area is greater than or equal to the minimum area threshold are selected as candidate color difference regions, and the set of all candidate color difference regions is selected as the candidate color difference region set.
[0069] In one embodiment, the superpixel segmentation module 12 is specifically used for: Within the candidate color difference region, multiple cluster centers are uniformly initialized according to a preset grid spacing, and the position coordinates and Lab color feature vector of each cluster center are determined. Move each cluster center within its local neighborhood to the position of minimum gradient; For each cluster center, within a preset search window around it, calculate the positional Euclidean distance and the Lab color Euclidean distance between each pixel in the search window and the cluster center, and calculate the weighted sum of the positional Euclidean distance and the Lab color Euclidean distance to obtain the weighted distance; Each pixel is assigned to the cluster center with the smallest weighted distance, forming multiple initial superpixel blocks; Calculate the average position coordinates and Lab color value of all pixels within each initial superpixel block, and use them as new cluster centers; Repeat the pixel allocation and cluster center update steps until the iteration converges, resulting in multiple superpixel blocks.
[0070] Further, the color difference value between each superpixel block and its neighboring superpixel blocks is calculated separately, including: Based on the color contrast map, the arithmetic mean of the color contrast values of all pixels in each superpixel block is calculated as the regional contrast mean of each superpixel block; For each superpixel block, the average regional contrast of each neighboring superpixel block that is adjacent to the superpixel block in the image space is obtained; Calculate the absolute value of the difference between the region contrast mean of the superpixel block and the region contrast mean of the neighboring superpixel blocks, and use the absolute value of the difference as the color difference value between the superpixel block and the neighboring superpixel blocks.
[0071] Further, in one embodiment, calculating the texture similarity value between each superpixel block and its neighboring superpixel blocks includes: Each superpixel block and each neighboring superpixel block adjacent to the superpixel block are scaled to the input size required by the pre-trained deep feature extraction network, and then sequentially input into the deep feature extraction network to output the depth feature vector of each superpixel block and the depth feature vector of each neighboring superpixel block. Calculate the cosine similarity between the depth feature vector of the superpixel block and the depth feature vector of the neighboring superpixel blocks, and use the cosine similarity as the texture similarity value between the superpixel block and the neighboring superpixel blocks.
[0072] Further, in one embodiment, calculating the color-texture decoupling bias index based on the color difference value and the texture similarity value includes: The color difference value and texture similarity value of the superpixel block and each neighboring superpixel block are concatenated into a two-dimensional feature vector. The two-dimensional feature vectors corresponding to all neighboring superpixel blocks are arranged in the order of the neighborhood to form the input feature matrix. The input feature matrix is input into a pre-trained deviation index calculation model, and the color-texture decoupling deviation index of the superpixel block is output. The training process of the deviation index calculation model includes: An initial deviation index calculation model is constructed based on a regression neural network, wherein the output layer of the initial deviation index calculation model contains a sigmoid activation function to output a scalar value between 0 and 1; Multiple textile color difference samples are collected. Each textile color difference sample includes a superpixel block and the color difference value and texture similarity value of all its neighboring superpixel blocks. The color difference value and texture similarity value are arranged in the same way as the input feature matrix to form a sample input feature matrix. The set of all sample input feature matrices is used as the training sample input set. For each sample input feature matrix, label the corresponding color-texture decoupling bias index, and use the set of all color-texture decoupling bias indices as the training sample output set; Using the training sample input set as input and the training sample output set as supervision labels, the initial bias index calculation model is trained in a supervised manner until it is verified to converge, thus obtaining the trained bias index calculation model.
[0073] In one embodiment, the color difference area determination module 14 is specifically used for: Collect historical samples from multiple known color difference regions, calculate the color-texture decoupling deviation index of all superpixel blocks in each known color difference region sample, sort all the calculated deviation index values in ascending order, and take the value corresponding to the 95th quantile as the preset deviation threshold. For each superpixel block, the color-texture decoupling deviation index of the superpixel block is compared with the deviation threshold. If the color-texture decoupling deviation index is greater than the preset deviation threshold, the superpixel block is determined to belong to the color difference region.
[0074] Furthermore, in one embodiment, the recognition result output module 15 is specifically used for: Create a blank binary mask image with the same width and height as the high-resolution color image, wherein the initial value of all pixels in the blank binary mask image is set to a second value; For each superpixel block determined to be a color difference region, the pixel values of all pixels in the superpixel block determined to be a color difference region at the corresponding positions in the blank binary mask image are set to the first value. The blank binary mask image after setting the second and first values is used as the binary mask of the color difference region; The connected components in the binary mask of the color difference region are analyzed, and the contour coordinates of each connected component are calculated. The contour coordinates are used as the position information of the color difference region. Output the binary mask of the color difference region and the position information of the color difference region as the color difference defect detection result of the textile to be inspected.
Claims
1. An intelligent detection method for color difference defects in textiles, characterized in that, The method includes: A high-resolution color image of the textile to be detected is acquired, a color contrast map of the high-resolution color image is calculated, and threshold segmentation is performed on the color contrast map to extract a set of candidate color difference regions. Each candidate color difference region in the candidate color difference region set is segmented into multiple superpixel blocks. Calculate the color difference value and texture similarity value between each superpixel block and its neighboring superpixel blocks, and calculate the color-texture decoupling deviation index based on the color difference value and the texture similarity value; The color-texture decoupling deviation index is compared with a preset deviation threshold, and the superpixel block is determined to be a color difference region based on the comparison result. All superpixel blocks identified as color difference regions are merged to generate and output a binary mask and position information of the color difference regions, which serves as the color difference defect detection result of the textile to be inspected. The calculation of the color-texture decoupling deviation index based on the color difference value and the texture similarity value includes: The color difference value and texture similarity value of the superpixel block and each neighboring superpixel block are concatenated into a two-dimensional feature vector. The two-dimensional feature vectors corresponding to all neighboring superpixel blocks are arranged in the order of the neighborhood to form the input feature matrix. The input feature matrix is input into a pre-trained deviation index calculation model, and the color-texture decoupling deviation index of the superpixel block is output. The training process of the deviation index calculation model includes: An initial deviation index calculation model is constructed based on a regression neural network, wherein the output layer of the initial deviation index calculation model contains a sigmoid activation function to output a scalar value between 0 and 1; Multiple textile color difference samples are collected. Each textile color difference sample includes a superpixel block and the color difference value and texture similarity value of all its neighboring superpixel blocks. The color difference value and texture similarity value are arranged in the same way as the input feature matrix to form a sample input feature matrix. The set of all sample input feature matrices is used as the training sample input set. For each sample input feature matrix, label the corresponding color-texture decoupling bias index, and use the set of all color-texture decoupling bias indices as the training sample output set; Using the training sample input set as input and the training sample output set as supervision labels, the initial bias index calculation model is trained in a supervised manner until it is verified to converge, thus obtaining the trained bias index calculation model.
2. The intelligent detection method for color difference defects in textiles according to claim 1, characterized in that, Acquire a high-resolution color image of the textile to be inspected, and calculate the color contrast map of the high-resolution color image, including: The high-resolution color image is converted from the RGB color space to the Lab color space to obtain a Lab image; Calculate the arithmetic mean of all pixels in the Lab image on the L channel, a channel, and b channel respectively to obtain the average L value, average a value, and average b value. Calculate the first difference between the L value of each pixel and the average L value, calculate the second difference between the a value of each pixel and the average a value, and calculate the third difference between the b value of each pixel and the average b value. The sum of the squares of the first difference, the second difference, and the third difference for each pixel is calculated to obtain the sum of squares of the differences for each pixel. The color contrast value of each pixel is obtained by taking the square root of the sum of the squared differences of each pixel. The color contrast values of all pixels in the Lab image are arranged according to their respective pixel positions to obtain a color contrast map with the same size as the high-resolution color image.
3. The intelligent detection method for color difference defects in textiles according to claim 2, characterized in that, The color contrast map is thresholded to extract a set of candidate color difference regions, including: Collect color contrast images of a large number of normal textile samples, calculate the cumulative distribution function of color contrast values of all normal sample pixels, and use the value corresponding to the 95th quantile in the cumulative distribution function as the preset color contrast threshold. Pixels whose color contrast values in the color contrast map are greater than a preset color contrast threshold are marked as candidate pixels. Randomly select a candidate pixel as a seed point. Use a breadth-first search algorithm to group all candidate pixels that are spatially adjacent to the seed point into the same connected region and assign a unique region number to the connected region. Repeat the marking process until all candidate pixels are assigned region numbers to obtain multiple connected regions. Collect a large number of historical samples of known color difference regions, count the total number of pixels in each color difference region as the area of the color difference region, and use the 10th percentile of the area as the minimum area threshold. The total number of pixels in each connected region is counted, and this count is used as the area of each connected region. Connected regions whose area is greater than or equal to the minimum area threshold are selected as candidate color difference regions, and the set of all candidate color difference regions is selected as the candidate color difference region set.
4. The intelligent detection method for color difference defects in textiles according to claim 1, characterized in that, Each candidate color difference region in the candidate color difference region set is segmented into multiple superpixel blocks, including: Within the candidate color difference region, multiple cluster centers are uniformly initialized according to a preset grid spacing, and the position coordinates and Lab color feature vector of each cluster center are determined. Move each cluster center within its local neighborhood to the position of minimum gradient; For each cluster center, within a preset search window around it, calculate the positional Euclidean distance and the Lab color Euclidean distance between each pixel in the search window and the cluster center, and calculate the weighted sum of the positional Euclidean distance and the Lab color Euclidean distance to obtain the weighted distance; Each pixel is assigned to the cluster center with the smallest weighted distance, forming multiple initial superpixel blocks; Calculate the average position coordinates and Lab color value of all pixels within each initial superpixel block, and use them as new cluster centers; Repeat the pixel allocation and cluster center update steps until the iteration converges, resulting in multiple superpixel blocks.
5. The intelligent detection method for color difference defects in textiles according to claim 1, characterized in that, Calculate the color difference value between each superpixel block and its neighboring superpixel blocks, including: Based on the color contrast map, the arithmetic mean of the color contrast values of all pixels in each superpixel block is calculated as the regional contrast mean of each superpixel block; For each superpixel block, the average regional contrast of each neighboring superpixel block that is adjacent to the superpixel block in the image space is obtained; Calculate the absolute value of the difference between the region contrast mean of the superpixel block and the region contrast mean of the neighboring superpixel blocks, and use the absolute value of the difference as the color difference value between the superpixel block and the neighboring superpixel blocks.
6. The intelligent detection method for color difference defects in textiles according to claim 1, characterized in that, Calculate the texture similarity value between each superpixel block and its neighboring superpixel blocks, including: Each superpixel block and each neighboring superpixel block adjacent to the superpixel block are scaled to the input size required by the pre-trained deep feature extraction network, and then sequentially input into the deep feature extraction network to output the depth feature vector of each superpixel block and the depth feature vector of each neighboring superpixel block. Calculate the cosine similarity between the depth feature vector of the superpixel block and the depth feature vector of the neighboring superpixel blocks, and use the cosine similarity as the texture similarity value between the superpixel block and the neighboring superpixel blocks.
7. The intelligent detection method for color difference defects in textiles according to claim 1, characterized in that, The color-texture decoupling deviation index is compared with a preset deviation threshold, and the superpixel block is determined to be a color difference region based on the comparison result, including: Collect historical samples from multiple known color difference regions, calculate the color-texture decoupling deviation index of all superpixel blocks in each known color difference region sample, sort all the calculated deviation index values in ascending order, and take the value corresponding to the 95th quantile as the preset deviation threshold. For each superpixel block, the color-texture decoupling deviation index of the superpixel block is compared with the deviation threshold. If the color-texture decoupling deviation index is greater than the preset deviation threshold, the superpixel block is determined to belong to the color difference region.
8. The intelligent detection method for color difference defects in textiles according to claim 1, characterized in that, All superpixel blocks identified as color difference regions are merged to generate and output a binary mask and position information of the color difference regions, which serves as the color difference defect detection result for the textile to be inspected, including: Create a blank binary mask image with the same width and height as the high-resolution color image, wherein the initial value of all pixels in the blank binary mask image is set to a second value; For each superpixel block determined to be a color difference region, the pixel values of all pixels in the superpixel block determined to be a color difference region at the corresponding positions in the blank binary mask image are set to the first value. The blank binary mask image after setting the second and first values is used as the binary mask of the color difference region; The connected components in the binary mask of the color difference region are analyzed, and the contour coordinates of each connected component are calculated. The contour coordinates are used as the position information of the color difference region. Output the binary mask of the color difference region and the position information of the color difference region as the color difference defect detection result of the textile to be inspected.
9. An intelligent detection system for color difference defects in textiles, characterized in that, A smart detection method for textile color difference defects according to any one of claims 1-8 includes: The image extraction module is used to acquire a high-resolution color image of the textile to be inspected, calculate the color contrast map of the high-resolution color image, perform threshold segmentation on the color contrast map, and extract a set of candidate color difference regions. The superpixel segmentation module is used to perform superpixel segmentation on each candidate color difference region in the candidate color difference region set to obtain multiple superpixel blocks; The deviation index calculation module is used to calculate the color difference value and texture similarity value between each superpixel block and its neighboring superpixel blocks, and to calculate the color-texture decoupling deviation index based on the color difference value and the texture similarity value. The color difference region determination module is used to compare the color-texture decoupling deviation index with a preset deviation threshold, and determine whether the superpixel block belongs to the color difference region based on the comparison result. The recognition result output module is used to merge all superpixel blocks that are determined to be color difference regions, generate and output the binary mask and position information of the color difference regions, as the color difference defect detection result of the textile to be detected.
Citation Information
Patent Citations
Color difference adaptive online detection method and device based on SLIC super pixel segmentation
CN110108362A
Visual inspection method and system for appearance defects of IC package carrier
CN119086573A