Fabric color simulation method, computer device and storage medium

By performing color region analysis and texture image processing on fabric samples, calculating color data offset, generating preview simulation images and fusing texture images, the problems of harsh edges and loss of texture in complex fabric color simulation are solved, achieving a high-fidelity color simulation effect.

CN122156346APending Publication Date: 2026-06-05GUANGZHOU ZHANLAN ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU ZHANLAN ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD
Filing Date
2026-04-18
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing fabric color simulation technologies struggle to accurately identify color mixing and transition areas in complex fabrics, resulting in harsh, jagged edges in the simulated images at the boundaries, thus losing the original three-dimensional texture of the fabric.

Method used

By acquiring fabric texture images of fabric samples, color region analysis is performed to determine the baseline color region and data, color data offset is calculated, a preview simulation image is generated based on the fabric texture image, and the image edge texture image is fused to restore the yarn texture and fuzziness.

Benefits of technology

It achieves precise processing of complex multi-colored fabrics, with natural color transitions, restoring the texture of the yarn and the three-dimensional light and shadow layers, and enhancing the physical realism of the simulated images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122156346A_ABST
    Figure CN122156346A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of textile fabrics, in particular to a fabric color simulation method, a computer device and a storage medium, the method comprises the following steps: obtaining a fabric texture image of a fabric sample; performing color region analysis on the fabric sample, determining at least one reference color region of the fabric sample and reference color data corresponding to the reference color region; obtaining target color data input by a user for the reference color region, calculating color data offset in a preset space according to the target color data and the reference color data; determining to-be-adjusted pixel points based on the fabric texture image; adjusting color data for the to-be-adjusted pixel points based on the color data offset, generating a preview simulation image; determining an image edge texture image based on the fabric texture image, fusing the image edge texture image and the preview simulation image, and generating a fitted color number fabric image. The application has the effect of improving the restoration degree and the authenticity of the simulation image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of textile fabric technology, and in particular to a fabric color simulation method, computer equipment, and storage medium. Background Technology

[0002] Currently, fabric color simulation is a technique that uses computer image processing technology to adjust the colors of digital images of fabrics, thereby allowing previews of different color matching effects without the need for physical sampling. It is widely used in clothing design, fabric development, and e-commerce display.

[0003] Existing fabric color simulation technologies typically select specific color areas by manually setting color thresholds and then linearly adjust the hue and saturation of pixels within the selected area using global color balance algorithms or simple layer overlay. However, this approach often struggles to accurately identify transition areas of color mixing when dealing with complex fabrics featuring interwoven yarns. Furthermore, simple color overlay can easily obscure the fine textures of the fabric surface, resulting in harsh, jagged edges in the simulated image at the boundaries and a loss of the fabric's original three-dimensional texture. Therefore, there is room for improvement. Summary of the Invention

[0004] To improve the fidelity and realism of simulated images, this application provides a fabric color simulation method, computer equipment, and storage medium.

[0005] The above-mentioned objective of this application is achieved through the following technical solution:

[0006] A fabric color simulation method, the fabric color simulation method comprising:

[0007] Obtain the fabric texture image of the fabric sample;

[0008] Color region analysis is performed on the fabric sample to determine at least one reference color region of the fabric sample and the reference color data corresponding to the reference color region.

[0009] Obtain the target color data input by the user for the reference color area, and calculate the color data offset in the preset space based on the target color data and the reference color data;

[0010] Based on the fabric texture image, determine the pixels to be adjusted;

[0011] Based on the color data offset, the color data of the pixel to be adjusted is adjusted to generate a preview simulation image;

[0012] Based on the fabric texture image, an image edge texture image is determined, and the image edge texture image is fused with the preview simulation image to generate a fitted color fabric image.

[0013] By employing the above technical solutions, color region analysis of fabric samples is performed to determine the reference color region and reference color data, establishing a precise mapping relationship between the physical color of the fabric and digital simulation. This ensures that subsequent color adjustments are based on the inherent color distribution of the real fabric, enabling the processing of complex multi-colored fabrics. By acquiring target color data and calculating the color data offset in a preset space, the color migration path from the reference color to the target color can be quantified, providing a mathematical basis for color transformation. By generating a weighted image of the color-changing region based on the fabric texture image and using this weighted image to identify the pixels to be adjusted, intelligent selection of the target color-changing region can be achieved, resulting in a natural color transition. By adjusting the data of the pixels to be adjusted based on the color data offset to generate a preview simulation image, the basic light and shadow structure can be preserved while changing the color, providing an intuitive color preview effect. By determining the image edge texture image and fusing it with the preview simulation image to generate a fitted color code fabric image, high-frequency texture details can be re-superimposed onto the color layer, restoring the yarn texture and fuzziness that may be lost due to color-changing calculations, significantly improving the physical realism of the simulation image.

[0014] In a preferred embodiment, this application can be further configured such that: acquiring the fabric texture image of the fabric sample specifically includes:

[0015] Under preset lighting conditions and shooting distance, a high-resolution image of a local area of ​​the fabric sample's surface is captured using a macro photography device.

[0016] The local high-definition image is subjected to denoising and contrast enhancement processing to remove shooting noise and deepen the shadows on the fabric surface, and the processed image is used as the fabric texture image.

[0017] By adopting the above technical solution, high-definition images of local areas of the fabric surface are captured using a macro photography device under preset lighting conditions and shooting distances, providing the necessary physical texture basis for high-fidelity simulation. By performing noise reduction and contrast enhancement processing on the local high-definition images, sensor noise can be effectively removed and the three-dimensionality of the yarn structure can be enhanced, thereby making the subsequently extracted texture features clearer and sharper, and improving the visual clarity of the final image.

[0018] In a preferred embodiment, this application can be further configured such that: performing color region analysis on the fabric sample to determine at least one reference color region of the fabric sample and the reference color data corresponding to the reference color region specifically includes:

[0019] Multiple sets of Lab color space coordinate data were obtained by sampling the fabric surface of the fabric sample at multiple points using a spectrophotometer.

[0020] The K-means clustering algorithm is used to perform cluster analysis on multiple sets of Lab color space coordinate data to identify at least one cluster center of the fabric sample. Based on the cluster center, the Lab color space coordinate data is divided into different color clusters.

[0021] Based on the color clusters, the area of ​​each color cluster on the fabric sample is determined as the corresponding reference color area;

[0022] Calculate the arithmetic mean of all Lab color space coordinate data in each color cluster, and use the arithmetic mean as the reference color data for the corresponding reference color region.

[0023] By adopting the above technical solution, multiple sets of Lab color space coordinate data are obtained by sampling the fabric surface at multiple points using a spectrophotometer. This objectively records the physical color information of the fabric at different locations, thus avoiding random errors caused by single-point measurement. By using the K-means clustering algorithm to identify cluster centers and divide color clusters, the main color components in woven or printed fabrics can be automatically and accurately identified. This allows for color separation of complex patterns without manual intervention. By calculating the arithmetic mean of the Lab data in the color clusters as the reference color data, a high-precision color standard representing the overall characteristics of the area can be obtained, thereby improving the accuracy of the reference color and ensuring the reliability of subsequent color difference calculations.

[0024] In a preferred embodiment, this application can be further configured such that: calculating the color data offset in a preset space based on the target color data and the reference color data specifically includes:

[0025] Using a color space conversion algorithm, the target color data and the reference color data are converted into values ​​corresponding to the HSV color space;

[0026] The differences between the target color data and the reference color data in the dimensions of hue, saturation, and lightness are calculated respectively, and the color data offset is obtained based on the differences.

[0027] By adopting the above technical solution, the target color data and reference color data are converted into HSV color space values ​​using a color space conversion algorithm. This allows for the orthogonal separation of the hue, saturation, and brightness characteristics of the color, thus facilitating subsequent independent light and shadow protection processing for the brightness channel. By calculating the difference in each dimension to obtain the color data offset, a precise three-dimensional color migration vector can be constructed. This guides each pixel to move accurately in the color space, achieving the desired color change effect.

[0028] In a preferred embodiment, this application can be further configured such that: determining the pixels to be adjusted based on the fabric texture image specifically includes:

[0029] For each pixel in the fabric texture image, obtain the original HSV value of the pixel;

[0030] The difference between the original HSV value of the pixel and the color value of the reference color data is calculated by using the Euclidean distance method.

[0031] The mixing coefficient is calculated by using the Gaussian distribution function based on the color numerical difference.

[0032] Pixels with a mixing coefficient greater than a preset threshold are identified as the pixels to be adjusted.

[0033] By adopting the above technical solution, the original HSV value of each pixel is obtained and its difference from the reference color data is calculated using the Euclidean distance method. This quantifies the similarity between each pixel and the target main color, thus providing data support for distinguishing between pure color areas, mixed color areas, and background areas. By using the Gaussian distribution function to calculate the mixing coefficient based on the difference, discrete similarity can be mapped to continuous and smooth weight values, thereby constructing a selection mask with soft edge transition characteristics. By identifying pixels with a mixing coefficient greater than a preset threshold as pixels to be adjusted, irrelevant noise can be effectively filtered out, thereby accurately locking the target area that needs to be changed and ensuring that only the color that the user expects to change is changed.

[0034] In a preferred embodiment, this application can be further configured such that: based on the color data offset, color data adjustment is performed on the pixel to be adjusted to generate a preview simulation image, specifically including:

[0035] For each pixel to be adjusted in the fabric texture image, the original HSV value corresponding to the pixel to be adjusted is obtained. The original HSV value includes the original hue value, the original saturation value, and the original brightness value.

[0036] A dynamic adaptive weighting coefficient is constructed based on the original brightness value. The corrected brightness offset is obtained by weighting the dynamic adaptive weighting coefficient and the brightness offset in the color data offset.

[0037] The hue offset, saturation offset, and corrected brightness offset in the color data offset are respectively superimposed on the original hue value, original saturation value, and original brightness value corresponding to the pixel to obtain the transformed HSV value;

[0038] Using a linear interpolation algorithm, the transformed HSV value and the original HSV value are weighted and fused according to the mixing coefficients to obtain the final HSV value and generate the preview simulation image.

[0039] By adopting the above technical solution, and by constructing a dynamic adaptive weighting coefficient based on the original brightness value and performing weighted calculation on the brightness offset, the color change amplitude can be dynamically adjusted according to the brightness information at the pixel level, thereby achieving intelligent light and shadow protection and preventing the shadow area from being completely black or the highlight area from being overexposed. By superimposing each offset value onto the original HSV value to obtain the transformed HSV value, the physical transfer of pixel color can be achieved, thereby achieving the initial effect of the target color matching. By using a linear interpolation algorithm to perform weighted fusion of the transformed and original HSV values ​​according to the mixing coefficient, natural color mixing can be achieved at the boundary between the two colors, thereby simulating the color mixing mechanism when real yarn is interwoven and eliminating the hard traces of manual retouching.

[0040] In a preferred embodiment, this application can be further configured such that: the determination of the dynamic adaptive weight coefficients based on the original brightness value specifically includes:

[0041] Set the shadow protection threshold, highlight protection threshold, and maximum value of the lightness channel in the HSV color space, wherein the shadow protection threshold is less than the highlight protection threshold, and the highlight protection threshold is less than the maximum value of lightness;

[0042] If the original brightness value is within the range of the shadow protection threshold and the highlight protection threshold, then the dynamic adaptive weighting coefficient is determined to be 1;

[0043] If the original brightness value is less than the shadow protection threshold, then the ratio of the difference between the original brightness value and the initial brightness value to the shadow protection threshold is calculated, and the ratio is determined as the dynamic adaptive weight coefficient.

[0044] If the original brightness value is greater than the highlight protection threshold, then the ratio of the absolute value of the difference between the original brightness value and the maximum brightness value to the absolute value of the difference between the highlight protection threshold and the maximum brightness value is calculated, and the ratio is determined as the dynamic adaptive weighting coefficient.

[0045] By adopting the above technical solution, and by setting the shadow protection threshold, highlight protection threshold, and maximum brightness value of the brightness channel, the brightness space can be divided into three zones with different physical properties: shadow zone, midtone zone, and highlight zone. This provides a judgment boundary for the segmented protection strategy. By setting the weight coefficient to 1 in the midtone zone, the main color can be completely changed, thus ensuring that the overall color tone of the fabric is accurately changed to the target color. By calculating the weight coefficient based on the ratio in the shadow zone and highlight zone, the effect of linearly decreasing the color change amplitude as the brightness approaches the extreme value can be achieved, thereby forcibly preserving the depth of extremely dark gaps and the luster of extremely bright reflective points, maintaining the original three-dimensional light and shadow layers of the fabric.

[0046] In a preferred embodiment, this application can be further configured as follows: determining an image edge texture image based on the fabric texture image, and fusing the image edge texture image with the preview simulation image to generate a fitted color code fabric image, specifically includes:

[0047] The fabric texture image is convolved using an edge detection algorithm to identify regions in the fabric texture image where pixel values ​​change abruptly as texture boundaries, thereby generating an image edge texture image.

[0048] A multi-scale image fusion strategy is adopted, using the preview simulation image as the base image and the image edge texture image as the detail layer, and the image fusion operation is performed layer by layer to output the fitted color fabric image.

[0049] By adopting the above technical solution, and by using the edge detection algorithm to identify regions of pixel value abrupt change and generate image edge texture images, high-frequency physical features such as yarn outlines and fiber knots can be extracted from color information, thereby obtaining a pure texture layer. The edge texture image is then fused layer by layer with the preview simulation image as a detail layer using an image fusion model based on the Laplacian pyramid, thereby effectively solving the problem of smooth image quality and lack of tactile feel after color change, and making the generated image have a realistic texture close to that of real objects.

[0050] The second objective of this invention is achieved through the following technical solution:

[0051] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the fabric color simulation method described above.

[0052] The above-mentioned objective three of this application is achieved through the following technical solution:

[0053] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the fabric color simulation method described above.

[0054] In summary, this application includes at least one of the following beneficial technical effects:

[0055] 1. By analyzing the color regions of fabric samples, the baseline color regions and baseline color data are determined, establishing a precise mapping relationship between the physical color of the fabric and digital simulation. This ensures that subsequent color adjustments are based on the inherent color distribution of the real fabric, enabling the processing of complex multi-colored fabrics. By acquiring target color data and calculating the color data offset in a preset space, the color migration path from the baseline color to the target color can be quantified, providing a mathematical basis for color transformation. By generating a weighted image of the color-changing region based on the fabric texture image and using this weighted image to identify the pixels to be adjusted, intelligent selection of the target color-changing region can be achieved, resulting in a natural color transition. By adjusting the data of the pixels to be adjusted based on the color data offset to generate a preview simulation image, the basic light and shadow structure can be preserved while changing the color, providing an intuitive color preview effect. By determining the image edge texture image and fusing it with the preview simulation image to generate a fitted color code fabric image, high-frequency texture details can be re-superimposed on the color layer, restoring the yarn texture and fuzziness that may be lost due to color-changing calculations, significantly improving the physical realism of the simulation image.

[0056] 2. By obtaining the original HSV value for each pixel and calculating its difference from the reference color data using the Euclidean distance method, the similarity between each pixel and the target main color can be quantified, thus providing data support for distinguishing pure color areas, mixed color areas and background areas. By using the Gaussian distribution function to calculate the mixing coefficient based on the difference, discrete similarity can be mapped into continuous and smooth weight values, thereby constructing a selection mask with soft edge transition characteristics. By identifying pixels with a mixing coefficient greater than a preset threshold as pixels to be adjusted, irrelevant noise can be effectively filtered out, thereby accurately locking the target area that needs to be changed in color, ensuring that only the color that the user expects to change is changed.

[0057] 3. By setting the shadow protection threshold, highlight protection threshold, and maximum brightness value of the brightness channel, the brightness space can be divided into three zones with different physical properties: shadow zone, midtone zone, and highlight zone. This provides a judgment boundary for the segmented protection strategy. By setting the weight coefficient to 1 in the midtone zone, the main color can be completely changed, thus ensuring that the overall color tone of the fabric is accurately changed to the target color. By calculating the weight coefficient based on the ratio in the shadow zone and highlight zone, the effect of linearly decreasing the color change amplitude as the brightness approaches the extreme value can be achieved, thereby forcibly preserving the depth of extremely dark gaps and the luster of extremely bright reflective points, maintaining the original three-dimensional light and shadow layers of the fabric. Attached Figure Description

[0058] Figure 1 This is a flowchart illustrating the implementation of a fabric color simulation method in one embodiment of this application;

[0059] Figure 2 This is a fabric texture map of an experimental sample in an experimental test of a fabric color simulation method in one embodiment of this application;

[0060] Figure 3 This is a labeling diagram of the target color number in the experimental test of a fabric color simulation method in one embodiment of this application;

[0061] Figure 4 This is a fitted color code fabric image generated during experimental testing in a fabric color simulation method according to one embodiment of this application;

[0062] Figure 5 This is a schematic diagram of the internal structure of a computer device according to an embodiment of this application. Detailed Implementation

[0063] The following embodiments will help those skilled in the art to further understand the function of this application, but do not limit this application in any way. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of this application. These all fall within the protection scope of this application.

[0064] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0065] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0066] The present application will be further described in detail below with reference to the accompanying drawings.

[0067] In one embodiment, such as Figure 1 As shown, this application discloses a method for simulating fabric color, which specifically includes the following steps:

[0068] S10. Obtain the fabric texture image of the fabric sample.

[0069] Specifically, operators or automated equipment use high-definition imaging devices to capture the microscopic morphology information of the fabric surface in a controlled optical environment, obtaining raw image data including the fabric weave structure, surface fiber orientation, and light and shadow distribution, thus obtaining the fabric texture image. This image data should have sufficient resolution to support subsequent high-precision processing, such as ensuring that the yarn interlacing points and the shape of the fine surface hairs can be clearly distinguished, thereby providing an accurate texture carrier for subsequent color simulation and avoiding distortion of simulation results due to blurry images.

[0070] S20. Perform color region analysis on the fabric sample to determine at least one reference color region of the fabric sample and the reference color data corresponding to the reference color region.

[0071] Specifically, for fabric samples that may contain multiple colors, such as yarn-dyed plaid or printed fabrics, the color composition of the sample is first analyzed, dividing it into different visual perception areas. This involves determining which areas belong to the same inherent color and defining these as baseline color areas. Simultaneously, standard color values, such as the color mean or center value, are calculated through physical measurements and defined as baseline color data. For example, for a red and white plaid fabric, the red and white plaid areas are identified, and the "standard red" value representing the red area and the "standard white" value representing the white area are extracted respectively.

[0072] S30. Obtain the target color data input by the user for the reference color area, and calculate the color data offset in the preset space based on the target color data and the reference color data.

[0073] Specifically, the system receives the desired color value specified by the user for a specific reference color area through the human-computer interaction interface, i.e., the target color data, such as changing the red grid to the blue grid. Then, in a unified color calculation space, the system compares the numerical differences between the target color data and the reference color data in various dimensions, and calculates the mathematical difference required to change from the current reference color to the target color, i.e., the color data offset. This offset quantitatively describes the numerical change required to change from the current physical fabric color to the user's desired color.

[0074] S40. Based on the fabric texture image, determine the pixels to be adjusted.

[0075] Specifically, by traversing every pixel in the fabric texture image, the similarity or difference between the current color of each pixel and the reference color data is analyzed. Using a preset matching algorithm, pixels whose color features are highly similar to the reference color data or within a preset tolerance range are identified and marked as pixels requiring color adjustment. This constructs a precise selection area, ensuring that only the target color region is modified, avoiding accidental damage to other color regions on the fabric. For example, when processing red and white interwoven fabric, all red pixels and transition pixels with pink edges on the red and white interwoven areas are automatically identified and marked as objects requiring color adjustment, while pure white pixels are excluded, thus achieving precise local color replacement.

[0076] S50. Based on the color data offset, adjust the color data of the pixels to be adjusted and generate a preview simulation image.

[0077] Specifically, for the pixels marked as to be adjusted, their original color values ​​are read out one by one, and corresponding mathematical operations are performed on these original values ​​according to the calculated color data offset, such as addition or weight mapping, so as to give these pixels new color attributes. At the same time, the original relative brightness and darkness of the pixels are preserved during the adjustment process to maintain the image structure. All the adjusted pixels are recombined and rendered to generate a preview simulation image that intuitively shows the appearance of the fabric under the target color, so that users can see the overall visual feedback after the color change in real time.

[0078] S60. Based on the fabric texture image, determine the image edge texture image, and fuse the image edge texture image with the preview simulation image to generate a fitted color code fabric image.

[0079] Specifically, the color calculation process in step S50 may result in the loss or blurring of the micro-texture of the fabric surface, such as yarn knots and fuzziness. Therefore, a layer containing only high-frequency contour lines and surface noise information is separated from the original fabric texture image and defined as the image edge texture image. Then, using image synthesis technology, this texture layer that can represent physical tactile sensation is superimposed on the preview simulation image whose color has been changed. The light and dark details of the texture layer are used to enhance the three-dimensionality of the image. By enhancing the contrast of edges and details, the problem of texture blurring or loss that may be caused by color calculation is repaired, thereby outputting a final fitted image that has both the target color specified by the user and retains the physical texture of the real fabric.

[0080] In one embodiment, step S10, namely acquiring the fabric texture image of the fabric sample, specifically includes:

[0081] S11. Under preset lighting conditions and shooting distance, take a high-resolution image of a local area of ​​the fabric surface of the fabric sample using a macro photography device.

[0082] Specifically, the fabric sample is laid flat on a stage, and a lighting device with a constant color temperature, such as a D65 standard light source, and uniform illumination is used to avoid interference from ambient stray light and the generation of hard shadows. At the same time, the macro shooting equipment, such as an industrial camera or SLR camera equipped with a macro lens, is adjusted so that its lens optical axis is perpendicular to the fabric surface and maintained at a fixed shooting distance, such as 10-15cm. The lens optical axis is vertically aligned with the target sampling area on the fabric surface to ensure that the microscopic details of the fabric surface, such as the warp and weft yarn interlacing structure, surface fiber hairs, and weaving pores, can be captured at a 1:1 or even magnified scale. Under these conditions, the shooting command is triggered to take a picture, thereby obtaining a local high-definition original image containing rich detail information.

[0083] S12. Perform noise reduction and contrast enhancement processing on the local high-definition image to remove shooting noise and deepen the shadows on the fabric surface, and use the processed image as the fabric texture image.

[0084] Specifically, the captured high-resolution local images are read and optimized using digital image processing algorithms. First, noise reduction techniques such as non-local mean filtering are used to identify and remove Gaussian noise or salt-and-pepper noise generated by the image sensor, making the image cleaner. Then, contrast-limited adaptive histogram equalization technology is applied to stretch the histogram of each local block in the image, enhancing the contrast between the raised parts of the yarn and the recessed gaps, thereby increasing the gray level difference of the texture and making the originally flat texture three-dimensional and clear. The high-quality image after this processing is defined as the fabric texture image used in subsequent processes.

[0085] In one embodiment, step S20, namely, performing color region analysis on the fabric sample to determine at least one reference color region of the fabric sample and the reference color data corresponding to the reference color region, specifically includes:

[0086] S21. By using a spectrophotometer to sample multiple points on the surface of the fabric sample, multiple sets of Lab color space coordinate data are obtained.

[0087] Specifically, the operator or robotic arm controls the spectrophotometer's measuring probe to closely adhere to the surface of the fabric sample, triggering multiple measurements at different locations. These locations can be randomly distributed or cover different visual color areas. Each measurement acquires a set of values ​​(L, a, b*) based on the CIE Lab color space. This color space can simulate the non-linear perception of color by the human eye. Through multi-point physical sampling, it can obtain more accurate and objective absolute color values ​​than simple image capture, avoiding color differences caused by camera white balance drift, thus obtaining a set of discrete but accurate color coordinate data.

[0088] S22. Use the K-means clustering algorithm to perform cluster analysis on multiple sets of Lab color space coordinate data, identify at least one cluster center for the fabric sample, and divide the Lab color space coordinate data into different color clusters based on the cluster center.

[0089] Specifically, all the collected Lab color space coordinate data are used as input samples. The expected number of clusters K is set, such as 2 for two-color interwoven fabrics. The K-means clustering algorithm is run for iterative calculation. The algorithm will automatically find the center point of dense data distribution, i.e., the cluster center, and classify all sampling points into the nearest cluster according to their distance from each center. Thus, mathematically, the physical sampling data is automatically classified into data groups representing different main colors, such as background color and pattern color, i.e., color clusters. For example, all red measurement points are classified into one cluster, and all white measurement points are classified into another cluster.

[0090] S23. Based on the color clusters, determine the area of ​​each color cluster on the fabric sample as the corresponding reference color area.

[0091] Specifically, a logical mapping relationship between color clusters and fabric physical regions is established. The fabric range covered or represented by physical sampling points belonging to the same color cluster is defined as a reference color region. For example, all data points aggregated under the red cluster correspond to all red yarn weaving areas on the fabric and are marked as red reference regions, thus completing the definition from discrete data points to fabric physical property regions.

[0092] S24. Calculate the arithmetic mean of all Lab color space coordinate data in each color cluster, and use the arithmetic mean as the reference color data for the corresponding reference color area.

[0093] Specifically, for each determined color cluster, all Lab color space coordinate data contained therein are traversed, and the arithmetic statistical average of its lightness component L, red-green component a, and yellow-blue component b is calculated. By eliminating random errors or outlier interference that may be generated by a single measurement through statistical methods, a central value that best represents the color essence of the region is obtained. This average Lab value is determined as the baseline color data and serves as the absolute reference standard for subsequent calculations of color difference and offset.

[0094] In one embodiment, step S30, which calculates the color data offset in a preset space based on the target color data and the reference color data, specifically includes:

[0095] S31. Using a color space conversion algorithm, convert the target color data and the reference color data into values ​​corresponding to the HSV color space.

[0096] Specifically, it receives target color data specified by the user through the operation interface, such as the international standard Pantone color number or RGB values ​​containing the three primary color components, as well as the reference color data in Lab format determined in the aforementioned steps. It calls the standard color space conversion formula to uniformly map and transform the data into the HSV color space, which can separate the hue attribute and the brightness attribute of the color, thereby obtaining the corresponding values ​​(H1, S1, V1) and (H2, S2, V2) of the target color data and the reference color data in the three dimensions of hue (H), saturation (S), and lightness (V).

[0097] S32. Calculate the differences between the target color data and the reference color data in the dimensions of hue, saturation and lightness respectively, and obtain the color data offset based on the differences.

[0098] Specifically, under a unified HSV numerical coordinate system, differential offset operations are performed on the target color data and the acquired fabric reference color data to quantify the difference components of hue, saturation, and lightness, namely ΔH, ΔS, and ΔV. That is, the difference between the target hue value in the target color data and the reference hue value in the reference color data is the hue offset ΔH = H1 – H2. The difference between the target saturation value in the target color data and the reference saturation value in the reference color data is the saturation offset ΔS = S1 – S2. The difference between the target lightness value in the target color data and the reference lightness value in the reference color data is the lightness offset ΔV = V1 – V2. These three sets of values ​​constitute a complete color migration vector, quantifying the specific operations that need to be performed on the color wheel rotation angle, color concentration increase / decrease, and lightness increase to transform the fabric's original color into the user's desired color.

[0099] In one embodiment, step S40, which determines the pixels to be adjusted based on the fabric texture image, specifically includes:

[0100] S41. For each pixel in the fabric texture image, obtain the original HSV value of the pixel.

[0101] Specifically, the preprocessed fabric texture image is scanned pixel by pixel, the RGB values ​​at each coordinate point in the image matrix are read, and they are converted into the corresponding HSV values ​​in real time, i.e. the original HSV values, so as to obtain the current color state and brightness information of each tiny unit of the whole image.

[0102] S42. By using the Euclidean distance method, the color value difference between the original HSV value of the pixel and the reference color data is calculated.

[0103] Specifically, for a pixel P(x,y) currently being processed, its original HSV value (H p ,S p V p As a point, the HSV value (H) of the reference color data is used as a reference. ref ,S ref V ref As another point, the Euclidean distance formula is applied in the color space geometric coordinate system. The straight-line distance between these two points is calculated, and the similarity distance between the current pixel color and the reference color is quantified, namely the color value difference D. The smaller the difference value, the closer the current pixel is to the reference color, and the larger the value, the farther the color deviation is, thus realizing the digital measurement of the color attributes of all pixels in the image.

[0104] S43. By using the Gaussian distribution function, the mixing coefficient is calculated based on the color numerical difference.

[0105] Specifically, in order to simulate the natural diffusion and mixing effect of light at the yarn interlacing point, the difference value D calculated in the previous step is substituted into a Gaussian decay function with a preset standard deviation. This function maps smaller differences (i.e., colors that are close to the reference color strength) to an output value close to 1, and larger differences (i.e., colors that deviate from the reference color weakness) to an output value close to 0, thereby generating a smooth and continuous scaling factor between 0 and 1, i.e., a mixing coefficient. Through this soft mapping mechanism, the problem of harsh color transitions at the interlacing points of yarn-dyed fabrics is solved, and smooth edge processing of the selected area is achieved.

[0106] S44. Pixels with a blending coefficient greater than a preset threshold are identified as pixels to be adjusted.

[0107] Specifically, a very small value is set as a threshold, such as 0.05, to filter out all pixels with a blending coefficient higher than this threshold. These pixels are marked as pixels to be adjusted and processed in step S50. Through this filtering mechanism, background areas that are completely unrelated to the base color are excluded, such as red patterns on a white fabric. White areas are excluded, thus effectively eliminating completely irrelevant background noise or discolored yarns, ensuring that subsequent calculations are focused only on the effective target areas.

[0108] In one embodiment, step S50, which involves adjusting the color data of the pixel to be adjusted based on the color data offset to generate a preview simulation image, specifically includes:

[0109] S51. For each pixel to be adjusted in the fabric texture image, obtain the original HSV value corresponding to the pixel to be adjusted. The original HSV value includes the original hue value, the original saturation value, and the original brightness value.

[0110] Specifically, for each pixel to be adjusted that passes the screening and enters the processing queue, the original HSV value corresponding to the pixel to be adjusted is obtained, which includes the original hue value representing the type of color, such as red; the original saturation value representing the vividness of the color; and the original lightness value representing the brightness of the pixel, such as whether it is a lit surface or a shadow gap. These three components are prepared as independent variables to be input into the subsequent color transformation formula, ensuring that the color adjustment is based on the light and shadow state of the pixel itself, rather than blindly covering the entire screen.

[0111] S52. Construct a dynamic adaptive weighting coefficient based on the original brightness value, and perform a weighted calculation based on the dynamic adaptive weighting coefficient and the brightness offset in the color data offset to obtain the corrected brightness offset.

[0112] Specifically, to prevent damage to the fabric's three-dimensionality during color change, such as preventing black shadow gaps from being mistakenly brightened and turned gray, a brightness-based non-linear protection mechanism is introduced. Based on the original brightness value of the current pixel, a weight coefficient between 0 and 1, i.e., a dynamic adaptive weight coefficient, is calculated. Pixels with intermediate brightness are given higher weights, while extremely dark pixels, such as shadow gaps, or extremely bright pixels, such as highlights, are given extremely low weights. This coefficient is used to multiply and scale the globally uniform brightness offset ΔV to generate a corrected brightness offset ΔV' specifically for that particular pixel. This ensures that during color change, the originally deep shadows will not be mistakenly brightened and turned gray, and the original highlights will not be darkened, thus preserving the fabric's three-dimensional light and shadow effect.

[0113] S53. The hue offset, saturation offset, and corrected brightness offset in the color data offset are respectively superimposed onto the original hue value, original saturation value, and original brightness value corresponding to the pixel to obtain the transformed HSV value.

[0114] Specifically, the hue change ΔH and saturation change ΔS representing the target color are directly added to the original hue and saturation values ​​of the pixel, while the processed corrected lightness change ΔV' is added to the original lightness of the pixel, thus calculating a new set of HSV values ​​(H new ,S new V new ), that is, H new =H origin +ΔH, S new =S origin +ΔS,V new =V origin +ΔV', where (H origin ,S origin V origin The values ​​are the original hue, original saturation, and original brightness. This set of values ​​represents the color that the pixel should present under the ideal color-changing state, i.e., the transformed HSV value.

[0115] S54. Using a linear interpolation algorithm, the transformed HSV value and the original HSV value are weighted and fused according to the mixing coefficient to obtain the final HSV value and generate a preview simulation image.

[0116] Specifically, in order to eliminate the harsh boundary between the color-changing area and the non-color-changing area, the mixing coefficient K generated in step S43 is called as the Alpha channel or the blending ratio, and a weighted average calculation is performed. The final value = transformation value × K + original value × (1-K). This operation makes the pixels located in the pure color area completely change to the new color, while the pixels located at the interlacing edge present a mixed state of old and new colors, simulating the color mixing mechanism of real yarn. After all pixels are calculated, they are reorganized into an image matrix, thus generating a preview simulation image with natural color transition and no jagged edges.

[0117] In one embodiment, step S52, namely, determining the dynamic adaptive weighting coefficients based on the original brightness values, specifically includes:

[0118] S521. Set the shadow protection threshold, highlight protection threshold, and maximum value of the HSV color space lightness channel, where the shadow protection threshold is less than the highlight protection threshold, and the highlight protection threshold is less than the maximum value of lightness.

[0119] Specifically, based on the image data bit depth, such as the maximum value of 255 for an 8-bit image, and the optical characteristics of the fabric, three key brightness node parameters are pre-configured: a shadow protection threshold of 30 that defines the upper limit of the dark gap area, a highlight protection threshold of 220 that defines the lower limit of the reflective bright area, and a physical brightness maximum value of 255. These three parameters divide the brightness coordinate axis into a low-brightness shadow segment, a high-brightness highlight segment, and a normal exposure segment in between.

[0120] S522. If the original brightness value is within the range of the shadow protection threshold and the highlight protection threshold, then the dynamic adaptive weighting coefficient is set to 1.

[0121] Specifically, when the original brightness value of a pixel is detected to be within the range of the shadow protection threshold and the highlight protection threshold, i.e., in the mid-tone area, such as when the original brightness value is 128, it is determined that the pixel has complete color-changing freedom and the dynamic adaptive weight coefficient is 1, which means that the brightness offset is allowed to be superimposed on the pixel by 100%, thereby ensuring that the main color of the fabric can be accurately transformed into the target color specified by the user.

[0122] S523. If the original brightness value is less than the shadow protection threshold, calculate the ratio of the difference between the original brightness value and the initial brightness value to the shadow protection threshold, and determine the ratio as the dynamic adaptive weighting coefficient.

[0123] Specifically, when the original brightness value of a pixel is detected to be lower than the shadow protection threshold, it indicates that the pixel belongs to the shadow of a dark seam or fold in the fabric. The percentage of the original brightness value relative to the shadow protection threshold is calculated using the following formula: , where V origin T represents the original brightness value.shadow The shadow protection threshold is used as a factor of 0.5, for example, when the original brightness value is 15 and the shadow protection threshold is 30. This ratio is used as a dynamic adaptive weighting coefficient, which means that only a 50% change in brightness is allowed at this point.

[0124] S524. If the original brightness value is greater than the highlight protection threshold, calculate the ratio of the absolute value of the difference between the original brightness value and the maximum brightness value to the absolute value of the difference between the highlight protection threshold and the maximum brightness value, and determine the ratio as the dynamic adaptive weighting coefficient.

[0125] Specifically, when the original brightness value of a pixel is detected to be higher than the highlight protection threshold, it indicates that the pixel belongs to a highly reflective area. The ratio of the difference between the pixel's brightness value and the maximum brightness value to the entire highlight brightness range is calculated using the following formula: , where V max T represents the maximum brightness. highlight The highlight protection threshold is set as follows: for example, when the original brightness value is 240, the highlight protection threshold is 220, and the maximum brightness value is 255, the ratio is 0.42. This ratio is used as a dynamic adaptive weighting coefficient, which means that only about 42% brightness change is allowed at this point.

[0126] In one embodiment, step S60, namely, determining an image edge texture image based on the fabric texture image, and fusing the image edge texture image with the preview simulation image to generate a fitted color code fabric image, specifically includes:

[0127] S61. Use an edge detection algorithm to perform convolution calculation on the fabric texture image, identify the regions in the fabric texture image where pixel values ​​change abruptly as texture boundaries, and generate an image edge texture image.

[0128] Specifically, in order to recover the microscopic details that may be lost due to color-changing calculations, edge detection algorithms such as the Sobel operator and the Laplacian operator are applied to perform spatial or frequency domain convolution operations on the original fabric texture image. This algorithm will keenly capture the locations in the image where the brightness changes drastically, such as the edges of yarns, fiber knots, and the edges of weaving pores, and filter out smooth color areas to gray or black, thereby outputting a grayscale image that only contains lines, noise, and contours. This image is the image edge texture image.

[0129] S62. A multi-scale image fusion strategy is adopted, using the preview simulation image as the base image and the image edge texture image as the detail layer, and the image fusion operation is performed layer by layer to output the fitted color number fabric image.

[0130] Specifically, multi-scale image fusion technology is used to construct a multi-scale image pyramid structure. The preview simulation image with correct color but slightly smooth details is placed at the bottom as a low-frequency color base, and the extracted image edge texture image is placed at the top as a high-frequency texture cover. The Laplacian pyramid algorithm or soft light and other hybrid mode algorithms are used to carve the texture details back onto the color base at different resolution levels, ensuring that no matter how drastic the color changes, the tiny hairs and yarn textures on the fabric surface can be clearly revealed. The final output is a fabric image with a fitted color number that has both the target color number and the real feel.

[0131] To verify the beneficial effects of the technical solution of this application, this embodiment selected a fabric with typical knitted texture characteristics as an experimental sample and conducted simulated tests for several different target color numbers. Figure 2 and Figure 3 As shown, firstly, a macro photography device was used to acquire the fabric texture image of the experimental sample. The experimental sample was a light-colored knitted fabric with a distinct warp and weft yarn interlacing structure and surface fuzz characteristics. The system acquired a cover image containing the overall appearance and a macro texture image showing microscopic details such as yarn knots and fiber orientation through image acquisition. Simultaneously, a spectrophotometer was used to measure the physical color of the original sample to determine its baseline color data. Four target color numbers with different color gradations were selected as test objects: 33# (grayish brown), 34# (light khaki), 35# (desert gray), and 36# (swallow gray). As shown in the figure, these colors exhibit subtle differences in hue and brightness. Subsequently, the color simulation method described in this application was applied to calculate the offset between the baseline color and the corresponding target color, thereby generating the image shown below. Figure 5 The fitted color fabric images shown demonstrate that, for color numbers 33# and 34# with similar hue and brightness, the simulated images not only accurately reproduce the subtle differences in grayscale of the target color values, but also clearly and completely preserve the iconic "V" shaped weave structure and fine surface hairs of the knitted fabric, verifying the effectiveness of the frequency domain texture fusion technology. For the high-brightness 35# desert gray, thanks to the constraint of the high light protection threshold, the fabric's illuminated surface did not exhibit overexposure and whitening, retaining a delicate luster. For the low-brightness 36# swallow gray, thanks to the constraint of the shadow protection threshold, the deep black areas at the yarn interlacing gaps did not lose detail due to the overall darkening of the color. In summary, the experiments prove that the images generated by the method of this application are highly consistent with the target in RGB / Lab values, and can perfectly achieve high-fidelity coexistence of color transfer and physical light and shadow texture and micro-texture.

[0132] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0133] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data such as fabric texture images, reference color data, and fitted color code fabric images. The network interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a fabric color simulation method.

[0134] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0135] Obtain the fabric texture image of the fabric sample;

[0136] Perform color region analysis on the fabric sample to determine at least one reference color region of the fabric sample and the reference color data corresponding to the reference color region.

[0137] Obtain the target color data input by the user for the reference color area, and calculate the color data offset in the preset space based on the target color data and the reference color data;

[0138] Based on the fabric texture image, determine the pixels to be adjusted;

[0139] Based on the color data offset, the color data of the pixel to be adjusted is adjusted to generate a preview simulation image;

[0140] Based on the fabric texture image, the edge texture image is determined, and the edge texture image is fused with the preview simulation image to generate a fabric image with a fitted color code.

[0141] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0142] Obtain the fabric texture image of the fabric sample;

[0143] Perform color region analysis on the fabric sample to determine at least one reference color region of the fabric sample and the reference color data corresponding to the reference color region.

[0144] Obtain the target color data input by the user for the reference color area, and calculate the color data offset in the preset space based on the target color data and the reference color data;

[0145] Based on the fabric texture image, determine the pixels to be adjusted;

[0146] Based on the color data offset, the color data of the pixel to be adjusted is adjusted to generate a preview simulation image;

[0147] Based on the fabric texture image, the edge texture image is determined, and the edge texture image is fused with the preview simulation image to generate a fabric image with a fitted color code.

[0148] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0149] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0150] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for simulating fabric color, characterized in that, The fabric color simulation method includes: Obtain the fabric texture image of the fabric sample; Color region analysis is performed on the fabric sample to determine at least one reference color region of the fabric sample and the reference color data corresponding to the reference color region. Obtain the target color data input by the user for the reference color area, and calculate the color data offset in the preset space based on the target color data and the reference color data; Based on the fabric texture image, determine the pixels to be adjusted; Based on the color data offset, the color data of the pixel to be adjusted is adjusted to generate a preview simulation image; Based on the fabric texture image, an image edge texture image is determined, and the image edge texture image is fused with the preview simulation image to generate a fitted color fabric image.

2. The fabric color simulation method according to claim 1, characterized in that, The acquisition of the fabric texture image of the fabric sample specifically includes: Under preset lighting conditions and shooting distance, a high-resolution image of a local area of ​​the fabric sample's surface is captured using a macro photography device. The local high-definition image is subjected to denoising and contrast enhancement processing to remove shooting noise and deepen the shadows on the fabric surface, and the processed image is used as the fabric texture image.

3. The fabric color simulation method according to claim 1, characterized in that, The step of performing color region analysis on the fabric sample to determine at least one reference color region of the fabric sample and the reference color data corresponding to the reference color region specifically includes: Multiple sets of Lab color space coordinate data were obtained by sampling the fabric surface of the fabric sample at multiple points using a spectrophotometer. The K-means clustering algorithm is used to perform cluster analysis on multiple sets of Lab color space coordinate data to identify at least one cluster center of the fabric sample. Based on the cluster center, the Lab color space coordinate data is divided into different color clusters. Based on the color clusters, the area of ​​each color cluster on the fabric sample is determined as the corresponding reference color area; Calculate the arithmetic mean of all Lab color space coordinate data in each color cluster, and use the arithmetic mean as the reference color data for the corresponding reference color region.

4. The fabric color simulation method according to claim 3, characterized in that, The step of calculating the color data offset in a preset space based on the target color data and the reference color data specifically includes: Using a color space conversion algorithm, the target color data and the reference color data are converted into values ​​corresponding to the HSV color space; The differences between the target color data and the reference color data in the dimensions of hue, saturation, and lightness are calculated respectively, and the color data offset is obtained based on the differences.

5. The fabric color simulation method according to claim 4, characterized in that, The step of determining the pixel to be adjusted based on the fabric texture image specifically includes: For each pixel in the fabric texture image, obtain the original HSV value of the pixel; The difference between the original HSV value of the pixel and the color value of the reference color data is calculated by using the Euclidean distance method. The mixing coefficient is calculated by using the Gaussian distribution function based on the color numerical difference. Pixels with a mixing coefficient greater than a preset threshold are identified as the pixels to be adjusted.

6. The fabric color simulation method according to claim 5, characterized in that, The step of adjusting the color data of the pixel to be adjusted based on the color data offset and generating a preview simulation image specifically includes: For each pixel to be adjusted in the fabric texture image, the original HSV value corresponding to the pixel to be adjusted is obtained. The original HSV value includes the original hue value, the original saturation value, and the original brightness value. A dynamic adaptive weighting coefficient is constructed based on the original brightness value. The corrected brightness offset is obtained by weighting the dynamic adaptive weighting coefficient and the brightness offset in the color data offset. The hue offset, saturation offset, and corrected brightness offset in the color data offset are respectively superimposed on the original hue value, original saturation value, and original brightness value corresponding to the pixel to obtain the transformed HSV value; Using a linear interpolation algorithm, the transformed HSV value and the original HSV value are weighted and fused according to the mixing coefficients to obtain the final HSV value and generate the preview simulation image.

7. The fabric color simulation method according to claim 6, characterized in that, The determination of the dynamic adaptive weight coefficients based on the original brightness value specifically includes: Set the shadow protection threshold, highlight protection threshold, and maximum value of the lightness channel in the HSV color space, wherein the shadow protection threshold is less than the highlight protection threshold, and the highlight protection threshold is less than the maximum value of lightness; If the original brightness value is within the range of the shadow protection threshold and the highlight protection threshold, then the dynamic adaptive weighting coefficient is determined to be 1; If the original brightness value is less than the shadow protection threshold, then the ratio of the difference between the original brightness value and the initial brightness value to the shadow protection threshold is calculated, and the ratio is determined as the dynamic adaptive weight coefficient. If the original brightness value is greater than the highlight protection threshold, then the ratio of the absolute value of the difference between the original brightness value and the maximum brightness value to the absolute value of the difference between the highlight protection threshold and the maximum brightness value is calculated, and the ratio is determined as the dynamic adaptive weighting coefficient.

8. The fabric color simulation method according to claim 1, characterized in that, The step of determining an image edge texture image based on the fabric texture image, and fusing the image edge texture image with the preview simulation image to generate a fitted color code fabric image specifically includes: The fabric texture image is convolved using an edge detection algorithm to identify regions in the fabric texture image where pixel values ​​change abruptly as texture boundaries, thereby generating an image edge texture image. A multi-scale image fusion strategy is adopted, using the preview simulation image as the base image and the image edge texture image as the detail layer, and the image fusion operation is performed layer by layer to output the fitted color fabric image.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the fabric color simulation method as described in any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the fabric color simulation method as described in any one of claims 1 to 8.