LAB-based color changing method and system for keeping texture of clothing image
The LAB color space method addresses the limitations of RGB-based clothing color change by enabling precise color control and texture preservation, enhancing the quality of clothing color transformations.
Patent Information
- Application Number
- CN202510492374.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-07-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing clothing color change technology is difficult to achieve precise control in the RGB color space, resulting in distortion of texture and texture, which cannot meet the needs of high-fidelity color change effects.
The LAB color space is used for clothing image processing, and through outline feature recognition, palette extraction and color space conversion, image processing is performed between the LAB color space and the RGB color space respectively to ensure channel independence to achieve precise color control and texture retention.
It realizes precise control of color change in clothing, reduces texture blur and texture distortion, improves the overall effect of color change in clothing, and meets the market's demand for color change in high-quality clothing.
Smart Images

Figure CN120318370A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a method and system for changing the color of a clothing image while preserving the texture and texture based on LAB. Background Art
[0002] Existing clothing color-changing technologies are mainly implemented based on the RGB color space, and color replacement is achieved by adjusting color channels. When performing color-changing operations, the values of the three RGB color channels of the image are directly adjusted to achieve the purpose of changing the color of the clothing. For example, if a red clothing is to be changed to a blue clothing, the value of the red channel will be reduced in the RGB channels, and at the same time, the value of the blue channel will be increased.
[0003] However, the linear characteristics of the RGB color space greatly limit the flexibility and accuracy of color transformation. In the actual color-changing process, due to the mutual correlation between the RGB channels, the adjustment of one channel often affects other channels, making it difficult to precisely control the color change. Moreover, this color adjustment method is extremely likely to cause distortion of the clothing texture and texture. For example, when changing a dark-colored clothing to a light-colored clothing, the delicate texture on the original clothing may become blurred due to the drastic change in the values of the color channels; when processing clothing with special textures (such as the luster of leather and the pleat texture of fabric), these texture features will be greatly weakened or even disappear after color change, unable to meet the user's demand for high-fidelity color-changing effects. Summary of the Invention
[0004] The present invention provides a method and system for changing the color of a clothing image while preserving the texture and texture based on LAB, so as to achieve precise control of clothing color transformation, while better maintaining the texture and texture of the clothing, improving the overall effect of clothing color change, and meeting the market demand for high-quality clothing color change.
[0005] In a first aspect, the present invention provides a method for changing the color of a clothing image while preserving the texture and texture based on LAB, including:
[0006] Performing contour feature recognition on the source clothing image and the target clothing image to respectively obtain the source clothing color area, the source clothing background area, and the target clothing color area;
[0007] Performing palette extraction on the source clothing color area and the target clothing color area to respectively obtain the source clothing palette and the target clothing palette;
[0008] Converting the source clothing color area, the target clothing color area, the source clothing palette, and the target clothing palette from the RGB color space to the LAB color space;
[0009] Perform area color replacement on the source clothing color area based on the first conversion result in the LAB color space to obtain the clothing area after color replacement;
[0010] Fuse the second conversion result of converting the source clothing background area and the clothing area after color replacement from the LAB color space back to the RGB color space to obtain the clothing image after color replacement.
[0011] In a second aspect, the present invention also provides a LAB-based clothing image texture-preserving color replacement system, which is applied to the LAB-based clothing image texture-preserving color replacement method as described in the first aspect; the LAB-based clothing image texture-preserving color replacement system includes:
[0012] A matte extraction module, configured to perform contour feature recognition on the source clothing image and the target clothing image, and respectively obtain the source clothing color area, the source clothing background area, and the target clothing color area;
[0013] A color palette extraction module, configured to perform color palette extraction on the source clothing color area and the target clothing color area, and respectively obtain the source clothing color palette and the target clothing color palette;
[0014] A color space conversion module, configured to convert the source clothing color area, the target clothing color area, the source clothing color palette, and the target clothing color palette from the RGB color space to the LAB color space;
[0015] An area color replacement module, configured to perform area color replacement on the source clothing color area based on the first conversion result in the LAB color space to obtain the clothing area after color replacement;
[0016] An area fusion module, configured to fuse the second conversion result of converting the source clothing background area and the clothing area after color replacement from the LAB color space back to the RGB color space to obtain the clothing image after color replacement.
[0017] In a third aspect, the present invention also provides an electronic device, including: a memory, configured to store a computer software program; a processor, configured to read and execute the computer software program, so as to implement the LAB-based clothing image texture-preserving color replacement method as described in any one of the above.
[0018] In a fourth aspect, the present invention also provides a non-transitory computer-readable storage medium, in which a computer software program is stored, and when the computer software program is executed by a processor, the LAB-based clothing image texture-preserving color replacement method as described in any one of the above is implemented.
[0019] Fifth aspect, the present invention also provides a computer program product, including a computer program which, when executed by a processor, implements the LAB-based method for changing the color of a clothing image while preserving the texture as described in any one of the above.
[0020] The LAB-based method for changing the color of a clothing image while preserving the texture provided by the embodiments of the present invention converts the source clothing color area, the target clothing color area, the source clothing color palette, and the target clothing color palette from the RGB color space to the LAB color space. The channels in the LAB color space are relatively independent. Therefore, when performing area color change on the source clothing color area based on the first conversion result in the LAB color space, due to the relative independence of the channels, the change of color can be controlled more precisely, improving the accuracy of color transformation and achieving precise control of clothing color transformation. On the other hand, since the channels in the LAB color space are relatively independent, adjusting a certain channel will not strongly affect other channels as in the RGB color space. Therefore, when performing color change operations, the change of brightness can be controlled more reasonably, avoiding the problem of texture blur caused by drastic changes in the color channel values, thus better preserving the special texture features of the clothing. Finally, the source clothing background area and the color-changed clothing area are fused with the second conversion result from the LAB color space back to the RGB color space, ensuring the overall effect of the color-changed clothing image, reducing the situation of texture and texture distortion, and achieving better preservation of the texture and texture of the clothing. Therefore, the embodiments of the present invention improve the overall effect of clothing color change and meet the market demand for high-quality clothing color change. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a schematic flowchart of the LAB-based method for changing the color of a clothing image while preserving the texture provided by the embodiments of the present invention;
[0022] Figure 2 is a schematic structural diagram of the LAB-based system for changing the color of a clothing image while preserving the texture provided by the embodiments of the present invention;
[0023] Figure 3 is an embodiment diagram of the electronic device provided by the embodiments of the present invention;
[0024] Figure 4 is an embodiment diagram of the computer-readable storage medium provided by the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
[0026] In the description of the present invention, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the said features. In the description of the present invention, "a plurality" means two or more unless otherwise specifically defined.
[0027] In the description of the present invention, the term "for example" is used to mean "serving as an example, illustration, or explanation". Any embodiment described as "for example" in the present invention is not necessarily construed as being more preferred or having more advantages than other embodiments. In order to enable any person skilled in the art to implement and use the present invention, the following description is given. In the following description, details are set forth for the purpose of explanation. It should be understood that those of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope that conforms to the principles and features disclosed in the present invention.
[0028] Optionally, refer to Figure 1 , Figure 1 FIG.
[0029] is a schematic flowchart of the method for changing the color of a clothing image while preserving the texture of the clothing based on LAB provided by the present invention. In the embodiments of the present invention, the execution subject of the method for changing the color of a clothing image while preserving the texture of the clothing based on LAB is an image processing system. Therefore, the method for changing the color of a clothing image while preserving the texture of the clothing based on LAB includes:
[0030] Optionally, when a user needs to change the color of an image, the image (source clothing image) and the image to be color-changed (target clothing image) need to be input into the image processing system. Therefore, the image processing system can obtain the source clothing image and the target clothing image.
[0031] Furthermore, the image processing system performs contour feature recognition on the source clothing image and the target clothing image, that is, image matting processing, to obtain the source clothing color region, the source clothing background region, and the target clothing color region.
[0032] For example, computer vision techniques such as edge detection algorithms (e.g., Canny edge detection) and image segmentation algorithms (such as threshold-based segmentation, semantic segmentation, etc.) are used to identify the contour features of clothing. Through the above algorithms, the clothing part and the background part can be distinguished. For the source clothing image, the identified clothing part is the source clothing color area, and the rest is the source clothing background area. For the target clothing image, the identified clothing part is the target clothing color area.
[0033] In one embodiment, there is a source clothing image of a red T-shirt worn on a model with a blue solid background. There is also a target clothing image of a green sweatshirt with a white solid background. The image processing system uses a semantic segmentation algorithm to process the source clothing image and identifies the area of the red T-shirt as the source clothing color area and the model background part as the source clothing background area. For the target clothing image, the area of the green sweatshirt is identified as the target clothing color area.
[0034] Step 20: Extract color palettes from the source clothing color area and the target clothing color area to obtain the source clothing color palette and the target clothing color palette respectively.
[0035] Furthermore, the image processing system performs color palette extraction operations on the source clothing color area and the target clothing color area. Color palette extraction refers to extracting the main color set from the image area to obtain the source clothing color palette and the target clothing color palette. In the embodiments of the present invention, a clustering algorithm (such as K-Means clustering) can be used to achieve this. For example, the image processing system takes the color values of each pixel in the source clothing color area and the target clothing color area as data points, and through the clustering algorithm, pixels with similar colors are grouped into one category. The central color of each category can be used as a color in the color palette. The color set obtained by clustering the source clothing color area is the source clothing color palette, and the same operation is performed on the target clothing color area to obtain the target clothing color palette, as specifically described in steps 201 to 203.
[0036] Continuing with the above embodiment, for the source clothing color area of the previously mentioned source clothing image (red T-shirt), the image processing system uses the K-Means clustering algorithm to cluster pixels with similar colors. For example, after clustering, three main colors, red, light red, and dark red, are obtained. Then the source clothing color palette contains these three colors. For the target clothing color area of the target clothing image (green sweatshirt), the K-Means clustering is also used, and green, light green, and dark green are obtained, which constitute the target clothing color palette.
[0037] Step 30: Convert the source clothing color area, the target clothing color area, the source clothing color palette, and the target clothing color palette from the RGB color space to the LAB color space.
[0038] Further, since the LAB color space has better characteristics in color processing (such as being closer to human visual perception, relatively independent color components, etc.), the image processing system converts the color values in the source clothing color region, target clothing color region, source clothing color palette, and target clothing color palette from the RGB color space to the LAB color space. Among them, the RGB color space cannot be directly converted to the LAB color space and needs to be first converted to the CIEXYZ color space and then to the LAB color space, that is: RGB - CIEXYZ - LAB. The specific conversion formula from RGB to LAB will not be elaborated here.
[0039] Step 40: Perform regional color replacement on the source clothing color region based on the first conversion result in the LAB color space to obtain the color - replaced clothing region.
[0040] Optionally, the first conversion result in the LAB color space in the embodiments of the present invention includes the channel values of the source clothing color region, target clothing color region, source clothing color palette, and target clothing color palette in the LAB color space. Among them, the channel values include the a - channel value, b - channel value, and L - channel value. Therefore, the image processing system performs regional color replacement on the source clothing color region according to the channel values of the source clothing color region, target clothing color region, source clothing color palette, and target clothing color palette in the LAB color space to obtain the color - replaced clothing region, as specifically described in Steps 401 to 403.
[0041] Step 50: Fuse the source clothing background region with the second conversion result of the color - replaced clothing region converted back from the LAB color space to the RGB color space to obtain the color - replaced clothing image.
[0042] Further, the image processing system converts the color - replaced clothing region from the LAB color space back to the RGB color space, and the calculation is also performed according to the conversion formula from the LAB color space to the RGB color space.
[0043] Further, the image processing system keeps the source clothing background area unchanged (since the background area has not been color-changed before), and performs an image fusion operation on the color-changed clothing area converted back to the RGB color space. Among them, the fusion operation can adopt a simple pixel superposition method (for example, for each pixel position, if it is the clothing area, use the pixel value of the color-changed clothing area, and if it is the background area, use the pixel value of the source clothing background area), so as to obtain the final color-changed clothing image. In an embodiment, the source clothing background area is the model background. The image processing system fuses the pixel values of the color-changed clothing area and the pixel values of the source clothing background area, uses the color-changed pixel values for the pixels in the clothing area, and uses the original model pixel values for the pixels in the background area, and finally obtains a color-changed clothing image, that is, the original red T-shirt becomes a green T-shirt, and the background is still the model background.
[0044] In the embodiment of the present invention, the source clothing color area, the target clothing color area, the source clothing color palette, and the target clothing color palette are converted from the RGB color space to the LAB color space. The channels in the LAB color space are relatively independent. Therefore, when performing area color-changing on the source clothing color area based on the first conversion result in the LAB color space, due to the relatively independent channels, the change of color can be controlled more precisely, the accuracy of color transformation is improved, and the precise control of clothing color transformation is realized. On the other hand, since the channels in the LAB color space are relatively independent, the adjustment of a certain channel will not strongly affect other channels as in the RGB color space. Therefore, when performing the color-changing operation, the change of brightness can be controlled more reasonably, avoiding the problem of texture blurring caused by the drastic change of color channel values, so as to better retain the special texture features of the clothing. Finally, the source clothing background area and the color-changed clothing area are fused with the second conversion result converted back to the RGB color space from the LAB color space, ensuring the overall effect of the color-changed clothing image, reducing the situation of texture and texture distortion, realizing better retention of the texture and texture of the clothing, thus improving the overall effect of clothing color-changing and meeting the market demand for high-quality clothing color-changing.
[0045] In an embodiment, the process of extracting the color palette for the source clothing color area and the target clothing color area is the same. Therefore, the embodiment of the present invention takes the extraction of the source clothing color palette from the source clothing color area as an example for description. Therefore, the descriptions of steps 201 to 203 are as follows:
[0046] Step 201, for each pixel point of the source clothing color area in the RGB color space, perform hue adjustment based on each color component to obtain the hue-optimized color value.
[0047] Optionally, for each pixel in the source clothing color area in the RGB color space, the image processing system traverses each pixel. In the RGB color space, each pixel consists of three color components: red (R), green (G), and blue (B). Thus, the respective color components of each pixel are obtained.
[0048] Further, the image processing system performs hue adjustment on each pixel according to the red color component, green color component, and blue color component of each pixel, and obtains the color value after hue optimization for each pixel. The specific formula is:
[0049]
[0050] where C i represents the color value after hue optimization of the i-th pixel, R i represents the red color component of the i-th pixel, G i represents the green color component of the i-th pixel, and B i represents the blue color component of the i-th pixel.
[0051] Step 202: Determine the initial clustering centers based on the number of color points in each sub-region within the neighborhood of each pixel, and assign each pixel to the corresponding color cluster according to the color difference between the color value after hue optimization and the central color value of each initial clustering center.
[0052] Further, with each pixel as the center and a preset range as the neighborhood, the image processing system obtains the number of color points in each sub-region within the neighborhood of each pixel. The preset range is, for example, 3*3, 5*5, etc. The size of each sub-region within the neighborhood is equal, and the sub-region with the largest number of color points within each neighborhood is determined as the initial clustering center, obtaining multiple initial clustering centers. The central color value of each initial clustering center is equal to the average value of the color values after hue optimization of all color points within the group of sub-regions.
[0053] Further, the image processing system calculates the color difference between the color value after hue optimization of each pixel and the central color value of each initial clustering center, and assigns each pixel to the cluster corresponding to the initial clustering center with the smallest color difference, thereby assigning each pixel to the corresponding color cluster.
[0054] Step 203: Update the clustering centers of each color cluster based on each color value after hue optimization within each color cluster, and extract the color palette based on the updated color clusters to obtain the source clothing color palette.
[0055] Further, for each color cluster, the image processing system updates the clustering center of each color cluster according to each color value after hue optimization within each color cluster. Specifically:
[0056]
[0057] Among them, Center i-new represents the new cluster center of the i-th color cluster, and C j represents the color value after hue optimization of the j-th color within the i-th color cluster, and m represents the number of color points within the i-th color cluster.
[0058] Furthermore, the image processing system extracts a palette according to the updated color clusters to obtain the source clothing palette, as specifically described in steps 2031 to 2033.
[0059] The embodiment of the present invention can extract a representative source clothing palette from the source clothing color area, providing a basis for subsequent operations such as color replacement, and helping to achieve an accurate clothing color change effect.
[0060] In one embodiment, the descriptions of steps 2031 to 2033 are as follows:
[0061] Step 2031: Based on the central color value of each updated color cluster and the color value range within the cluster, perform cluster merging to obtain the merged clusters and the clusters to be split.
[0062] Optionally, the color value range in the embodiment of the present invention represents the difference between the maximum color value and the minimum color value within the cluster. Therefore, the image processing system obtains the central color value and the color value range of each updated color cluster, where the central color value of each updated color cluster is equal to the mean of the color values after hue optimization of all color points within each updated color cluster.
[0063] Furthermore, the image processing system calculates the similarity between any two updated color clusters according to the central color value and the color value range of any two updated color clusters. The specific formula is:
[0064]
[0065] Among them, Sim(K1, K2) represents the similarity between the updated color cluster K1 and the updated color cluster K2, and C center1 represents the central color value of the updated color cluster K1, and C center2 represents the central color value of the updated color cluster K2, and R center1 represents the color value range of the updated color cluster K1, and R center2 represents the color value range of the updated color cluster K2, and max() represents the maximum value function.
[0066] Further, the image processing system merges two updated color clusters with a similarity greater than a preset threshold to obtain a merged cluster, and determines the remaining clusters in the updated color clusters except the merged cluster as the clusters to be split.
[0067] Step 2032, for each cluster to be split, based on the central color value, the number of color points, and the hue-optimized color value of each color point, determine the color dispersion degree, and split each cluster to be split based on the color dispersion degree to obtain new split clusters.
[0068] Further, for each cluster to be split, the image processing system obtains the central color value, the number of color points, and the hue-optimized color value of each color point of each cluster to be split, and calculates the color dispersion degree of each cluster to be split according to the central color value, the number of color points, and the hue-optimized color value of each color point. The specific formula is as follows:
[0069] where D i-s represents the color dispersion degree of the i-th cluster to be split, C i-center represents the central color value of the i-th cluster to be split, M represents the number of color points of the i-th cluster to be split, and C ik represents the k-th hue-optimized color value of the i-th cluster to be split.
[0070] Further, the image processing system determines the clusters to be split with a color dispersion degree greater than a preset dispersion degree threshold, where the preset dispersion degree threshold is set according to the actual situation.
[0071] Further, the image processing system divides each cluster to be split into multiple local regions, and determines the local color value according to the mean value of the hue-optimized color values of all color points in each local region.
[0072] Further, the image processing system determines the local color difference value between each local region and the central color value according to the color difference between the local color value of each local region and the central color value.
[0073] Further, the image processing system determines the position of the largest local color difference value in each target split cluster, and splits each target split cluster at this position to obtain two new split clusters for each target split cluster.
[0074] Step 2033, perform color screening based on the central color values and the number of color points of the merged clusters and the new split clusters to obtain the source clothing color palette.
[0075] Further, the image processing system obtains the central color values of the merged clusters and the newly split clusters, as well as the number of color points in the merged clusters and the newly split clusters. Among them, the central color value is the average of the hue-optimized color values of all color points.
[0076] Further, the image processing system calculates the color priority value of the merged cluster according to the central color value and the number of color points of the merged cluster, and calculates the color priority value of each newly split cluster according to the central color value and the number of color points of each newly split cluster. The specific formula is:
[0077]
[0078] Among them, P color represents the color priority value, C center represents the central color value, L represents the number of color points, and N represents the sum of all data points of the clusters.
[0079] Further, the image processing system determines the color corresponding to the central color value of the cluster whose color priority value is greater than the preset priority threshold as the source clothing color palette, where the preset priority threshold is set according to the actual situation.
[0080] The embodiments of the present invention can extract a representative source clothing color palette from the source clothing color area, providing a basis for subsequent operations such as color replacement, and helping to achieve an accurate clothing color replacement effect.
[0081] In one embodiment, the descriptions of steps 401 to 403 are as follows:
[0082] Step 401, for each pixel point in the LAB color space of the source clothing color area, based on the first a-channel value and the first b-channel value, and combining the second a-channel value and the second b-channel value of the target clothing color palette in the LAB color space, determine the first target a-channel value and the first target b-channel value;
[0083] Optionally, in the LAB color space, the a-channel represents the color range from green to red, and the b-channel represents the color range from blue to yellow. For each pixel point in the source clothing color area, it has corresponding first a-channel value and first b-channel value in the LAB color space. The target clothing color palette also has its corresponding second a-channel value and second b-channel value in the LAB color space.
[0084] Further, the image processing system calculates the target a-channel value and the target b-channel value corresponding to each pixel point according to the first a-channel value and the first b-channel value of the pixel points in the source clothing color area, and the second a-channel value and the second b-channel value of the target clothing color palette through a mapping relationship (such as linear mapping, mapping based on color distribution, etc.). Among them, the mapping formula in the embodiments of the present invention is: target channel value = first channel value + (second channel value - first channel value) * h, where h is a preset proportionality coefficient, such as h = 0.5.
[0085] In one embodiment, there is a pixel point P in the source clothing color area, whose first a-channel value in the LAB color space is a1 = 20, and the first b-channel value is b1 = 30. The second a-channel value of the target clothing color palette in the LAB color space is a2 = 40, and the second b-channel value is b2 = 50. For the a-channel, the mapping formula is: target a-channel value = a1 + (a2 - a1) * k, such as k = 0.5. Then the target a-channel value = 20 + (40 - 20) * 0.5 = 30. For the b-channel, the target b-channel value = b1 + (b2 - b1) * k. Substituting the values, we get the target b-channel value = 30 + (50 - 30) * 0.5 = 40. Therefore, the target a-channel value of pixel point P is 30, and the target b-channel value is 40.
[0086] Step 402: Determine the L-channel difference based on the first L-channel value and the second L-channel value of the source clothing color palette in the LAB color space, and determine the first target L-channel value based on the L-channel difference and the third L-channel value of the target clothing color palette in the LAB color space.
[0087] Further, the L-channel represents brightness in the LAB color space. Each pixel point in the source clothing color area has its corresponding first L-channel value, representing the brightness of the pixel point. The source clothing color palette also has a corresponding second L-channel value in the LAB color space, representing the overall brightness characteristic of the color palette.
[0088] Further, the image processing system obtains the L-channel difference of each pixel point in the LAB color space by calculating the difference between the first L-channel value of each pixel point and the second L-channel value of the source clothing color palette. Among them, the L-channel difference reflects the difference between the brightness of each pixel point and the overall brightness of the source clothing color palette.
[0089] Further, the image processing system adds the L-channel difference of each pixel point in the source clothing color area to the third L-channel value of the target clothing color palette in the LAB color space (representing the brightness characteristic of the target clothing color palette) to obtain the target L-channel value of each pixel point.
[0090] Step 403: Based on the first target a-channel value, the first target b-channel value, and the first target L-channel value of each pixel in the source clothing color region in the LAB color space, perform regional color replacement on the source clothing color region to obtain the clothing region after color replacement.
[0091] Furthermore, the image processing system performs regional color replacement on the source clothing color region according to the first target a-channel value, the first target b-channel value, and the first target L-channel value of each pixel in the source clothing color region in the LAB color space to obtain the clothing region after color replacement, as specifically described in Steps 4031 to 4034.
[0092] In the embodiment of the present invention, the conversion is from the RGB color space to the LAB color space. Since the channels in the LAB color space are relatively independent, adjusting a certain channel will not strongly affect other channels as in the RGB color space. Therefore, when performing color replacement operations, the change in brightness can be more reasonably controlled, avoiding the problem of texture blurring caused by drastic changes in color channel values, thereby better retaining the special texture features of the clothing, ensuring the overall effect of the clothing image after color replacement, reducing the situation of texture and texture distortion, achieving better retention of the texture and texture of the clothing, and improving the overall effect of clothing color replacement.
[0093] In one embodiment, the descriptions of Steps 4031 to 4034 are as follows:
[0094] Step 4031: For each pixel in the source clothing color region in the LAB color space, adjust the first target a-channel value based on the offset between the first target a-channel value and the first a-channel value to obtain the second target a-channel value, and adjust the first target b-channel value based on the offset between the first target b-channel value and the first target b-channel value to obtain the second target b-channel value.
[0095] Optionally, for each pixel in the source clothing color region in the LAB color space, the image processing system calculates the offset between the first target a-channel value and the first a-channel value of each pixel, and the offset between the first target b-channel value and the first target b-channel value, that is, the channel value difference.
[0096] Furthermore, the image processing system adjusts the first target a-channel value according to the offset of the a-channel value of each pixel to obtain the second target a-channel value. The specific formula is as follows:
[0097] a target =a init +sin(Cs a )*cos(Cs a )。
[0098] Among them, a target represents the second target a-channel value, and a init represents the first target a-channel value, and Cs a represents the offset of the a-channel value.
[0099] Similarly, the image processing system adjusts the first target b-channel value according to the offset of the b-channel value of each pixel point to obtain the second target b-channel value. The specific formula is as follows:
[0100] b target = b init + sin(Cs b ) * cos(Cs b ).
[0101] Among them, b target represents the second target b-channel value, and b init represents the first target b-channel value, and Cs b represents the offset of the b-channel value.
[0102] Step 4032: Based on the first target L-channel value, fuse it with the fourth L-channel value of the neighboring pixel points in the source clothing color area in the LAB color space to obtain the second target L-channel value.
[0103] Furthermore, the image processing system takes the source clothing color area as the center and obtains the neighboring pixel points in the preset range of the source clothing color area in the LAB color space. Among them, the preset range is set according to the actual situation. For example, the preset range is an area centered on the source clothing color area with a radius of 3 pixel points.
[0104] Furthermore, the image processing system obtains the fourth L-channel value of each neighboring pixel point and calculates the neighboring L-channel value of the source clothing color area according to the fourth L-channel value of each neighboring pixel point. The specific formula is: L nei represents the neighboring L-channel value, n represents the number of neighboring pixel points in the neighborhood, and L neigbhori represents the fourth L-channel value of the i-th neighboring pixel point.
[0105] Furthermore, the image processing system calculates according to the neighboring L-channel value of the source clothing color area and the first target L-channel value of each pixel point to obtain the second target L-channel value of each pixel point. The specific formula is: L target = (L init + L nei ) / (n + 1).
[0106] Among them, L target represents the second target L-channel value, and Linit Represents the first target L-channel value.
[0107] Step 4033: Based on the second target L-channel value, convert the second target a-channel value, the second target b-channel value, and the second target L-channel value from the LAB color space to a preset elliptical color space, respectively obtaining the first adjusted a-channel value, the first adjusted b-channel value, and the first adjusted L-channel value.
[0108] Furthermore, the preset elliptical color space in the embodiments of the present invention is a pre-constructed color space, which is set with corresponding major axis parameters and minor axis parameters.
[0109] Therefore, the image processing system converts the second target a-channel value, the second target b-channel value, and the second target L-channel value from the LAB color space to the preset elliptical color space according to the second target L-channel value, respectively obtaining the first adjusted a-channel value, the first adjusted b-channel value, and the first adjusted L-channel value. The specific formula is:
[0110]
[0111] where a mid represents the first adjusted a-channel value, b mid represents the first adjusted b-channel value, and L mid represents the first adjusted L-channel value.
[0112] Step 4034: Based on the first adjusted a-channel value, the first adjusted b-channel value, and the first adjusted L-channel value of each pixel point in the source clothing color area in the preset elliptical color space, perform regional color replacement on the source clothing color area to obtain the color-replaced clothing area.
[0113] Furthermore, the image processing system performs regional color replacement on the source clothing color area according to the first adjusted a-channel value, the first adjusted b-channel value, and the first adjusted L-channel value of each pixel point in the source clothing color area in the preset elliptical color space to obtain the color-replaced clothing area, as specifically described in steps 40341 to 40343.
[0114] In the embodiments of the present invention, the channel values of pixel points are adjusted through the elliptical color space, so that the color distribution is restricted within a reasonable range, ensuring the accuracy and rationality of color adjustment, avoiding the situation of being too deviated from the target color, thus better retaining the special texture features of the clothing, ensuring the overall effect of the clothing image after color replacement, reducing the situation of texture and texture distortion, achieving better preservation of the texture and texture of the clothing, and improving the overall effect of clothing color replacement.
[0115] In one embodiment, the descriptions of steps 40341 to 40343 are as follows:
[0116] Step 40341: For each pixel point in the source clothing color region in the preset elliptical color space, based on the major axis parameter and minor axis parameter of the preset elliptical color space, adjust the first adjusted a-channel value, the first adjusted b-channel value, and the first adjusted L-channel value to obtain the second adjusted a-channel value, the second adjusted b-channel value, and the second adjusted L-channel value respectively.
[0117] Optionally, for each pixel point in the source clothing color region in the preset elliptical color space, the image processing system adjusts the first adjusted a-channel value according to the major axis parameter and minor axis parameter of the preset elliptical color space to obtain the second adjusted a-channel value. The specific formula is as follows:
[0118] where a geo represents the second adjusted a-channel value, A represents the major axis parameter, and B represents the minor axis parameter.
[0119] Similarly, the image processing system adjusts the first adjusted b-channel value according to the major axis parameter, minor axis parameter, first adjusted a-channel value, and first adjusted b-channel value to obtain the second adjusted b-channel value. The specific formula is as follows:
[0120] where b geo represents the second adjusted b-channel value.
[0121] Similarly, the image processing system adjusts the first adjusted L-channel value according to the major axis parameter and minor axis parameter to obtain the second adjusted L-channel value. The specific formula is as follows:
[0122] where L geo represents the second adjusted L-channel value.
[0123] Step 40342: Based on the first target channel values, perform equalization processing on the second adjusted a-channel value, the second adjusted b-channel value, and the second adjusted L-channel value respectively to obtain the equalized a-channel value, the equalized b-channel value, and the equalized L-channel value.
[0124] Further, the image processing system performs equalization processing on the second adjusted a-channel value according to the first target a-channel value to obtain the equalized a-channel value. The specific formula is:
[0125]
[0126] where aeq represents the a-channel value after equalization, max(a geo ) represents the maximum value in a geo , min(a geo ) represents the minimum value in a geo , max(a init ) represents the maximum value in the a-channel value of the first target, min(a init ) represents the minimum value in the a-channel value of the first target.
[0127] Similarly, the image processing system equalizes the second adjusted b-channel value according to the a-channel value of the first target b-channel, and obtains the equalized b-channel value. The specific formula is:
[0128]
[0129] where b eq represents the equalized b-channel value, max(b geo ) represents the maximum value in b ego , min(b ego ) represents the minimum value in b geo , max(b init ) represents the maximum value in the b-channel value of the first target, min(b init ) represents the minimum value in the b-channel value of the first target.
[0130] Similarly, the image processing system equalizes the second adjusted L-channel value according to the a-channel value of the first target L-channel, and obtains the equalized L-channel value. The specific formula is:
[0131]
[0132] where L eq represents the equalized L-channel value, max(L geo ) represents the maximum value in L geo , min(L geo ) represents the minimum value in L geo , max(L init ) represents the maximum value in the L-channel value of the first target, min(L init ) represents the minimum value in the L-channel value of the first target.
[0133] Step 40343: Based on the equalized a-channel value, equalized b-channel value, and equalized L-channel value of each pixel point in the source clothing color area in the preset elliptical color space, perform area color replacement on the source clothing color area to obtain the color-replaced clothing area.
[0134] Further, the image processing system performs regional color replacement on the source clothing color region based on the equalized a-channel value, equalized b-channel value, and equalized L-channel value of each pixel point in the preset elliptical color space, obtaining the clothing region after color replacement, as specifically described in steps 403431 to 403433.
[0135] In the embodiment of the present invention, the channel values of pixel points are adjusted through the elliptical color space, so that the color distribution is restricted within a reasonable range, ensuring the accuracy and rationality of color adjustment, avoiding the situation of being too deviated from the target color, thus better retaining the special texture features of the clothing, ensuring the overall effect of the clothing image after color replacement, reducing the situation of texture and texture distortion, achieving better retention of the texture and texture of the clothing, and improving the overall effect of clothing color replacement.
[0136] In one embodiment, the descriptions of steps 403431 to 403433 are as follows:
[0137] Step 403431: For each pixel point in the source clothing color region in the preset elliptical color space, color compensation is performed on the equalized a-channel value, equalized b-channel value, and equalized L-channel value, obtaining the color-compensated a-channel value, color-compensated b-channel value, and color-compensated L-channel value.
[0138] Optionally, for each pixel point in the source clothing color region in the preset elliptical color space, the image processing system performs color compensation on the equalized a-channel value, obtaining the color-compensated a-channel value. The specific formula is: a comp = a eq * log(1 + |a eq |) * C(a) comp . Wherein, a comp represents the color-compensated a-channel value, and C(a) comp represents the preset compensation amount of the a-channel value.
[0139] Similarly, the image processing system performs color compensation on the equalized b-channel value, obtaining the color-compensated b-channel value. The specific formula is: b comp = b eq * log(1 + |b eq |) * C(b) comp . Wherein, b comp represents the color-compensated b-channel value, and C(b) comp represents the preset compensation amount of the b-channel value.
[0140] Similarly, the image processing system performs color compensation on the equalized L-channel value, obtaining the color-compensated L-channel value. The specific formula is: Lcomp = L eq * log(1 + |L eq |) * C(L) comp . Where L comp represents the L-channel value after color compensation, and C(L) Comp represents the preset compensation amount for the L-channel value.
[0141] Step 403432: Based on the L-channel value after color compensation, convert the a-channel value after color compensation, the b-channel value after color compensation, and the L-channel value after color compensation from the preset elliptical color space back to the LAB color space to obtain the final a-channel value, the final b-channel value, and the final L-channel value respectively.
[0142] Furthermore, the image processing system converts the a-channel value after color compensation, the b-channel value after color compensation, and the L-channel value after color compensation from the preset elliptical color space back to the LAB color space based on the L-channel value after color compensation to obtain the final a-channel value, the final b-channel value, and the final L-channel value respectively. The specific formula is:
[0143]
[0144] Where a final represents the final a-channel value, b final represents the final b-channel value, and L final represents the final L-channel value.
[0145] Step 403433: Update the first a-channel value, the first b-channel value, and the first L-channel value with the final channel value, the final b-channel value, and the final L-channel value respectively, and perform regional color replacement on the source clothing color area to obtain the color-replaced clothing area.
[0146] Furthermore, the image processing system updates the first a-channel value, the first b-channel value, and the first L-channel value with the final channel value, the final b-channel value, and the final L-channel value respectively, and performs regional color replacement on the source clothing color area to obtain the color-replaced clothing area.
[0147] In the embodiments of the present invention, through the elliptical color space and the LAB color space, since the channels in the elliptical color space and the LAB color space are relatively independent, adjusting a certain channel will not strongly affect other channels as in the RGB color space. Therefore, when performing the color change operation, the change in brightness can be more reasonably controlled, avoiding the problem of texture blurring caused by drastic changes in the color channel values, thus better preserving the special texture features of the clothing. Finally, the source clothing background area and the color-changed clothing area are fused with the second conversion result from the LAB color space back to the RGB color space, ensuring the overall effect of the color-changed clothing image, reducing the situation of texture and texture distortion, achieving better preservation of the texture and texture of the clothing, and improving the overall effect of clothing color change.
[0148] Furthermore, the LAB-based clothing image texture-preserving color-changing system provided by the present invention will be described below. The LAB-based clothing image texture-preserving color-changing system described below can be mutually referred to with the LAB-based clothing image texture-preserving color-changing method described above.
[0149] Optionally, referring to Figure 2 , Figure 2 is a schematic structural diagram of the LAB-based clothing image texture-preserving color-changing system provided by the present invention. The LAB-based clothing image texture-preserving color-changing system includes.
[0150] A matte extraction module 210, configured to perform contour feature recognition on the source clothing image and the target clothing image, and respectively obtain the source clothing color area, the source clothing background area, and the target clothing color area;
[0151] A color palette extraction module 220, configured to perform color palette extraction on the source clothing color area and the target clothing color area, and respectively obtain the source clothing color palette and the target clothing color palette;
[0152] A color space conversion module 230, configured to convert the source clothing color area, the target clothing color area, the source clothing color palette, and the target clothing color palette from the RGB color space to the LAB color space;
[0153] A region color-changing module 240, configured to perform region color change on the source clothing color area based on the first conversion result in the LAB color space to obtain the color-changed clothing area;
[0154] A region fusion module 250, configured to fuse the source clothing background area and the second conversion result of the color-changed clothing area from the LAB color space back to the RGB color space to obtain the color-changed clothing image.
[0155] In the embodiments of the present invention, the source clothing color region, the target clothing color region, the source clothing color palette, and the target clothing color palette are converted from the RGB color space to the LAB color space. The channels in the LAB color space are relatively independent. Therefore, when performing area color replacement on the source clothing color region based on the first conversion result in the LAB color space, due to the relative independence of the channels, the change of color can be controlled more precisely, improving the accuracy of color transformation and achieving precise control of clothing color transformation. On the other hand, since the channels in the LAB color space are relatively independent, adjusting a certain channel will not strongly affect other channels as in the RGB color space. Therefore, when performing color replacement operations, the change of brightness can be controlled more reasonably, avoiding the problem of texture blur caused by drastic changes in the color channel values, thus better retaining the special texture features of the clothing. Finally, the second conversion result of converting the source clothing background region and the color-replaced clothing region back from the LAB color space to the RGB color space is fused to ensure the overall effect of the color-replaced clothing image, reduce the situation of texture and texture distortion, and achieve better retention of the texture and texture of the clothing. Therefore, the overall effect of clothing color replacement is improved, meeting the market demand for high-quality clothing color replacement.
[0156] Please refer to Figure 3 , Figure 3 which is the embodiment diagram of the electronic device provided by the embodiments of the present invention. As Figure 3 shown, the embodiments of the present invention provide an electronic device 300, including a memory 310, a processor 320, and a computer program 311 stored on the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, the following steps are implemented:
[0157] Perform contour feature recognition on the source clothing image and the target clothing image to respectively obtain the source clothing color region, the source clothing background region, and the target clothing color region;
[0158] Extract the color palettes of the source clothing color region and the target clothing color region to respectively obtain the source clothing color palette and the target clothing color palette;
[0159] Convert the source clothing color region, the target clothing color region, the source clothing color palette, and the target clothing color palette from the RGB color space to the LAB color space;
[0160] Perform area color replacement on the source clothing color region based on the first conversion result in the LAB color space to obtain the color-replaced clothing region;
[0161] Fuse the source clothing background region and the second conversion result of converting the color-replaced clothing region back from the LAB color space to the RGB color space to obtain the color-replaced clothing image.
[0162] Please refer toFigure 4 , Figure 4 This is an embodiment diagram of the computer-readable storage medium provided by the embodiments of the present invention. As Figure 4 shown, this embodiment provides a computer-readable storage medium 400, on which a computer program 311 is stored. When the computer program 311 is executed by a processor, the following steps are implemented:
[0163] Perform contour feature recognition on the source clothing image and the target clothing image to respectively obtain the source clothing color region, the source clothing background region, and the target clothing color region;
[0164] Extract palettes from the source clothing color region and the target clothing color region to respectively obtain the source clothing palette and the target clothing palette;
[0165] Convert the source clothing color region, the target clothing color region, the source clothing palette, and the target clothing palette from the RGB color space to the LAB color space;
[0166] Perform regional color replacement on the source clothing color region based on the first conversion result in the LAB color space to obtain the color-replaced clothing region;
[0167] Fuse the source clothing background region and the second conversion result of the color-replaced clothing region from the LAB color space back to the RGB color space to obtain the color-replaced clothing image.
[0168] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the LAB-based color replacement method for retaining the texture and texture of clothing images provided by the above-mentioned various methods. The method includes:
[0169] Perform contour feature recognition on the source clothing image and the target clothing image to respectively obtain the source clothing color region, the source clothing background region, and the target clothing color region;
[0170] Extract palettes from the source clothing color region and the target clothing color region to respectively obtain the source clothing palette and the target clothing palette;
[0171] Convert the source clothing color region, the target clothing color region, the source clothing palette, and the target clothing palette from the RGB color space to the LAB color space;
[0172] Perform regional color replacement on the source clothing color region based on the first conversion result in the LAB color space to obtain the color-replaced clothing region;
[0173] Fuse the second conversion result of converting the source clothing background area and the clothing area after color change back from the LAB color space to the RGB color space to obtain the clothing image after color change.
[0174] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative effort.
[0175] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course also by hardware. Based on this understanding, the essence of the above technical solutions or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0176] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of each embodiment of the present invention.
Claims
1. A LAB-based method for changing the color of a clothing image while preserving its texture, characterized in that, Including: Performing contour feature recognition on the source clothing image and the target clothing image to respectively obtain the source clothing color area, the source clothing background area, and the target clothing color area; Performing palette extraction on the source clothing color area and the target clothing color area to respectively obtain the source clothing palette and the target clothing palette; Converting the source clothing color area, the target clothing color area, the source clothing palette, and the target clothing palette from the RGB color space to the LAB color space; Performing area color replacement on the source clothing color area based on the first conversion result in the LAB color space to obtain the color-replaced clothing area; Fusing the source clothing background area and the second conversion result of the color-replaced clothing area from the LAB color space back to the RGB color space to obtain the color-replaced clothing image.
2. The LAB-based method for changing the color while retaining the texture of a clothing image according to claim 1, wherein, The performing area color replacement on the source clothing color area based on the first conversion result in the LAB color space to obtain the color-replaced clothing area includes: For each pixel point of the source clothing color area in the LAB color space, determining the first target a-channel value and the first target b-channel value based on the first a-channel value and the first b-channel value, and combining the second a-channel value and the second b-channel value of the target clothing palette in the LAB color space; Determining the L-channel difference based on the first L-channel value and the second L-channel value of the source clothing palette in the LAB color space, and determining the first target L-channel value based on the L-channel difference and the third L-channel value of the target clothing palette in the LAB color space; Performing area color replacement on the source clothing color area based on the first target a-channel value, the first target b-channel value, and the first target L-channel value of each pixel point of the source clothing color area in the LAB color space to obtain the color-replaced clothing area.
3. The LAB-based method for changing the color of a retained clothing image with texture according to claim 2, wherein The performing area color replacement on the source clothing color area based on the first target a-channel value, the first target b-channel value, and the first target L-channel value of each pixel point of the source clothing color area in the LAB color space to obtain the color-replaced clothing area includes: For each pixel point of the source clothing color area in the LAB color space, adjusting the first target a-channel value based on the first target a-channel value and the offset of the first a-channel value to obtain the second target a-channel value, and adjusting the first target b-channel value based on the first target b-channel value and the offset of the first target b-channel value to obtain the second target b-channel value; Fusing the first target L-channel value with the fourth L-channel value of the neighboring pixel points of the source clothing color area in the LAB color space to obtain the second target L-channel value; Converting the second target a-channel value, the second target b-channel value, and the second target L-channel value from the LAB color space to the preset elliptical color space based on the second target L-channel value to respectively obtain the first adjusted a-channel value, the first adjusted b-channel value, and the first adjusted L-channel value; Based on the first adjusted a-channel value, the first adjusted b-channel value, and the first adjusted L-channel value of each pixel point in the source clothing color region in the preset elliptical color space, perform regional color replacement on the source clothing color region to obtain the color-replaced clothing region.
4. The LAB-based method for changing the color of a retained clothing image with texture, according to claim 3, is characterized in that The performing regional color replacement on the source clothing color region based on the first adjusted a-channel value, the first adjusted b-channel value, and the first adjusted L-channel value of each pixel point in the source clothing color region in the preset elliptical color space to obtain the color-replaced clothing region includes: For each pixel point in the source clothing color region in the preset elliptical color space, based on the major axis parameter and the minor axis parameter of the preset elliptical color space, adjust the first adjusted a-channel value, the first adjusted b-channel value, and the first adjusted L-channel value to respectively obtain a second adjusted a-channel value, a second adjusted b-channel value, and a second adjusted L-channel value; Perform equalization processing on the second adjusted a-channel value, the second adjusted b-channel value, and the second adjusted L-channel value respectively based on the first target channel value to obtain an equalized a-channel value, an equalized b-channel value, and an equalized L-channel value; Based on the equalized a-channel value, the equalized b-channel value, and the equalized L-channel value of each pixel point in the source clothing color region in the preset elliptical color space, perform regional color replacement on the source clothing color region to obtain the color-replaced clothing region.
5. The method for changing the color of a reserved clothing image texture based on LAB according to claim 4, wherein The performing regional color replacement on the source clothing color region based on the equalized a-channel value, the equalized b-channel value, and the equalized L-channel value of each pixel point in the source clothing color region in the preset elliptical color space to obtain the color-replaced clothing region includes: For each pixel point in the source clothing color region in the preset elliptical color space, perform color compensation on the equalized a-channel value, the equalized b-channel value, and the equalized L-channel value to obtain a color-compensated a-channel value, a color-compensated b-channel value, and a color-compensated L-channel value; Based on the color-compensated L-channel value, convert the color-compensated a-channel value, the color-compensated b-channel value, and the color-compensated L-channel value from the preset elliptical color space back to the LAB color space to respectively obtain a final a-channel value, a final b-channel value, and a final L-channel value; Update the first a-channel value, the first b-channel value, and the first L-channel value with the final channel value, the final b-channel value, and the final L-channel value respectively, and perform regional color replacement on the source clothing color region to obtain the color-replaced clothing region.
6. The LAB-based method for changing the color of a retained clothing image while preserving the texture, according to any one of claims 1 to 5, is characterized in that The step process of extracting a color palette for the source clothing color region includes: For each pixel point in the source clothing color region in the RGB color space, perform hue adjustment based on each color component to obtain an optimized hue color value; Determine the initial clustering centers based on the number of color points in each sub-region within the neighborhood of each pixel, and assign each pixel to the corresponding color cluster according to the color difference between the hue-optimized color value and the center color value of each initial clustering center. Update the clustering centers of each color cluster based on each hue-optimized color value within the color cluster, and extract a palette based on the updated color clusters to obtain the source clothing palette.
7. The LAB-based method for changing the color of a reserved clothing image while preserving the texture as claimed in claim 6, wherein, Extract a palette based on the updated color clusters to obtain the source clothing palette, including: Perform clustering merging based on the center color value and the color value range within each updated color cluster to obtain the merged clusters and the clusters to be split; the clusters to be split are the remaining clusters in the updated color clusters except the merged clusters. For each cluster to be split, determine the color dispersion degree according to the center color value, the number of color points, and the hue-optimized color value of each color point, and split each cluster to be split based on the color dispersion degree to obtain the newly split clusters. Perform color screening based on the center color value and the number of color points of the merged clusters and the newly split clusters to obtain the source clothing palette.
8. A LAB-based clothing image texture-preserving color-changing system, characterized in that, Applied to the LAB-based method for changing the color of clothing while preserving the texture of the clothing image according to any one of claims 1 to 7; the LAB-based system for changing the color of clothing while preserving the texture of the clothing image includes: A matte extraction module for performing contour feature recognition on the source clothing image and the target clothing image to obtain the source clothing color region, the source clothing background region, and the target clothing color region respectively. A palette extraction module for extracting palettes from the source clothing color region and the target clothing color region to obtain the source clothing palette and the target clothing palette respectively. A color space conversion module for converting the source clothing color region, the target clothing color region, the source clothing palette, and the target clothing palette from the RGB color space to the LAB color space. A region color-changing module for performing region color-changing on the source clothing color region based on the first conversion result in the LAB color space to obtain the color-changed clothing region. A region fusion module for fusing the source clothing background region and the second conversion result of the color-changed clothing region from the LAB color space back to the RGB color space to obtain the color-changed clothing image.
9. An electronic device, comprising: A memory for storing computer software programs. A processor for reading and executing the computer software programs, wherein when the processor executes the computer software programs, it implements the LAB-based method for changing the color of clothing while preserving the texture of the clothing image according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing a computer software program, characterized in that, When the computer software programs are executed by the processor, they implement the LAB-based method for changing the color of clothing while preserving the texture of the clothing image according to any one of claims 1 to 7.