Textile color difference detection method based on image data
By constructing a light intensity prediction model and dividing the exposure area into multiple scales, combined with color compensation reconstruction, the problem of brightness saturation in color difference detection of high-reflectivity textiles was solved, achieving high-precision color difference detection and consistent results.
Patent Information
- Application Number
- CN202511125440.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-11-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies for detecting highly reflective textiles are susceptible to the influence of strong surface reflection during the image acquisition stage, leading to local pixel saturation. This results in color difference detection algorithms being unable to accurately capture minute or gradual color difference features, thus affecting product quality control.
By constructing a light intensity prediction model, identifying regions of sudden brightness changes and saturation critical regions, dividing exposure areas at multiple scales, and reconstructing the true color distribution through color compensation, a closed-loop process is constructed to improve detection accuracy and consistency.
It enables precise detection of minute color differences in highly reflective fabrics, enhances automation and industrial applicability, and improves the robustness and accuracy of color difference detection.
Smart Images

Figure CN120894339A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of image processing and computer vision technology, specifically to a method for detecting color difference in textiles based on image data. Background Technology
[0002] Image-based textile color difference detection refers to a method that uses computer vision and image processing technology to analyze and compare the color values of each pixel in a textile surface by acquiring image information. This allows for the identification of color differences between different areas of the textile and the quantification of the degree of color difference. The technology uses a high-resolution camera to acquire images of textiles under natural or standard light sources. Through processes such as color space conversion, illumination equalization, target area extraction, and color difference calculation, it achieves objective and automated color difference detection, replacing the traditional subjective method that relies on manual visual inspection. It offers advantages such as high detection speed, high accuracy, and good consistency, and is widely used in textile production processes such as dyeing and printing, and fabric quality inspection to ensure the color consistency and appearance quality of products.
[0003] The existing technology has the following shortcomings: In the process of color difference detection of textiles based on image data, for fabrics with high light reflectivity (such as silk, satin, and woven fabrics with metallic threads), conventional industrial cameras are easily affected by strong surface reflection during the image acquisition stage, leading to local pixel saturation in some areas of the image. Because image sensors have an upper limit to their dynamic range, when the intensity of reflected light in a bright area exceeds the sensor's maximum luminance threshold, the relevant pixels are forced to be assigned a fixed maximum grayscale value (e.g., 255), causing the loss or severe distortion of color information in that area. As a result, color difference detection algorithms cannot accurately obtain the actual color values of saturated areas, thus masking the subtle or gradual color difference features that should exist in those areas. Especially when evaluating detailed color differences in high-gloss fabrics, the "luminance masking effect" caused by image saturation directly destroys the authenticity and continuity of the color difference distribution, easily leading to serious missed detections or misjudgments, and ultimately affecting the final product quality control effect.
[0004] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] The purpose of this invention is to provide a color difference detection method for textiles based on image data. By using light intensity prediction and regional exposure control to achieve pixel-level brightness convergence, and combining color compensation to reconstruct the true color distribution, a closed-loop process is constructed by introducing model self-correction. This improves the detection accuracy and consistency of minute color differences in highly reflective fabrics, enhances automation and industrial applicability, and solves the problems mentioned in the background art.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting color difference in textiles based on image data, comprising the following steps: S1. Collect images of textiles with high reflectivity under a standard light source, construct a light intensity prediction model, analyze the pixel brightness distribution, identify brightness change regions and saturation critical regions, and generate an image-level saturation risk probability map. S2. Based on the image-level saturation risk probability map, perform multi-scale exposure region division on the image, set the target brightness range of each exposure control sub-region, and record the global exposure parameters of the image acquisition device as the initial baseline for exposure scheduling. S3. Based on the exposure control sub-region and the target brightness range, the shutter speed and gain parameters are iteratively adjusted in the region so that the actual brightness of each sub-region gradually approaches the target brightness range, thereby achieving brightness convergence of each exposure control sub-region. S4. After completing the brightness convergence of the exposure control sub-region, re-acquire the image, compare the brightness values before and after adjustment pixel by pixel, calculate the brightness response difference, identify pixels that deviate from the target brightness range, and generate color compensation requests for the deviating pixels. S5. Based on the color compensation request, construct a multi-dimensional color compensation matrix, and reconstruct the pixel-level color according to the spatial position of the deviated pixel, the brightness error and historical characteristics to restore the true color distribution. S6. Input the color-reconstructed image into the light intensity prediction model, update the brightness response relationship and risk weight, realize the dynamic self-correction of the model, and construct a closed-loop control process that includes modeling, regulation, verification, compensation and feedback.
[0007] Preferably, step S1 includes: Images of natural mulberry silk fabric, satin brocade fabric, and polyester blended fabric with silver-plated metallic threads embedded horizontally were acquired under standard light source illumination. Image acquisition parameters included illuminance of 1000 Lux, color temperature of 6500 K, exposure time of 4 ms, gain of 1.0, white balance in manual mode, and saved as 12-bit color depth RAW format images. The image is subjected to brightness channel extraction, normalization and Sobel gradient calculation. Combined with sliding window statistical analysis, the brightness change region and saturation critical region are identified, and a six-dimensional feature dataset of pixels is constructed. Based on the labeled brightness risk level, a light intensity prediction model is trained using a random forest regression algorithm to predict the saturation risk probability of each pixel. The prediction results are used to generate a two-dimensional image-level saturation risk probability map, and Gaussian filtering is used to improve spatial continuity and edge smoothness.
[0008] Preferably, step S2 includes: Based on the image-level saturation risk probability map, pixels are divided into three levels according to the saturation risk level, and the four-neighbor method is used to cluster connected components. The initial region boundary is extracted using the minimum bounding rectangle. The initial region is optimized by applying the graph cut segmentation method, merging regions smaller than 400 pixels and removing boundary noise to form multiple exposure control sub-regions with a size of not less than 64×64 pixels. Set a corresponding target brightness range for each exposure control sub-region, and adjust the target lower limit value in combination with the fabric reflectivity; Record the current exposure parameters of the image acquisition device and complete the consistency review of the mean and standard deviation of regional brightness. For areas that do not meet the conditions, perform boundary reshaping and brightness target update.
[0009] Preferably, step S3 includes: Read the current shutter speed and gain parameters of each exposure control sub-region, and evaluate the deviation between its actual brightness and the target brightness range; The scheduling path is set according to the direction of brightness deviation, the shutter speed and gain parameters are iteratively adjusted, and the exposure change constraints of adjacent sub-regions are set. After each round of parameter adjustment, a new image is acquired and the average brightness is calculated to determine whether it has entered the target range. If the requirements are not met, the next round of adjustment is continued. After all exposure control sub-regions have completed iterative scheduling, the final parameter results are recorded, and the successfully converged and failed regions are used for subsequent model learning and color reconstruction processing, respectively.
[0010] Preferably, step S4 includes: After completing the brightness convergence of all exposure control sub-regions, the image is re-acquired using the final adjustment parameters to generate the brightness adjustment result image; By comparing the brightness adjustment result image with the original image, the brightness response difference in each exposure control sub-region is calculated pixel by pixel, and a brightness difference image is constructed. Based on the target brightness range and brightness difference threshold, deviating pixels are identified, and isolated misidentified pixels are filtered out by spatial consistency constraints. Based on the coordinate position, brightness information and neighborhood features of the offset pixel, a color compensation request is generated, forming structured compensation task data and submitted to the color compensation processing flow.
[0011] Preferably, step S5 includes: Call the color compensation request list, extract the coordinate position, brightness information and texture features of each off-pixel, and construct a 5×5 neighborhood feature matrix centered on that pixel; Based on the direction and magnitude of the brightness error, combined with the neighborhood brightness gradient, texture consistency and color channel mean, a multi-dimensional color compensation matrix containing five channels: red, green, blue, brightness, and texture direction is generated. Based on the compensation matrix, perform up to five rounds of iterative color reconstruction for each off-target pixel, update the pixel brightness and color values, and perform Gaussian smoothing. After all pixel compensation is completed, the final compensated image and compensation analysis report are generated, and the pixels with stable error convergence are extracted for online training and updating of the light intensity prediction model.
[0012] Preferably, step S6 includes: Extract the compensated brightness value and the uncompensated brightness value of all pixels in each exposure control sub-region, and recalculate the region brightness response curve by combining the acquired parameters; The saturation risk weight of each exposure control sub-region is updated based on the statistical results of the brightness difference, and the regional brightness stability score is calculated. The updated brightness response curve and risk weight parameters are written into the light intensity prediction model, and the simulation verification process is executed to evaluate the change in the model's prediction accuracy. If the overall prediction error of the model decreases by more than 20%, the current model version will be marked as a stable enhancement model and used to replace the old version in subsequent image processing.
[0013] The technical effects and advantages provided by the present invention in the above technical solution are as follows: This invention identifies potential saturation areas by constructing a light intensity prediction model and performs zoned exposure control to achieve pixel-level brightness convergence, avoiding irreversible grayscale saturation in bright areas of the image. Simultaneously, through brightness difference comparison and color compensation matrix reconstruction, the brightness and color in the actual detected image more closely resemble the real fabric, improving the perception of subtle color differences, gradient transitions, and color differences in boundary areas. Furthermore, the model's self-correction mechanism enables the entire image acquisition and processing process to have continuous learning and adaptive adjustment capabilities, constructing a fully closed-loop process from exposure prediction, zone control, brightness restoration to model optimization. This significantly improves the automation, consistency, and industrial applicability of color difference detection, effectively supporting the precision detection needs of high-reflectivity textiles in key processes such as dyeing and finishing quality inspection and appearance grading. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0015] Figure 1This is a flowchart of the textile color difference detection method based on image data according to the present invention. Detailed Implementation
[0016] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that the description of this disclosure will be more complete and fully convey the concept of the exemplary embodiments to those skilled in the art.
[0017] This invention provides, for example Figure 1 The textile color difference detection method based on image data shown includes the following steps: S1. Collect image data of textiles with high reflectivity under a standard light source, construct a light intensity prediction model, perform dynamic analysis based on the pixel-level brightness distribution of the collected images, identify brightness change regions and saturation critical regions, and generate an image-level saturation risk probability map based on the analysis results. To address the brightness saturation issue that commonly occurs in image acquisition of highly reflective textiles, and to accurately extract true color information for color difference detection, the following steps are used to construct a light intensity prediction model and generate an image-level saturation risk probability map: Textile fabric samples with significant high reflectivity were selected, including natural silk fabrics with a smooth structure, brocade fabrics woven with a satin weave, and polyester blend decorative fabrics with horizontally inlaid silver-plated metallic threads. The fabrics were laid flat on a non-reflective background, and images were acquired under standard lighting conditions. The light source used was a CIE-compliant D65 artificial daylight box with a color temperature of 6500K and an illuminance of 1000 Lux. The angle between the light source and the textile surface was 45 degrees to create a non-direct high-brightness reflection effect and reduce the area of specular reflection. The image acquisition equipment was a 16-megapixel color industrial camera with a 1 / 1.8-inch image sensor, paired with a 35mm distortion-free lens. The image acquisition software locked the exposure time at 4 milliseconds, the analog gain at 1.0×, and the white balance in manual mode to avoid color temperature deviations caused by light source flicker or automatic adjustment. During acquisition, each image was saved in RAW format, retaining 12-bit color depth and brightness data to minimize brightness truncation loss.
[0018] The acquired raw images undergo luminance channel extraction and standardization. The RGB values of each pixel are converted to luminance values using a weighted coefficient formula: Y = 0.299R + 0.587G + 0.114B. After conversion, linear normalization is performed, mapping all pixel luminance values to between 0 and 1. Based on the normalized image, the Sobel gradient operator is used to calculate the luminance gradient values in both the horizontal (x-direction) and vertical (y-direction) directions, obtaining the gradient magnitude for each pixel. Subsequently, a 5×5 pixel sliding window is used to perform local region analysis on the image. Within each window, the maximum, minimum, mean, and standard deviation of pixel luminance are calculated, and the spatial location of each statistic is recorded. When the maximum luminance value within a window exceeds 0.95, the standard deviation of luminance within that region is less than 0.02, and the gradient magnitude is less than a set threshold (e.g., 0.01), it is marked as a "saturation critical region." Pixels with drastic luminance changes (gradient magnitude greater than 0.08), clear region boundaries, but luminance concentrated in the 0.8 to 1.0 range are marked as "luminance abrupt change regions." The brightness, gradient, and statistical features of all pixels are constructed into a six-dimensional feature vector and organized into a pixel feature dataset for subsequent modeling processing.
[0019] Based on the constructed pixel feature dataset, a supervised machine learning method was used to establish a light intensity prediction model. The random forest regression algorithm was selected as the prediction framework, where the training samples included the feature vector of each pixel in the acquired images and its corresponding brightness risk level label. The labels were divided into three levels: the first level was the "low-risk area," corresponding to brightness values between 0.4 and 0.8 with continuous gradients; the second level was the "medium-risk area," corresponding to brightness values between 0.8 and 0.95 with small local gradients; and the third level was the "high-risk area," corresponding to brightness values exceeding 0.95 with extremely small local brightness standard deviations, conforming to saturation characteristics. Cross-validation was used during training to ensure model stability, ultimately yielding a regression model that can be used to predict the brightness risk probability of pixels in any image.
[0020] The trained light intensity prediction model is applied to the image of the textile to be detected. For each pixel, its six-dimensional feature vector is input, and a saturation risk probability value between 0 and 1 is output. The prediction results of all pixels are mapped to a two-dimensional matrix, forming an image-level saturation risk probability map. This image has the same size as the original image and possesses pixel-wise risk representation capabilities. To improve the spatial continuity and edge smoothness of the risk map, a Gaussian kernel function is used for convolution filtering with a filter window size of 7×7 and a standard deviation of 1.2. The final processed saturation risk probability map accurately locates and quantifies the bright saturated regions without destroying the original texture boundaries, providing crucial data support for subsequent exposure area segmentation, dynamic parameter adjustment, and color compensation strategy formulation.
[0021] The core function of this step is to lay the foundation for subsequent precise and dynamic image exposure control and color compensation. Specifically, it involves using high-precision image brightness modeling to identify areas in the image that are excessively bright or have potential saturation risks in advance, thereby proactively avoiding color distortion caused by local brightness saturation during image acquisition. When dealing with textiles with high reflectivity (such as silk, satin, and woven fabrics with metallic threads), their surfaces easily form bright reflective areas under standard light source illumination. These areas often cause the image sensor's light-sensing range to reach the saturation threshold, resulting in pixel brightness values being fixed at the maximum grayscale value (e.g., 255), thus causing color information loss. By constructing a light intensity prediction model and performing pixel-level brightness distribution analysis on the image, we can deeply analyze the brightness level, variation trend, and neighborhood characteristics of each pixel in the entire image. Furthermore, by combining the spatial distribution and saturation critical characteristics of brightness abrupt change areas, we can generate an image-level saturation risk probability map, which can accurately identify high-risk areas in the image, making the subsequent exposure parameter adjustment process data-driven and targeted. The essence of this step is to establish the ability to actively detect and quantitatively assess image brightness risks at the perception level, breaking away from the traditional passive strategy that relies on uniform exposure and global judgment, thereby significantly improving the robustness, accuracy and adaptability of textile image color difference detection systems under complex lighting conditions.
[0022] S2, based on the image-level saturation risk probability map, performs multi-scale exposure region division on the image, divides the image into multiple exposure control sub-regions, sets the target brightness range of each exposure control sub-region for different exposure risk levels, and records the current global exposure parameter status of the image acquisition device as the initial parameter baseline for exposure scheduling control. Based on the image-level saturation risk probability map generated in the previous step, in order to achieve exposure accuracy control in different areas of high-reflectivity textile image acquisition and ensure the accuracy of subsequent color reconstruction, the following steps are adopted to complete the multi-scale exposure area division of the image, target brightness setting and device initial exposure state recording.
[0023] The image-level saturation risk probability map is traversed pixel by pixel, and the saturation probability value of each pixel is classified into risk levels according to fixed numerical thresholds. Three fixed thresholds are set: low risk corresponds to a saturation probability value between 0.00 and 0.40; medium risk corresponds to between 0.41 and 0.70; and high risk corresponds to between 0.71 and 1.00. All pixels that meet the same risk level and are spatially adjacent are considered as candidate exposure control regions. The four-neighbor method based on connected component analysis is used to cluster adjacent pixels into an initial region set, and then the spatial boundaries of each initial region are extracted using the minimum bounding rectangle method. To further enhance the regularity of the region shape and the integrity of spatial coverage, the graph-cut method is used to optimize the initial region set, merging isolated sub-regions smaller than 400 pixels, and removing boundary noise points using an area threshold method. Finally, the image is divided into multiple exposure control sub-regions with independent spatial boundaries, clear risk level identification, and a size of not less than 64×64 pixels.
[0024] The four-neighborhood method based on connected component analysis is an image processing technique used to identify and cluster pixel regions in an image that have similar features and are adjacent to each other. A "four-neighborhood" refers to a situation in a two-dimensional pixel plane where each pixel is adjacent to only the pixels in its four cardinal directions (up, down, left, and right, excluding diagonals). In other words, if a pixel's grayscale or probability value satisfies a specific condition, and any pixel above, below, to its left, or to its right also satisfies the same condition, then the two are considered to belong to the same connected component. Connected component analysis identifies all continuous regions composed of similar pixels in the entire image based on these adjacency relationships and numbers and categorizes them as independent pixel sets.
[0025] In this step, the main function of the four-neighbor connected component analysis is to cluster spatially continuous pixels with similar risk levels (such as high risk) in the image-level saturation risk probability map into initial exposure control sub-regions, thereby providing basic region units for subsequent spatial boundary extraction and exposure target configuration.
[0026] The specific implementation steps are as follows: Traverse the entire saturation risk probability map, judge each pixel, and mark it as a candidate pixel if its saturation probability value exceeds the set threshold (e.g., 0.7). Starting from the top left corner of the image, scan the image in row priority order, and check whether the pixels above and to the left of each candidate pixel are also candidate pixels; If there are adjacent markers, the current pixel is assigned to an existing connected region; if there are no adjacent markers, a new connected region number is created. After the entire image scan is completed, duplicate or intersecting markers are merged into a unified number through a region merging operation, resulting in several spatially contiguous initial regions with consistent risk levels. Each set represents a group of spatially connected pixels with similar saturation risk values, serving as the input basis for subsequent minimum bounding rectangle extraction and graph cut optimization.
[0027] The key significance of this method lies in the fact that it establishes a regional holistic recognition mechanism through the most basic local adjacency relationship, and achieves efficient and structured preliminary region division with low computational cost. It is an indispensable spatial clustering step in the entire image local exposure control process.
[0028] The "Minimum Bounding Rectangle" (MBR) is the smallest rectangle in a two-dimensional plane that can enclose an irregular image region or set of pixels. The edges of this rectangle are not necessarily parallel to the coordinate axes, but can be adaptively rotated according to the region's principal direction. Its essential function is to tightly enclose complex-shaped regions with a simple, regular geometric structure, facilitating subsequent spatial processing, size calculations, normalization analysis, or region cropping.
[0029] In this step, the purpose of using the minimum bounding rectangle is to extract the spatial boundary of the initial exposure control sub-region, so that subsequent operations such as exposure adjustment, brightness target allocation, and scheduling calculation of the region can be performed within a regular and closed geometric boundary, avoiding control interference or efficiency reduction caused by irregular region shape, broken boundary, and blurred outline.
[0030] In the specific implementation process, the steps for extracting the minimum bounding rectangle are as follows: For pixels in the image that have been marked by a saturation probability map, a four-neighbor or eight-neighbor connected component analysis method is used to extract a set of single regions formed by all connected pixels; the pixel coordinates within each region are organized into a two-dimensional coordinate point set, for example, the point set corresponding to region A is... For each set of points, calculate its convex hull, which is the smallest convex polygon that can enclose all points. This step can be implemented using Graham scan or Andrew's algorithm. The convex hull is used to eliminate the influence of concave boundaries and build a stable contour. Iterate through all possible convex hull boundary directions, rotate the entire point set with each direction as the reference, calculate the area of the rectangle enclosing all points under the rotation direction, and record the direction with the smallest area. The smallest rotating rectangle is restored to the original image coordinate system, yielding the smallest bounding rectangle of that region. Its output information includes the coordinates of the rectangle's center point, side length, rotation angle, and the coordinates of its four vertices. This bounding rectangle can then serve as the boundary basis for this exposure control sub-region, defining the range of adjustment and the sampling area.
[0031] In short, the core value of the minimum bounding rectangle here lies in transforming irregular highlight areas into regular, compact, and controllable rectangular boundary structures, providing precise spatial boundary expressions for region division and parameter configuration, and enhancing the stability and execution efficiency of subsequent exposure control processes.
[0032] Graph cut segmentation is a graph-based image segmentation method. Its core idea is to represent pixels in an image as nodes in a graph structure, establish edge weights based on the similarity between pixels (such as color, brightness, and texture), and then use a minimum cut algorithm to find a cut edge in the graph to divide the image into foreground and background or multiple regions. This method achieves optimal pixel partitioning by solving for the minimum energy cut of the graph, and has advantages such as accurate boundaries, coherent structure, and strong segmentation robustness. It is particularly suitable for processing image objects with complex boundaries, blurred regions, or irregular shapes.
[0033] In this step, the main function of graph cut segmentation is to optimize and adjust the spatial boundaries of the initial exposure control sub-region. Since the regions obtained through saturation probability maps and connected component analysis often suffer from problems such as boundary spikes, isolated pixels, and fragmented areas, directly using these initial results can lead to discontinuous, excessively small, or abnormally shaped exposure control regions, affecting the accuracy and computational efficiency of subsequent exposure control. By introducing graph cut segmentation, an energy function can be established between the brightness consistency of pixels within a region and the contrast gradient of boundary pixels. By minimizing this energy function, a final exposure control sub-region with smooth boundaries, coherent structure, and clear demarcation is obtained. This method effectively improves the stability and spatial structure rationality of region division, and is an important supporting means for achieving fine-grained local exposure control of images.
[0034] Based on the risk level of each defined exposure control sub-region, a specific target brightness range is set for it. The target brightness is defined as a normalized value: for low-risk sub-regions, the brightness range is set to 0.45 to 0.65 to ensure overall image contrast and detail; for medium-risk sub-regions, the target brightness range is 0.35 to 0.55 to ensure color stability; and for high-risk sub-regions, the target brightness range is strictly controlled between 0.25 and 0.45 to actively suppress the brightness response and avoid information loss caused by the sensor's upper brightness limit. Furthermore, for three fabrics used in the sample—silk satin, satin polyester, and metallic woven fabric—the average reflectance was measured to be 78%, 69%, and 83%, respectively. The lower limit of the brightness target is adjusted according to the average reflectance of different fabrics. For fabrics with a reflectance exceeding 80%, the target lower limit is lowered by 5% to reserve room for dynamic adjustment. These brightness targets are bound to each exposure control sub-region through an image processing parameter configuration table and serve as important input parameters for the next exposure scheduling strategy.
[0035] After completing the area division and target brightness configuration, the current exposure status of the image acquisition device is fully recorded and used as the initial baseline for exposure scheduling. Specific parameters include: shutter speed of 4.0 milliseconds (locked via hardware timing signal), lens aperture fixed at F2.8 (manually set using a 25mm industrial lens), analog gain set to 1.0× (i.e., no gain), image sensor ISO set to 100, image resolution of 4096×2160 pixels, and image output color depth of 12 bits. White balance gain is set to 1.20 for the red channel, 1.00 for the green channel, and 1.15 for the blue channel. All parameters are read in real time by the image acquisition control program through the API interface and written into a structured parameter record table. Each parameter is associated with the image sequence number (e.g., IMG20250729_001), the acquisition timestamp (e.g., 2025-07-29 14:06:35), the current illuminance value (measured at 1023 Lux), and the light source color temperature label (D65-6500K), ensuring that the parameters correspond one-to-one with the image data.
[0036] After completing the division of all exposure control sub-regions, configuring brightness targets, and recording initial parameters, a consistency review of the division results is conducted. The review includes two aspects: first, verifying the current average brightness of each sub-region to determine if it exceeds the upper or lower limits of the set brightness range. The average brightness is calculated by averaging normalized brightness values within the region; if the deviation exceeds ±10%, the region is marked as requiring reconstruction. Second, measuring the standard deviation of brightness within each sub-region. If the standard deviation is less than 0.02, it indicates that the region's brightness is too concentrated, easily leading to local saturation distortion. For sub-regions that do not meet the above two conditions, a spatial range reshaping operation is performed, expanding the sub-region boundary to 20 pixels from the adjacent region, and the risk level is re-labeled. The reshaped region is then reconfigured with target brightness ranges and parameter records are updated to ensure that all regions are physically coherent, have balanced brightness distribution, and are closed in parameter states, providing clear boundaries and precise starting states for subsequent multi-region exposure scheduling control.
[0037] The core function of this step is to achieve precise image space division and formulate differentiated exposure control strategies, providing structured and executable basic information support for subsequent multi-region dynamic exposure scheduling and pixel-level color reconstruction. In image acquisition of high-reflectivity textiles, due to the complex optical properties of the fabric surface, different regions may exhibit significant brightness differences under the same exposure parameters, leading to overexposure and saturation in some areas while underexposure in others, directly affecting the accuracy of color difference detection. To address this issue, this step introduces an image-level saturation risk probability map to predict and assess the brightness risk of each pixel in the image. Based on the assessment results, multi-scale exposure region division is performed, dividing the entire image into several exposure control sub-regions with clear spatial boundaries and brightness risk levels. Differentiated target brightness ranges are set for regions with different risk levels; for example, high-risk regions use lower target brightness to avoid saturation, while low-risk regions use neutral brightness to ensure image details. After the area division and brightness target setting are completed, the current global exposure status of the image acquisition equipment is fully recorded, including shutter speed, analog gain, aperture value, ISO, resolution, color depth, and white balance parameters. These parameters constitute the initial reference baseline used for adjustment and calculation in the subsequent dynamic exposure scheduling process. Through this process, not only is the image spatial structure closely linked to the risk level, but the equipment status is also quantitatively correlated with the target brightness, forming a controllable, adjustable, and iterative exposure area configuration framework. This step logically follows the image risk modeling output and lays a complete regional structure and parameter benchmark for the next step of exposure scheduling execution, which has important supporting significance and practical application value.
[0038] S3, based on the division results of the exposure control sub-regions and the corresponding target brightness range, performs multi-region exposure scheduling operation, continuously iteratively adjusting the shutter time and gain parameters of each exposure control sub-region, controlling the actual brightness of each exposure control sub-region to gradually approach the preset target brightness range, and realizing the brightness convergence of each exposure control sub-region; Based on the aforementioned multi-scale exposure region division results and the target brightness range corresponding to each exposure control sub-region, in order to achieve dynamic coordination and regional approximation control of the brightness of each region in the textile image, the following steps are adopted to perform multi-region exposure scheduling operations to ensure that the final brightness of all sub-regions converges to within the preset target range.
[0039] For each exposure control sub-region, the exposure record table of the current image acquisition device is called to read the specific acquisition parameters used in the associated image of that region. These parameters include a shutter speed setting of 4.0 milliseconds, a lens aperture of F2.8, an analog gain factor of 1.0, an image sensor ISO sensitivity of 100, an image output resolution of 4096×2160 pixels, and a color depth of 12 bits. Next, the actual brightness of each exposure control sub-region in the image is evaluated to obtain the normalized average brightness value of that region under the current exposure condition. For example, the normalized average brightness value measured for sub-region ECR-03 is 0.62, corresponding to a target brightness range of 0.45 to 0.65, which is considered high; the average brightness of sub-region ECR-07 is 0.21, corresponding to a target range of 0.25 to 0.45, which is considered low. The brightness deviation values and offset directions of all sub-regions are recorded one by one and used as input data for subsequent parameter adjustments.
[0040] Based on the above evaluation results, an exposure scheduling path was set for each sub-region, specifying the parameters to be adjusted, the adjustment direction, and the iteration step size. When the brightness of a sub-region is higher than the target upper limit, the shutter speed reduction operation is initiated first, specifically by reducing it by 0.4 milliseconds per iteration, for example, from 4.0 milliseconds to 3.6 milliseconds, 3.2 milliseconds, 2.8 milliseconds, 2.4 milliseconds, and 2.0 milliseconds, with a maximum reduction to 1.2 milliseconds. If the shutter speed has reached the lower limit and still cannot reduce the brightness, the analog gain coefficient is further adjusted, decreasing by 0.2 times per iteration, successively to 0.8 times, 0.6 times, and 0.4 times, with a minimum reduction to 0.2 times. Conversely, when the brightness of a sub-region is lower than the target lower limit, the operation is reversed, increasing the shutter speed by 0.4 milliseconds per iteration, with a maximum of 6.0 milliseconds. If the upper limit has been reached and the brightness is still insufficient, the gain coefficient is increased by 0.2 times per iteration, with a maximum increase to 2.0 times. In addition, to avoid excessive exposure differences between adjacent sub-regions, a constraint condition for exposure change at the region boundary is set during the scheduling path calculation process, stipulating that the final shutter speed difference between two adjacent sub-regions shall not exceed 1.2 milliseconds and the gain difference shall not exceed 0.6 times.
[0041] Iterative exposure control is performed on each sub-region according to the scheduling path. In each iteration, the exposure parameters for the sub-region are updated first, then a new image frame is acquired, and the average brightness value of the sub-region in the latest image is calculated in real time. If the value still does not fall within the target brightness range, the next adjustment round continues; if it has entered the target range, the region is marked as "convergence complete". Taking ECR-07 as an example, its brightness is 0.21 at an initial shutter speed of 4.0 ms and a gain of 1.0. After two iterations to adjust to a shutter speed of 5.2 ms and a gain of 1.4, its brightness value reaches 0.34, which meets the set target range of 0.25 to 0.45, and is marked as "convergence complete". The acquisition interval for each adjustment round is set to 30 ms to ensure device data synchronization and image stability. If the target brightness range is not reached after five consecutive iterations, the sub-region is marked as "convergence failed" and transferred to the subsequent color compensation stage for processing.
[0042] After all sub-regions have completed exposure iteration scheduling, an exposure control result record table is generated, including the sub-region number, the final shutter speed value used, the final gain coefficient, the number of adjustment rounds, the final brightness value, and the brightness deviation error. The parameter values of all successfully converged sub-regions are input into the self-learning mechanism of the light intensity prediction model to update the brightness response mapping relationship of each region in the model. The boundary information and final deviation values of all sub-regions that fail to converge are encapsulated into a set of deviation pixels, serving as the input basis for the subsequent pixel-level color reconstruction module. This method achieves a complete closed-loop control process from setting regional brightness targets to executing parameter control and then to providing brightness result feedback, ensuring exposure consistency and color reproduction capability of each region in the image under varying lighting and complex texture conditions.
[0043] The main function of this step is to achieve personalized exposure parameter adjustment and precise brightness control for different regions of the image, ensuring that the actual brightness value of each exposure control sub-region gradually converges to its preset target brightness range, providing a reliable image foundation for subsequent color compensation and color difference detection. When acquiring images of textiles with high reflectivity, the significant differences in light reflection characteristics across different regions of the fabric mean that using uniform exposure parameters often results in overexposure in some areas and underexposure in others, leading to uneven brightness distribution, color distortion, and loss of local information, severely impacting subsequent image analysis and color difference recognition. To address this issue, this step dynamically adjusts the shutter speed and gain parameters for each exposure control sub-region based on the previous region segmentation results and brightness target settings. Through a continuous iterative optimization mechanism, the adjustment direction and magnitude are determined based on the difference between the current region's brightness and the target brightness, gradually modifying the acquisition parameters for each region, and re-acquiring images after each round of adjustment for brightness verification. This process is spatially independent and targeted in its control, effectively bridging exposure errors caused by inconsistent lighting performance in different parts of highly reflective fabrics. This results in stronger brightness uniformity and detail retention in the entire image at the source. Furthermore, by dynamically evaluating brightness deviation, exposure response trends, and parameter adjustment stability across multiple iterations, it enables the marking and control transfer of areas that are difficult to converge, constructing an exposure adaptive framework centered on closed-loop brightness control. This step not only optimizes image input quality but also provides a realistic lighting benchmark for subsequent pixel-level color reconstruction and color difference calculation, demonstrating significant practical value and technological innovation.
[0044] S4. After completing the brightness convergence of the exposure control sub-region, the image is re-acquired and updated. Based on the updated image, the pixel brightness value in each exposure control sub-region is compared with the pixel brightness value of the original image pixel by pixel. The brightness response difference of each pixel is calculated, the pixels that deviate from the target brightness range are identified, and a color compensation request for the deviating pixels is generated based on the identification result. To further improve the color accuracy and pixel-level brightness reproduction quality of the image, after completing the brightness convergence adjustment of all exposure control sub-regions, a comparative analysis operation based on the pixel brightness response difference is performed. Based on this, pixels that deviate from the target brightness range are identified, and finally, a targeted color compensation request is generated. The specific steps are as follows: After adjusting the brightness parameters of all exposure control sub-regions and confirming that the brightness of each region has reached the preset convergence condition, the image acquisition device is restarted to update and acquire a complete image. At this point, the image acquisition parameters are the final adjusted shutter speed and gain coefficient combination for each sub-region. Specifically, for example, the acquisition parameters used for region ECR-02 are a shutter speed of 3.2 milliseconds and a gain coefficient of 1.2; the parameters used for region ECR-05 are a shutter speed of 5.6 milliseconds and a gain coefficient of 0.8. All region parameter combinations are loaded into the acquisition control program, and the image is saved in 12-bit RAW format after acquisition to ensure complete brightness information without compression or distortion. This updated image serves as the "brightness adjustment result image" for subsequent comparative analysis.
[0045] The "brightness adjustment result image" is read and compared with the previously acquired "original image," and pixel-level alignment is performed according to each exposure control sub-region. Each pixel is numbered according to the image resolution (e.g., 4096×2160 pixels), and all pixels within each sub-region are matched one by one, extracting their grayscale brightness values from the original image and the updated image. Subsequently, the brightness response difference for each pixel is calculated, i.e., the absolute value of the brightness change before and after exposure adjustment. For example, in region ECR-03, the brightness of pixel number 758×1024 decreases from the original value of 230 to the updated value of 185, a difference of 45. This brightness difference serves as the basis for subsequent deviation identification. All pixel differences are recorded as a difference matrix and mapped back to the image coordinate space to construct a brightness difference image.
[0046] Off-target pixel identification is performed based on the brightness difference image. According to the preset target brightness range for each sub-region, each pixel is sequentially determined to be in an off-target state. If the brightness value of a pixel in the updated image is higher than the target upper limit or lower than the target lower limit, and its brightness difference from the original image exceeds 20 grayscale units (approximately 0.78% of the full range for a 12-bit image), it is marked as an "off-target pixel." For example, in the region numbered ECR-05, a total of 834 off-target pixels were identified, and their location coordinates, deviation direction (too bright or too dark), brightness difference magnitude, and the average value of their neighboring pixels were recorded. To prevent isolated noise pixels from being misidentified, a spatial consistency constraint is introduced, requiring that an off-target pixel have at least four neighboring pixels with the same deviation direction in a 3×3 neighborhood to be considered valid. This determination method eliminates misidentifications caused by acquisition errors, noise interference, or single-pixel flicker.
[0047] Based on the identified set of off-target pixels, color compensation requests are generated and organized into structured compensation task data. Each pixel entry in the compensation request includes its image coordinates, actual brightness value, target brightness range, original brightness value, neighborhood statistical features, pixel material label (if previously extracted through texture recognition), and brightness response trend. All off-target pixel entries are integrated to form a "color compensation request list," serving as input for subsequent pixel-level color reconstruction operations. Simultaneously, compensation requests are categorized by region number to form a region-level color compensation task set, facilitating the parallel execution of compensation strategies by region. After the compensation request generation is complete, it is submitted to the entry point of the color compensation control process, marking the transition from the brightness adjustment stage to the color restoration stage based on response differences.
[0048] This step aims to perform pixel-by-pixel verification and identification of out-of-range pixels to achieve accurate exposure control. This provides a data foundation and entry point for subsequent precise color compensation, ensuring that residual brightness anomalies in the image can be effectively identified and repaired. Although the brightness convergence control of each exposure control sub-region has been achieved in the previous steps, due to the complex surface material structure and uneven texture reflectivity of textiles, coupled with the nonlinear response or physical sampling errors of the image sensor, some pixels may still fail to accurately fall within the target brightness range, thus affecting the overall color consistency and regional transition smoothness of the image. Therefore, this step involves re-acquiring an updated image containing the actual imaging results under the final exposure parameter settings of the device. Subsequently, by comparing the updated image with the initial image pixel by pixel and calculating the brightness response difference of each pixel, it is possible to accurately identify key pixels that still deviate from the target brightness range after adjustment. These pixels may have failed to be effectively controlled during the parameter adjustment stage due to high light reflection, sudden brightness changes, or texture anomalies. By setting reasonable brightness deviation thresholds and spatial consistency judgment conditions, these out-of-range pixels are screened and confirmed, forming a high-confidence set of abnormal pixels. Building upon this foundation, a color compensation request is further generated, containing complete fields such as offset position, brightness error magnitude, neighborhood information, and material identifiers, providing structured input for the next step of color reconstruction. This step not only achieves authenticity verification after the brightness control loop is closed, but also constructs an operational channel for further image quality improvement. It serves as a crucial bridge connecting exposure control and color reconstruction, possessing high practicality, operability, and technological advancement.
[0049] S5, based on the color compensation request, performs color compensation operation across the entire image. Based on the spatial location of the deviated pixels, the brightness error amplitude, and the pixel features in the early stage of image acquisition, it constructs a targeted multi-dimensional color compensation matrix, performs pixel-level color reconstruction on each deviated pixel, and restores the true color distribution of each deviated area in the image. To address the issue of some pixels in high-reflectivity textile images failing to reach the target brightness range after exposure adjustment, and to effectively improve the overall color reproduction quality and regional consistency of the image, pixel-level color compensation is performed across the entire image based on the generated color compensation request. The compensation operation is performed on each pixel marked as deviating, and a multi-dimensional color compensation matrix is constructed by integrating its spatial location, brightness error magnitude, texture direction, neighborhood statistical features, and original brightness sampling data. Pixel-level color reconstruction is then performed based on this matrix. The entire process consists of the following specific steps: The system retrieves the color compensation request list output from the previous stage. This list records detailed information for each off-target pixel in a structured format, including the image's horizontal coordinate (X), vertical coordinate (Y), current brightness value (range 0–4095, 12-bit grayscale), target brightness upper and lower limits (e.g., 1450–1850), initial acquired brightness value (e.g., 1675), brightness deviation value (e.g., +280), neighborhood average brightness (e.g., 1532), texture direction principal axis (e.g., 135 degrees), and region type label (e.g., high-reflectivity fabric / metallic fabric). First, the entire list is traversed, mapping all off-target pixels to the updated image coordinate system. Then, an 8-pixel extension is applied to the image edge regions using coordinate range expansion to ensure each target pixel is within its complete neighborhood environment for subsequent analysis.
[0050] For each off-center pixel, a 5×5 pixel neighborhood matrix is constructed centered on that pixel. Within this neighborhood, the following feature fields are extracted: current brightness values of 25 pixels, initial brightness values of 25 pixels, brightness gradient values (rates of change in the horizontal and vertical directions), brightness difference between each pixel and the center point, texture principal direction consistency metric (calculated based on the pixel-level gray-level co-occurrence matrix), and the average color channel values within the neighborhood (R, G, and B are the average values of all pixel channel values within the 5×5 window). Based on this, according to the error direction (brighter or darker) and error magnitude level of the off-center pixel (e.g., mild: <200, moderate: 200–400, severe: >400), corresponding weights are assigned using a feature mapping algorithm to generate a multi-dimensional color compensation matrix for that pixel. This matrix consists of five channels: red, green, blue, brightness, and texture direction. Each channel contains a 5×5 weight submatrix to determine the influence weight of each neighboring pixel during the compensation process.
[0051] Based on the constructed compensation matrix, color reconstruction is performed on each deviating pixel. Taking brightness compensation as an example, when the target pixel is too bright, pixels in its neighborhood with brightness below the average are used as the main reference, and a lower value is injected into the center pixel according to the weights assigned by the matrix; when the pixel is too dark, the process is reversed. In R, G, and B channel compensation, each channel is calculated independently. The neighborhood values are weighted and averaged according to the weight matrix of that channel, and then combined with the original value of the center pixel. Iterative adjustments are made by updating the step size at a ratio of 0.25. The maximum change in each round must not exceed ±15 gray units (approximately 0.37% in 12-bit color depth). After each iteration, the deviation between the current pixel and its target brightness range is recalculated. If the error is lower than the set threshold (±10 gray units), the compensation is considered complete, and the process proceeds to the next pixel; if it does not converge, the iteration continues, with a maximum of 5 rounds. To ensure natural transitions at image edges, a first-order Gaussian smoothing process is applied to the color difference between compensated pixels and their surrounding uncompensated pixels. The convolution kernel size is set to 3×3 with a standard deviation of 1.0 to prevent edge breakage or color jumps.
[0052] After all offset pixels have been compensated, the final color-compensated image is synthesized, and a compensation analysis report is generated. The report includes detailed statistical indicators such as: the total number of compensated pixels (e.g., 8324), the average brightness error of compensated pixels (e.g., ±6.2 gray units), the maximum single-point color change (e.g., 28 units), the most common compensation direction (brighter or darker), and the compensation convergence rate for each region (e.g., 98.4% for region ECR-06). Pixel-level difference analysis is performed between the compensated image and the original updated image to generate a difference visualization for manual quality control and model feedback. A set of pixels with high error convergence stability (error convergence ≤ ±5 units, completed within 3 rounds) is sampled and marked as "high-confidence samples," and input into the online training process of the light intensity prediction model to update the model's exposure-brightness response function and local structure stability reference data, improving the local accuracy of future illumination prediction.
[0053] The core function of this step is to restore the true color distribution of local areas of the image by performing pixel-level color reconstruction on pixels that deviate from the target brightness range. This achieves a unified approach to color accuracy, regional consistency, and structural continuity at the overall image level, ensuring that the final image meets the technical requirements for high-precision color difference detection. After multi-region exposure control of high-reflectivity textile images, although most areas can achieve brightness convergence, due to factors such as the complex local texture structure of the fabric, strong reflectivity, and nonlinear response of the image sensor, a small number of pixels may still fail to accurately enter the target brightness range, forming color offset areas. If these pixels are not processed, they may cause missed detections or misjudgments in subsequent color difference calculations, thus affecting the reliability of the overall quality inspection results. Based on the color compensation request list generated in the previous step, this step uses each deviating pixel as an execution unit. It integrates its spatial location, actual brightness error amplitude, neighborhood brightness structure, and pixel feature information from the original acquisition stage (including brightness, texture direction, color gradient, etc.) to construct a multi-dimensional color compensation matrix with directional and structural awareness capabilities. Using this matrix as a weight template, the R, G, and B channel values of the deviating pixels are finely adjusted. By introducing texture, structure, and color transition information into the local neighborhood through this compensation matrix, the repaired pixels not only meet the target brightness requirements but also maintain consistency with surrounding pixels in color and edge structure, avoiding image "patchwork marks" or edge abrupt changes. Ultimately, this step not only effectively fills the technical gap in the control stage but also constructs a closed-loop process from exposure control to color restoration. It is a key technical support link for ensuring image quality integrity and color difference detection accuracy, possessing significant application value and technological innovation.
[0054] S6 inputs the image after pixel-level color reconstruction into the light intensity prediction model, updates the brightness response relationship and saturation risk weight parameters of each exposure control sub-region in the light intensity prediction model, realizes dynamic self-correction of the light intensity prediction model, and forms a closed-loop control process consisting of light intensity modeling, regional exposure control, brightness verification analysis, color reconstruction compensation and model feedback update. To achieve a dynamic adaptive update mechanism for high-reflectivity fabrics during image exposure and brightness control, and to ensure that the light intensity prediction model can accurately predict the brightness response trend and saturation risk changes in different areas during subsequent acquisition, the following steps are adopted to complete the update operation of feeding back the pixel-level color reconstruction image to the light intensity prediction model, and to realize a closed-loop control process of five stages: light intensity modeling, regional exposure control, brightness verification analysis, color reconstruction compensation, and model feedback update.
[0055] The final image, after pixel-level color reconstruction, is used as the model's feedback input image. This image is stored in 4096×2160 pixel, 12-bit color depth RAW data format. Acquisition parameters include regional shutter speed settings (e.g., 3.6 ms for ECR-03 region, 5.2 ms for ECR-05 region), analog gain coefficients (1.2x and 0.8x respectively), a fixed lens aperture of F2.8, a D65 standard light source, an illuminance of 1000 Lux, and a color temperature of 6500K. The image is divided into exposure control sub-regions, with each region stored as an independent tile. Simultaneously, the final brightness value, pre-compensation brightness value, initial brightness sample value, and pixel brightness change trend label for each pixel are extracted and organized into a structured data matrix based on spatial coordinates. This matrix is then bound to the region number and used to update the region's brightness response record.
[0056] For each exposure control sub-region, the compensated brightness data of all pixels within the region is extracted and combined with previously acquired parameters to recalculate the brightness response curve for that region. Taking region ECR-07 as an example, its target brightness range is 1450–1850 (12-bit grayscale value). The average brightness before compensation is 1960, and after compensation, it is adjusted to 1742. This result was obtained by adjusting the shutter speed from 4.8 ms to 5.6 ms and increasing the gain from 0.9x to 1.1x. Based on this, the brightness change trend curve of this region is refitted to generate an updated brightness prediction function. This curve is then interpolated to the range of all possible parameter configurations to construct a 5-dimensional control parameter grid (shutter speed, gain, texture type, local brightness gradient, and sampled area reflectivity). A multi-dimensional brightness response table is then established based on this grid. This table serves as a direct reference for subsequent models to predict the brightness behavior of this region.
[0057] Statistical analysis was performed on pixel sets within each exposure control sub-region where the brightness difference before and after compensation exceeded 200 grayscale units, identifying regions with significant fluctuations in saturation trends. For example, region ECR-06 had an original saturated pixel ratio of 12.7%, which decreased to 3.2% after compensation. Accordingly, the original regional saturation risk weight was reduced from 0.88 to 0.62, and this weight value was added to the corresponding region configuration item in the model parameter set. For regions with the opposite trend, such as region ECR-04 where boundary overexposure occurred after compensation, and the proportion of overexposed pixels increased to 9.6%, the saturation risk weight was increased from 0.74 to 0.86. Simultaneously, based on the pixel brightness distribution variance, maximum brightness gradient value, and brightness jump value of edge pixels within the region, a regional stability score (out of 10) was recalculated. This score served as the basis for determining whether to implement a manual review strategy for future automatic exposure adjustments in that region. When the regional score is below 6.5, a control protection strategy will be activated in the next round of prediction, adopting a more conservative brightness target range.
[0058] After updating the brightness response relationships and risk weights for all regions, the entire light intensity prediction model undergoes structural reconstruction and self-learning weight adjustment. All updated regional brightness response tables and weight matrices are written into the model's core function library, and a five-round model simulation verification process is implemented. The specific verification method is as follows: Five sets of textile fabric samples with clear reflective characteristics are selected from historical data: polyester satin, silk brocade, metallic wire blended fabric, pearlescent coated fabric, and cationic inlaid fabric. Light intensity prediction is performed using both the pre-update and post-update models under standard light sources and 1000 Lux illuminance, generating corresponding exposure parameter configurations. Actual images are collected, and the brightness prediction error rate is measured. The improvement in prediction accuracy before and after model optimization is recorded in the model performance log. For example, in the ECR-05 region, the average prediction error before the update was 83.4 gray units, which decreased to 37.8 gray units after the update, representing an accuracy improvement of 54.7%. If the overall model performance improvement rate exceeds 20%, the current model version is marked as a "stable enhanced model," and it replaces the old version in the next batch of image processing tasks.
[0059] The core function of this step is to achieve dynamic self-correction and continuous optimization of the light intensity prediction model in the image acquisition system, thereby constructing a complete, stable, and high-precision closed-loop process for image brightness control. This further improves the accuracy, consistency, and robustness of textile color difference detection results based on image data. After pixel-level color reconstruction, color deviations in the image caused by saturation, high reflectivity, or sudden changes in local brightness have been effectively corrected, and the image brightness distribution and color state are closer to the actual physical reflection characteristics. Therefore, re-inputting the repaired image into the light intensity prediction model not only provides the model with a "post-processed sample of the actual brightness performance" but also helps the model identify the difference between the actual response effect and the predicted value under the current exposure control parameters. Through this feedback, the model can readjust its brightness response curve for each exposure control sub-region, making future brightness predictions under the same parameter configuration closer to the actual results. At the same time, by analyzing the saturation distribution trend, error magnitude, and structural stability of pixels within the region, this step can also dynamically adjust the saturation risk weight of each region in the model, thereby avoiding possible local overexposure problems in advance during the next round of image acquisition and improving the model's adaptability in complex fabric scenarios. Furthermore, this step integrates the updated response relationship and risk parameters into the model structure, and uses verification simulations to evaluate and replace the model version's accuracy, ultimately constructing an intelligent exposure control system with self-learning and self-adjustment capabilities. This closed-loop process starts with light intensity modeling, proceeds through regional exposure control, brightness verification, and color compensation, and finally optimizes the model itself in reverse, forming a technical system that combines forward execution and reverse correction. This provides continuous and reliable technical support for color difference detection of complex textures and high-reflectivity textiles, demonstrating high technological innovation and industrial application value.
[0060] The image-based textile color difference detection method described above effectively solves the problem of local pixel saturation caused by strong light reflection from the surface of highly reflective fabrics during traditional image acquisition, significantly improving the accuracy and robustness of color difference detection for high-gloss fabrics. This method identifies potential saturation areas by constructing a light intensity prediction model and performs zoned exposure control to achieve pixel-level brightness convergence, avoiding irreversible grayscale saturation in bright areas of the image. Simultaneously, through brightness difference comparison and color compensation matrix reconstruction, the brightness and color in the actual detection image more closely resemble the real fabric, enhancing the perception of subtle color differences, gradient transitions, and color differences in boundary areas. Furthermore, the model's self-correction mechanism enables the entire image acquisition and processing process to continuously learn and adaptively adjust, constructing a closed-loop process from exposure prediction, region control, brightness restoration to model optimization. This significantly improves the automation, consistency, and industrial applicability of color difference detection, effectively supporting the precision detection needs of highly reflective textiles in key processes such as dyeing and finishing quality inspection and appearance grading.
[0061] The foregoing has only described certain exemplary embodiments of the present invention by way of illustration. Undoubtedly, those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the foregoing drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.
Claims
1. A method for detecting color difference in textiles based on image data, characterized in that, Includes the following steps: S1. Collect images of textiles with high reflectivity under a standard light source, construct a light intensity prediction model, analyze the pixel brightness distribution, identify brightness change regions and saturation critical regions, and generate an image-level saturation risk probability map. S2. Based on the image-level saturation risk probability map, perform multi-scale exposure region division on the image, set the target brightness range of each exposure control sub-region, and record the global exposure parameters of the image acquisition device as the initial baseline for exposure scheduling. S3. Based on the exposure control sub-region and the target brightness range, the shutter speed and gain parameters are iteratively adjusted in the region so that the actual brightness of each sub-region gradually approaches the target brightness range, thereby achieving brightness convergence of each exposure control sub-region. S4. After completing the brightness convergence of the exposure control sub-region, re-acquire the image, compare the brightness values before and after adjustment pixel by pixel, calculate the brightness response difference, identify pixels that deviate from the target brightness range, and generate color compensation requests for the deviating pixels. S5. Based on the color compensation request, construct a multi-dimensional color compensation matrix, and reconstruct the pixel-level color according to the spatial position of the deviated pixel, the brightness error and historical characteristics to restore the true color distribution. S6. Input the color-reconstructed image into the light intensity prediction model, update the brightness response relationship and risk weight, realize the dynamic self-correction of the model, and construct a closed-loop control process that includes modeling, regulation, verification, compensation and feedback.
2. The method for detecting color difference in textiles based on image data according to claim 1, characterized in that, Step S1 includes: Images of natural mulberry silk fabric, satin brocade fabric, and polyester blended fabric with silver-plated metallic threads embedded horizontally were acquired under standard light source illumination. Image acquisition parameters included illuminance of 1000 Lux, color temperature of 6500 K, exposure time of 4 ms, gain of 1.0, white balance in manual mode, and saved as 12-bit color depth RAW format images. The image is subjected to brightness channel extraction, normalization and Sobel gradient calculation. Combined with sliding window statistical analysis, the brightness change region and saturation critical region are identified, and a six-dimensional feature dataset of pixels is constructed. Based on the labeled brightness risk level, a light intensity prediction model is trained using a random forest regression algorithm to predict the saturation risk probability of each pixel. The prediction results are used to generate a two-dimensional image-level saturation risk probability map, and Gaussian filtering is used to improve spatial continuity and edge smoothness.
3. The method for detecting color difference in textiles based on image data according to claim 1, characterized in that, Step S2 includes: Based on the image-level saturation risk probability map, pixels are divided into three levels according to the saturation risk level, and the four-neighbor method is used to cluster connected components. The initial region boundary is extracted using the minimum bounding rectangle. The initial region is optimized by applying the graph cut segmentation method, merging regions smaller than 400 pixels and removing boundary noise to form multiple exposure control sub-regions with a size of not less than 64×64 pixels. Set a corresponding target brightness range for each exposure control sub-region, and adjust the target lower limit value in combination with the fabric reflectivity; Record the current exposure parameters of the image acquisition device and complete the consistency review of the mean and standard deviation of regional brightness. For areas that do not meet the conditions, perform boundary reshaping and brightness target update.
4. The method for detecting color difference in textiles based on image data according to claim 1, characterized in that, Step S3 includes: Read the current shutter speed and gain parameters of each exposure control sub-region, and evaluate the deviation between its actual brightness and the target brightness range; The scheduling path is set according to the direction of brightness deviation, the shutter speed and gain parameters are iteratively adjusted, and the exposure change constraints of adjacent sub-regions are set. After each round of parameter adjustment, a new image is acquired and the average brightness is calculated to determine whether it has entered the target range. If the requirements are not met, the next round of adjustment is continued. After all exposure control sub-regions have completed iterative scheduling, the final parameter results are recorded, and the successfully converged and failed regions are used for subsequent model learning and color reconstruction processing, respectively.
5. The method for detecting color difference in textiles based on image data according to claim 1, characterized in that, Step S4 includes: After completing the brightness convergence of all exposure control sub-regions, the image is re-acquired using the final adjustment parameters to generate the brightness adjustment result image; By comparing the brightness adjustment result image with the original image, the brightness response difference in each exposure control sub-region is calculated pixel by pixel, and a brightness difference image is constructed. Based on the target brightness range and brightness difference threshold, deviating pixels are identified, and isolated misidentified pixels are filtered out by spatial consistency constraints. Based on the coordinate position, brightness information and neighborhood features of the offset pixel, a color compensation request is generated, forming structured compensation task data and submitted to the color compensation processing flow.
6. The method for detecting color difference in textiles based on image data according to claim 1, characterized in that, Step S5 includes: Call the color compensation request list, extract the coordinate position, brightness information and texture features of each off-pixel, and construct a 5×5 neighborhood feature matrix centered on that pixel; Based on the direction and magnitude of the brightness error, combined with the neighborhood brightness gradient, texture consistency and color channel mean, a multi-dimensional color compensation matrix containing five channels: red, green, blue, brightness, and texture direction is generated. Based on the compensation matrix, perform up to five rounds of iterative color reconstruction for each off-target pixel, update the pixel brightness and color values, and perform Gaussian smoothing. After all pixel compensation is completed, the final compensated image and compensation analysis report are generated, and the pixels with stable error convergence are extracted for online training and updating of the light intensity prediction model.
7. The method for detecting color difference in textiles based on image data according to claim 1, characterized in that, Step S6 includes: Extract the compensated brightness value and the uncompensated brightness value of all pixels in each exposure control sub-region, and recalculate the region brightness response curve by combining the acquired parameters; The saturation risk weight of each exposure control sub-region is updated based on the statistical results of the brightness difference, and the regional brightness stability score is calculated. The updated brightness response curve and risk weight parameters are written into the light intensity prediction model, and the simulation verification process is executed to evaluate the change in the model's prediction accuracy. If the overall prediction error of the model decreases by more than 20%, the current model version will be marked as a stable enhancement model and used to replace the old version in subsequent image processing.
Citation Information
Cited By
Vision-based blade spraying uniformity identification method
CN121121322A
Mutton color decision-making method and system based on fuzzy logic
CN121686002A