Fabric image high-fidelity color changing method and system based on adaptive texture adjustment
By constructing a brightness adjustment factor prediction model and combining it with the color and texture features of the fabric, the problem of poor consistency between texture and color in fabric image color changing was solved, achieving a high-fidelity color changing effect and improving the visual realism and texture preservation ability of the color changing result.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN TEXTILE UNIV
- Filing Date
- 2026-03-10
- Publication Date
- 2026-06-19
AI Technical Summary
Existing fabric image color-changing methods fail to effectively combine texture and color features, resulting in significant differences in texture intensity between the color-changed image and the real fabric, leading to poor visual consistency. Furthermore, deep learning-based methods rely on a large amount of labeled data for training, resulting in complex models with poor interpretability.
A brightness adjustment factor prediction model is constructed. The color and texture features of the fabric to be trained are used to make predictions through a gradient boosting decision tree. The model is then fused with the target color to achieve coordinated control of color and texture features and obtain high-fidelity color-changing results.
It achieves high fidelity between the color-changing fabric image and the real fabric image, significantly improving color consistency and texture realism. The CIEDE2000 color difference is 0.4108, the color histogram cosine similarity reaches 0.9945, the chi-square distance is 0.0126, and the LPIPS score is 0.2712, which is better than existing methods.
Smart Images

Figure CN122244191A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer digital image processing technology, specifically relating to a high-fidelity color-changing method and system for fabric images based on adaptive texture adjustment. Background Technology
[0002] With the development of digital textile technology, fabric color design and digital color-changing technology are playing an increasingly important role in textile design, production, and e-commerce display. By replacing the colors in fabric images, different color schemes can be quickly displayed without re-sampling. However, traditional image color-changing methods are mostly based on direct mapping of color channels or simple color transformation models, ignoring the influence of fabric texture features and brightness structure on visual effects. This results in significant differences in texture intensity between the color-changed image and the real fabric, leading to poor visual consistency.
[0003] In practical applications, even fabrics of different colors using the same weave structure will exhibit varying texture strength due to a combination of factors, including color brightness, saturation, and the fabric's reflective properties. For example, darker colors tend to display a stronger visual texture, while the texture details in lighter areas are easily diminished. Therefore, color-changing methods based solely on the RGB color channels are insufficient to accurately reproduce the texture characteristics of fabrics in different colors.
[0004] Existing research has attempted to describe the texture intensity of fabrics using grayscale standard deviation or gradient features, but these methods are typically only used for texture analysis and have failed to be combined with color features for color change prediction. Furthermore, while some deep learning-based image style transfer methods can achieve joint color and texture transformations, their training relies on large amounts of labeled data, resulting in complex models with poor interpretability, making them unsuitable for fabric color change applications. Summary of the Invention
[0005] The purpose of this invention is to solve the problems described in the background art by proposing a high-fidelity color-changing method and system for fabric images based on adaptive texture adjustment.
[0006] To address the problems in existing research, this invention proposes a solution. This method uses the color and texture features of the digital image of the fabric to be tested for color-changing to train a brightness adjustment factor prediction model, thereby predicting the brightness adjustment factor of the fabric to be tested for color-changing. Then, the obtained brightness adjustment factor is used to adjust the brightness image corresponding to the fabric to be tested for color-changing. Finally, the adjusted brightness image is fused with the target color to obtain the color-changing fabric image, thereby achieving coordinated control of color and texture features and obtaining a high-fidelity color-changing result that is visually consistent with the target fabric and has a realistic and natural texture.
[0007] The technical solution of this invention is a high-fidelity color-changing method for fabric images based on adaptive texture adjustment, specifically including the following steps:
[0008] Step 1: Prepare the training dataset and the test dataset. Both datasets contain pairs of fabrics to be changed and target color fabrics.
[0009] Step 2: Take digital images of the fabric to be recolored from the two datasets and extract the color and texture features of the fabric images.
[0010] Step 3: For the training dataset, set the target color of the fabric images to be trained and construct training samples for training the brightness adjustment factor prediction model.
[0011] The input features of the brightness adjustment factor prediction model include two types of information: the color RGB vector and texture features of the fabric image to be trained and the target color RGB vector. Fabrics with the same weaving process but different colors are paired up, one as the fabric to be replaced and the other as a reference for its replacement result, to construct training samples.
[0012] Step 4: For the test dataset, using the brightness adjustment factor prediction model trained in Step 3, first predict the brightness adjustment factor of the fabric to be tested for color change, then adjust the brightness image corresponding to the fabric to be tested for color change using the brightness adjustment factor, and finally fuse the adjusted brightness image with the target color to obtain the fabric image.
[0013] Furthermore, in step 1, several fabrics with the same weaving parameters but different colors are selected, and the fabrics of different colors are paired up to form sample pairs of fabrics to be changed and fabrics of the target color.
[0014] Furthermore, in step 2, a digital image of the fabric to be changed is taken inside the experimental lightbox using a digital camera. The specific method is as follows: the digital camera is installed on the top of the experimental lightbox to form an integrated system. The camera is connected to the computer via a data cable. Then, the fabric is placed in the drawer of the experimental lightbox, ensuring that the sample surface is free of wrinkles and contamination. The drawer is closed to isolate external light interference. The camera shooting parameters are adjusted, and the shooting button is pressed to obtain a digital image.
[0015] Furthermore, in step 3... The input feature vector of each training sample is defined as follows:
[0016]
[0017] in, This represents the average RGB values of the original image, i.e., the image of the fabric to be used for training. and These are the standard deviation of image brightness and the gradient magnitude, respectively, used to characterize the intensity of brightness changes. Contrast and homogeneity are calculated from the gray-level co-occurrence matrix, respectively. This is the RGB color vector after color resizing.
[0018] Furthermore, the brightness adjustment factor prediction model uses a gradient boosting decision tree as the base learner. It progressively constructs a series of weak learners, i.e., regression trees, during the iterative gradient boosting process, and then weights and accumulates these weak learners to combine them into a high-performance strong learner. Let the... The model's predicted value during round iteration is In each round, the model first calculates the residual of the current prediction:
[0019]
[0020] Among them, residual Indicates the first The unfitted portion of the error in the post-round model corresponds to the negative gradient direction of the current loss function with respect to the predicted value. This residual guides the training of the base learner in this round, enabling the model to update along the direction of fastest loss reduction. The model uses this residual as a supervision signal to train a new regression tree. The regression tree fits the structural information in the residuals, thus supplementing the patterns that the previous model failed to capture; after the regression tree is trained, it is then analyzed according to the learning rate. Update model prediction results:
[0021]
[0022] in Control the contribution of each tree to the final prediction;
[0023] go through After rounds of iteration, the final model is composed of a weighted sum of all base learners:
[0024]
[0025] in The number of trees.
[0026] Furthermore, step 3 also includes using Folded cross-validation is used to test the generalization performance and stability of the brightness adjustment factor prediction model; specifically, the dataset is... Divided into Non-overlapping subsets , Indicates the first The input feature vector of each training sample For the corresponding predicted output, each subset contains The sample; in the first sample In this verification, with As a validation set, the rest The training set is composed of several subsets. The model is trained and tested independently in each fold. After each iteration, the performance metrics of all folds are summarized to obtain a more robust estimate of the model's predictive ability.
[0027] Furthermore, during model training, a hyperparameter grid search strategy is introduced to systematically optimize the key parameters of the gradient boosting decision tree; given a combination of hyperparameters... The model is optimized by minimizing the mean squared error in cross-validation, as shown below:
[0028]
[0029] in, It is the number of folds in cross-validation. It is a combination of hyperparameters In the Mean square error on the fold The optimal combination of hyperparameters is needed to minimize the average error of cross-validation.
[0030] Furthermore, step 4 can be implemented as follows:
[0031] First, extract the brightness channel from the image of the fabric to be tested for color change. , The weighted calculation method for the channels is as follows:
[0032]
[0033] in, This represents the brightness value of any pixel in the image. Let represent the color values of the red, green, and blue channels of the pixel, respectively, with weighting coefficients set based on the human eye's sensitivity to different color channels; let be the predicted brightness adjustment factor for the tested color-changing fabric. The brightness deviation is directly calculated by adjusting the brightness channel of the image of the fabric to be tested.
[0034]
[0035] in, This represents the brightness value of a specific pixel in the image of the fabric to be tested for color alteration. and These represent the mean and standard deviation of the brightness channel of the image of the color-changing fabric to be tested;
[0036] Finally, the brightness deviation is combined with the target color RGB vector to obtain the color components after color replacement, which are calculated as follows:
[0037]
[0038] in, express Three channels, This indicates that the image after color reshaping is at the [number]th [number]. Pixel values on each color channel The value of the target color in the corresponding channel.
[0039] This invention also provides a high-fidelity color-changing system for fabric images based on adaptive texture adjustment, comprising:
[0040] The processor and memory are used to store program instructions, and the processor is used to call the stored instructions in the memory to execute the high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in the above technical solution.
[0041] The present invention also provides a computer-readable storage medium, including a readable storage medium on which a computer program is stored, wherein when the computer program is executed, it implements the high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in the above technical solution.
[0042] Compared with the prior art, the advantages and beneficial effects of the present invention are as follows:
[0043] The texture features of fabric images are color-dependent; fabrics woven from the same material but with different colored yarns using the same process will have different texture features. To address the issue of current fabric color-changing methods failing to fully consider this characteristic, resulting in color-changed fabrics deviating from the actual effect, this paper proposes a high-fidelity fabric image color-changing method based on adaptive texture adjustment. Unlike traditional methods that directly overlay the target color with the texture image of the fabric to be color-changed, this method fully utilizes the original color and texture features of the fabric image to be color-changed. First, it predicts the brightness adjustment factor of the fabric to be color-changed in conjunction with the target color. Then, it adjusts the brightness image of the fabric to be color-changed using the brightness adjustment factor. Finally, it fuses the adjusted brightness image with the target color to obtain the color-changed fabric image, achieving high-fidelity color-changing of fabric images with adaptive texture adjustment for different target colors. Experimental results show that the average CIEDE2000 color difference between the color-swapped fabric image and the real fabric image is 0.4108, the color histogram cosine similarity reaches 0.9945, the chi-square distance is 0.0126, the contrast and homogeneity differences are 0.0360 and 0.0131, respectively, and the LPIPS score is 0.2712, which is significantly better than the existing methods compared with it. This indicates that the fabric color-swapping results are superior to existing methods in terms of color consistency and visual realism, verifying the effectiveness and application potential of the proposed method. Attached Figure Description
[0044] Figure 1 This is a flowchart of an embodiment of the present invention.
[0045] Figure 2 This is the experimental light box used in the embodiments of the present invention.
[0046] Figure 3 The images show the results of changing the front of different colors of 40-reed 10-weft satin fabrics to blue using different methods in this embodiment of the invention. Detailed Implementation
[0047] The technical solution of this invention can be implemented by those skilled in the art using computer software technology.
[0048] like Figure 1 As shown in the figure, this invention proposes a high-fidelity color-changing method for fabric images based on adaptive texture adjustment, which includes the following steps:
[0049] Step 1: Prepare the training dataset and the test dataset. Both datasets contain pairs of fabrics to be changed and target color fabrics.
[0050] Step 2: Take digital images of the fabric to be recolored from the two datasets and extract the color and texture features of the fabric images.
[0051] Step 3: For the training dataset, set the target color of the fabric images to be trained and construct training samples for training the brightness adjustment factor prediction model.
[0052] The input features of the brightness adjustment factor prediction model include two types of information: the color RGB vector and texture features of the fabric image to be trained and the target color RGB vector. Fabrics with the same weaving process but different colors are paired up, one as the fabric to be replaced and the other as a reference for its replacement result, to construct training samples.
[0053] Step 4: For the test dataset, using the brightness adjustment factor prediction model trained in Step 3, first predict the brightness adjustment factor of the fabric to be tested for color change, then adjust the brightness image corresponding to the fabric to be tested for color change using the brightness adjustment factor, and finally fuse the adjusted brightness image with the target color to obtain the fabric image.
[0054] The following is a specific example illustrating the embodiments of the present invention:
[0055] The embodiments are based on a self-developed enclosed daylighting light box, a Nikon D7200 digital camera, and textile fabrics to test the method of the present invention.
[0056] In step 1, the specific process of preparing the dataset is as follows: Select several fabric samples with the same weaving parameters but different colors. Fabric samples of different colors can be paired up to form sample pairs of fabrics to be changed and fabrics of the target color.
[0057] In step 2, the specific process of using a digital camera to capture a digital image of the fabric to be changed inside the experimental lightbox in this embodiment is as follows: The digital camera is mounted on top of the experimental lightbox to form an integrated system. The digital camera is connected to a computer. Then, the fabric sample is placed within the effective imaging area of the experimental lightbox. The drawer is closed, the camera shooting parameters are adjusted, and the shooting button is pressed to obtain a digital image of the sample. The experimental lightbox uses full-spectrum daylight illumination, which meets the requirements for uniform illumination of the entire visible light spectrum in photographic colorimetry. Its enclosed structure effectively avoids the influence of ambient light on the imaging results. The imaging area at the bottom of the lightbox has high illumination uniformity and uses a completely diffuse reflection illumination method, avoiding the defects of local overexposure and shadows easily produced by traditional direct light sources. After shooting, the effective area containing the fabric in the obtained image is cropped. The experimental lightbox used in this embodiment of the invention is shown in the attached figure. Figure 2 As shown.
[0058] In step 3, the model's input features contain two types of information: the original fabric image's RGB color vector and texture features, and the target fabric image's RGB color vector. Fabric samples with the same weaving technique but different colors are paired up, one as the image to be recolored, and the other as the resulting image, thus constructing a sample dataset. The input feature vector of each sample is defined as follows:
[0059]
[0060] in, The average RGB value of the original image. and These are the standard deviation of image brightness and the gradient magnitude, respectively, used to characterize the intensity of brightness changes. These are the contrast and homogeneity calculated from the gray-level co-occurrence matrix, respectively, used to describe the roughness and uniformity of image texture. The target color vector after color transformation.
[0061] This invention utilizes six colors of yarn—red, yellow, blue, green, purple, and gray—and prepares fabric samples with different textures by adjusting the fabric structure and yarn density parameters. The fabric weave types include five types: plain weave, twill front, twill back, satin front, and satin back. Warp density is controlled by adjusting the number of reeds, set to 40, 50, and 60 respectively, while weft density is adjusted by changing the number of weft yarns, set to 1, 5, and 10. Based on these parameters, a total of 270 fabric samples were prepared, with all colored yarns made from 32-count twisted yarn.
[0062] In step 3, the brightness adjustment factor prediction model uses a gradient boosting decision tree as the base learner. It gradually constructs a series of weak learners (i.e., regression trees) during the iterative gradient boosting process, and then weights and accumulates these weak learners to combine them into a high-performance strong learner. Let the first... The model's predicted value during round iteration is In each round, the model first calculates the residual of the current prediction:
[0063]
[0064] Among them, residual Indicates the first The unfitted portion of the error in the post-round model corresponds to the negative gradient direction of the current loss function with respect to the predicted value. This residual guides the training of the base learner in this round, enabling the model to update along the direction of fastest loss reduction. The model uses this residual as a supervision signal to train a new regression tree. The regression tree fits the structural information in the residuals, thus supplementing the patterns that the previous model failed to capture; after the regression tree is trained, it is then analyzed according to the learning rate. Update model prediction results:
[0065]
[0066] in Control the contribution of each tree to the final prediction;
[0067] go through After rounds of iteration, the final model is composed of a weighted sum of all base learners:
[0068]
[0069] in The number of trees.
[0070] Step 3 also includes using Folded cross-validation is used to test the generalization performance and stability of the brightness adjustment factor prediction model; specifically, the dataset is... Divided into Non-overlapping subsets , Indicates the first The input feature vector of each training sample For the corresponding predicted output, each subset contains The sample; in the first sample In this verification, with As a validation set, the rest The training set is composed of several subsets. The model is trained and tested independently in each fold. After each iteration, the performance metrics of all folds are summarized to obtain a more robust estimate of the model's predictive ability.
[0071] During model training, a hyperparameter grid search strategy is introduced to systematically optimize the key parameters of the gradient boosting decision tree; given a combination of hyperparameters... The model is optimized by minimizing the mean squared error in cross-validation, as shown below:
[0072]
[0073] in, It is the number of folds in cross-validation. It is a combination of hyperparameters In the Mean square error on the fold To find the optimal combination of hyperparameters that minimizes the average cross-validation error, the model is trained and tested independently at each fold. After each iteration, the performance metrics of all folds are summarized to obtain a more robust estimate of the model's predictive ability. Considering that fabric images have three-dimensional structural features of "texture-reed number-weft number", this invention constructs sample groups based on a grouping strategy. That is, all samples with the same texture type, reed number, and weft number combination are regarded as an independent group. Cross-validation divides these groups into five non-overlapping subsets, with four folds serving as the training set and one fold serving as the validation set, to avoid images under the same structural conditions appearing in both the training and validation sets.
[0074] In step 4, the texture information of the image is largely determined by the brightness distribution characteristics. By reasonably adjusting the brightness information, the overall brightness and local contrast of the color-swapped image can be kept consistent with the real sample. Therefore, to ensure that the color-swapped result can realistically reflect the fabric texture features while maintaining color consistency, a fabric image color-swapping method based on adaptive texture adjustment is proposed. By introducing the brightness statistical features predicted by the model, the brightness distribution after color-swapping is constrained, thereby improving the visual realism of the color-swapped fabric.
[0075] First, extract the luminance channel from the image of the fabric to be recolored. , The weighted calculation method for the channels is as follows:
[0076]
[0077] in, This represents the brightness value of any pixel in the image. These represent the color values of the red, green, and blue channels of the pixel, respectively, with weighting coefficients set based on the human eye's sensitivity to different color channels. Simultaneously, the color and texture features of the image to be tested for color replacement, along with the RGB vector of the target color, are input into the brightness adjustment factor prediction module. The predicted brightness adjustment factor for the fabric to be tested for color replacement is... The brightness deviation is directly calculated by adjusting the brightness channel of the image to be recolored.
[0078]
[0079] in, This represents the brightness value of a pixel in the image to be color-changed. and These represent the mean and standard deviation of the brightness channel of the image to be color-changed, respectively. Brightness deviation. This characterizes the local deviation of pixel brightness relative to the overall brightness distribution and is an important carrier of fabric texture information. Finally, the brightness deviation is combined with the target color RGB vector to obtain the color components after color replacement, calculated as follows:
[0080]
[0081] in, express Three channels, This indicates that the image after color reshaping is at the [number]th [number]. Pixel values on each color channel This represents the value of the target color in the corresponding channel. By superimposing the brightness deviation predicted by the model onto each color channel, the color replacement result effectively restores the texture structure of the real fabric sample while ensuring the consistency of the target color, thus achieving a more natural and realistic color replacement effect for the fabric image at the visual perception level.
[0082] To illustrate the effectiveness of the present invention, the following evaluation metrics are used to evaluate the image obtained by the present invention:
[0083] First, the model performance is evaluated using multiple metrics, including root-mean-square error (RMSE), coefficient of determination (R²), and mean absolute error (MAE). RMSE measures the average deviation between the model's predicted and actual values, reflecting the model's prediction accuracy. The specific formula is as follows:
[0084]
[0085] in, For the sample size, For the first The true value of each sample For the first The predicted value for each sample.
[0086] The coefficient of determination (R²) is one of the metrics used to evaluate the performance of a regression model. It represents the degree to which the model explains the variation in the data. The specific formula is as follows:
[0087]
[0088] in, For the true value, For predicted values, R² is the mean of the true values. The value of R² is usually between 0 and 1. The closer the value is to 1, the stronger the model's ability to fit the data.
[0089] MAE is used to evaluate the magnitude of the model's average prediction error, and it directly reflects the average level of prediction error. The specific formula is as follows:
[0090]
[0091] Secondly, in order to quantitatively evaluate the effect of color replacement, this invention also uses CIEDE2000 color difference, histogram cosine similarity, chi-square distance, gray-level co-occurrence matrix and perceptual similarity index LPIPS (Learned Perceptual ImagePatch Similarity) as evaluation criteria to conduct collaborative verification at the color statistics level, texture level and human visual perception level.
[0092] Histogram cosine similarity is a similarity measure based on vector angles, used to measure the similarity between two color distributions. This involves examining the RGB color histograms of the reference and result images. and The cosine similarity is defined as follows:
[0093]
[0094] in, This represents the number of bins in the histogram. The closer the value is to 1, the more similar the color distributions of the two images. The average of the three channels is used as the overall color distribution similarity index.
[0095] Chi-square distance is used to measure the difference in distribution between color histograms. It measures the degree of dissimilarity in color distribution by comparing statistical deviations across various dimensions. Let the RGB color histograms of the reference image and the result image be respectively... and The chi-square distance is defined as follows:
[0096]
[0097] in A very small constant is introduced to prevent the denominator from being zero. The smaller the distance value, the more similar the color distributions of the two images. The average of the three channels is used as an indicator of the overall color distribution difference.
[0098] To further evaluate the ability of the color replacement result to preserve texture structure, the gray-level co-occurrence matrix (GLCM) is introduced to analyze the local spatial relationships of the image. The GLCMs of the reference image and the result image are shown below. and Then their difference in contrast is defined as:
[0099]
[0100] in Represents the gray levels in the gray-level co-occurrence matrix. and The joint probability, This represents the number of gray levels. A higher contrast value indicates more dramatic changes in gray levels within the image. Difference in homogeneity is defined as:
[0101]
[0102] By calculating the Euclidean distance between the contrast and homogeneity indices, the difference between the color-changing result and the actual fabric texture can be quantified. The smaller the value, the better the texture retention effect.
[0103] LPIPS (Learned Perceptual Image Patch Similarity) is a deep learning-based perceptual similarity measurement method. It utilizes a pre-trained convolutional neural network to extract features and calculates the distance in the feature space to measure the visual similarity between two images. and The LPIPS calculation is performed using the reference image and the result image, respectively:
[0104]
[0105] in, for and The cumulative perceived distance, For the index of the network layer, and The height and width of the feature map respectively. and For spatial location, These represent the two samples at the th... Layer position The feature vector at that location, For the first The weights corresponding to the layers, The L2 norm is used. A lower LPIPS score indicates a smaller perceptual difference between the two images, meaning the recolored image is visually closer to the real image.
[0106] The prediction model results are shown in Table 1. As can be seen from the data in Table 1, for the six different fabric colors, under the five-fold cross-validation modeling condition, the average coefficient of determination (R²) is above 0.91, indicating that color and texture features have a strong characterizing ability for the standard deviation of brightness. The root mean square error (RMSE) is below 0.0060, and the average prediction error amplitude (MAE) is below 0.005, indicating a high similarity between the predicted and true values, thus proving the predictive performance of the model.
[0107] Table 1. Prediction results of the model using color and texture to predict the standard deviation of fabric brightness.
[0108]
[0109] Figure 3 This paper compares the results of different methods for color-changing the reverse side of a 40-reed, 5-weft satin fabric. From an overall visual perspective, GCM, Xin-1, Xin-2, CNN, and the method proposed in this invention can all achieve color-changing of the target color to a certain extent. The overall color of the color-changed image is close to that of the real fabric. However, there are still some differences between the methods in terms of color distribution uniformity and texture structure preservation. The GCM method produces a slightly darker overall color with stronger texture contrast. The Xin-1 and Xin-2 methods show some improvement in color and texture intensity, but slight deviations still exist. The CNN method performs reasonably well in terms of overall color consistency, but its results are relatively flat, with some smoothing of local texture details. The subtle diagonal weave structure unique to the reverse side of the fabric is not sufficiently represented, thus affecting the overall realism. However, its texture intensity is closer to that of the real fabric than the previous three methods. CNN shows more obvious smoothing on the front side with clear texture, and performs better on the reverse side with finer texture and lower contrast. In contrast, the method proposed in this study demonstrates greater stability in terms of color distribution and texture preservation. Its color-changing results closely approximate real fabric images in terms of overall brightness, color uniformity, and the continuity of the twill structure. Even when the reverse side of the fabric has a fine texture and low contrast, this method can still effectively maintain the spatial structural characteristics of the texture, avoiding over-smoothing or localized color shifts.
[0110] In addition to subjective visual evaluation, this invention further introduces various objective indicators to quantitatively analyze different color-changing methods from three aspects: color distribution, texture structure, and visual perception. Overall, this method performs excellently in terms of color consistency and texture preservation, with a CIEDE2000 color difference of 0.4108, significantly better than the GCM and CNN methods, and on par with Xin-1 and Xin-2. The color difference is slightly higher than Xin-2, mainly due to the limitations of global statistical evaluation, and does not produce significant visual bias. Regarding color distribution, this method achieves optimal results in histogram cosine similarity (0.9945) and chi-square distance (0.0126), indicating that its color distribution is highly consistent with the real fabric. In texture structure evaluation, its contrast and homogeneity differences are 0.0360 and 0.0131, respectively, also optimal results, demonstrating that this method can effectively maintain the fabric texture structure and avoid over-enhancement or smoothing, while other methods still have shortcomings in texture indicators or visual effects. Although the CNN method has lower values on some texture metrics, subjective results show that it exhibits a certain degree of texture smoothing.
[0111] Table 2. Evaluation results of different color-changing methods using six objective evaluation indicators.
[0112]
[0113] References for the GCM method: Xin JH, Shen H L. Computational model for colormapping on texture images[J]. Journal of Electronic Imaging, 2003, 12(4):697-704; References for the Xin-1 and Xin-2 methods.
[0114] In terms of visual perception evaluation, LPIPS is used to measure the perceptual similarity of color-swapping results in the deep feature space. The LPIPS value of our proposed method is 0.2712, significantly better than GCM and Xin-1 and Xin-2 methods, indicating that it maintains color and texture consistency while possessing good overall visual realism. Although CNN methods achieve lower LPIPS values, their color-swapping results generally exhibit texture smoothing and weakened fabric details. This is mainly because LPIPS is more sensitive to high-level semantic features and pays limited attention to high-frequency textures. Therefore, in fabric color-swapping tasks, a single perceptual metric is insufficient to comprehensively evaluate the performance; it is necessary to combine multiple dimensions such as color, texture, and visual perception for comprehensive analysis.
[0115] The results above show that the method proposed in this invention exhibits good balance and stability across multiple evaluation dimensions, including color consistency, texture structure preservation, and visual perception, further verifying its effectiveness and superiority in high-fidelity fabric color changing tasks.
[0116] On the other hand, embodiments of the present invention also provide a high-fidelity color-changing system for fabric images based on adaptive texture adjustment, comprising:
[0117] The processor and memory are used to store program instructions, and the processor is used to call the stored instructions in the memory to execute the high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in the above technical solution.
[0118] Thirdly, embodiments of the present invention also provide a computer-readable storage medium, including a readable storage medium on which a computer program is stored, wherein when the computer program is executed, it implements the high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in the above technical solution.
[0119] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.
Claims
1. A high-fidelity color-changing method for fabric images based on adaptive texture adjustment, characterized in that, Includes the following steps: Step 1: Prepare the training dataset and the test dataset. Both datasets contain pairs of fabrics to be changed and target color fabrics. Step 2: Take digital images of the fabric to be recolored from the two datasets and extract the color and texture features of the fabric images. Step 3: For the training dataset, set the target color of the fabric images to be trained and construct training samples for training the brightness adjustment factor prediction model. The input features of the brightness adjustment factor prediction model include two types of information: the color RGB vector and texture features of the fabric image to be trained and the target color RGB vector. Fabrics with the same weaving process but different colors are paired up, one as the fabric to be replaced and the other as a reference for its replacement result, to construct training samples. Step 4: For the test dataset, using the brightness adjustment factor prediction model trained in Step 3, first predict the brightness adjustment factor of the fabric to be tested for color change, then adjust the brightness image corresponding to the fabric to be tested for color change using the brightness adjustment factor, and finally fuse the adjusted brightness image with the target color to obtain the fabric image.
2. The high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in claim 1, characterized in that: In step 1, select several fabrics with the same weaving parameters but different colors, and pair the fabrics of different colors to form sample pairs of fabrics to be changed and fabrics of the target color.
3. The high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in claim 1, characterized in that: In step 2, a digital image of the fabric to be changed is taken inside the experimental lightbox using a digital camera. The specific method is as follows: the digital camera is installed on the top of the experimental lightbox to form an integrated system. The camera is connected to the computer via a data cable. Then, the fabric is placed in the drawer of the experimental lightbox, ensuring that the sample surface is free of wrinkles and contamination. The drawer is closed to isolate external light interference. The camera shooting parameters are adjusted, and the shooting button is pressed to obtain a digital image.
4. The high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in claim 1, characterized in that: Step 3 The input feature vector of each training sample is defined as follows: ; in, This represents the average RGB values of the original image, i.e., the image of the fabric to be used for training. and These are the standard deviation of image brightness and the gradient magnitude, respectively, used to characterize the intensity of brightness changes. Contrast and homogeneity are calculated from the gray-level co-occurrence matrix, respectively. This is the RGB color vector after color resizing.
5. The high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in claim 1, characterized in that: The brightness adjustment factor prediction model uses a gradient boosting decision tree as the base learner. It progressively constructs a series of weak learners (regression trees) during the iterative gradient boosting process, and then weights and accumulates these weak learners to combine them into a high-performance strong learner. Let the... The model's predicted values during round iterations are In each round, the model first calculates the residual of the current prediction: ; Among them, residual Indicates the first The unfitted portion of the error in the post-round model corresponds to the negative gradient direction of the current loss function with respect to the predicted value. This residual guides the training of the base learner in this round, enabling the model to update along the direction of fastest loss reduction. The model uses this residual as a supervision signal to train a new regression tree. The regression tree fits the structural information in the residuals, thus supplementing the patterns that the previous model failed to capture; after the regression tree is trained, it is then analyzed according to the learning rate. Update model prediction results: ; in Control the contribution of each tree to the final prediction; go through After rounds of iteration, the final model is composed of a weighted sum of all base learners: ; in The number of trees.
6. The high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in claim 5, characterized in that: Step 3 also includes using Folded cross-validation is used to test the generalization performance and stability of the brightness adjustment factor prediction model; specifically, the dataset is... Divided into Non-overlapping subsets , Indicates the first The input feature vector of each training sample For the corresponding predicted output, each subset contains The sample; in the first sample In this verification, with As a validation set, the rest The training set is composed of several subsets. The model is trained and tested independently in each fold. After each iteration, the performance metrics of all folds are summarized to obtain a more robust estimate of the model's predictive ability.
7. The high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in claim 6, characterized in that: During model training, a hyperparameter grid search strategy is introduced to systematically optimize the key parameters of the gradient boosting decision tree; given a combination of hyperparameters... The model is optimized by minimizing the mean squared error in cross-validation, as shown below: ; in, It is the number of folds in cross-validation. It is a combination of hyperparameters In the Mean square error on the fold The optimal combination of hyperparameters is needed to minimize the average error of cross-validation.
8. The high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in claim 1, characterized in that: Step 4 can be implemented as follows: First, extract the brightness channel from the image of the fabric to be tested for color change. , The weighted calculation method for the channels is as follows: ; in, This represents the brightness value of any pixel in the image. Let represent the color values of the red, green, and blue channels of the pixel, respectively, with weighting coefficients set based on the human eye's sensitivity to different color channels; let be the predicted brightness adjustment factor for the tested color-changing fabric. The brightness deviation is directly calculated by adjusting the brightness channel of the image of the fabric to be tested. ; in, This represents the brightness value of a specific pixel in the image of the fabric to be tested for color alteration. and These represent the mean and standard deviation of the brightness channel of the image of the color-changing fabric to be tested; Finally, the brightness deviation is combined with the target color RGB vector to obtain the color components after color replacement, which are calculated as follows: ; in, express Three channels, This represents the pixel value in the i-th color channel of the image after color replacement. The value of the target color in the corresponding channel.
9. A high-fidelity color-changing system for fabric images based on adaptive texture adjustment, characterized in that, include: The processor and memory, wherein the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute the high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, It includes a readable storage medium on which a computer program is stored, and when the computer program is executed, it implements the high-fidelity color-changing method for fabric images based on adaptive texture adjustment as described in any one of claims 1-8.