A method and apparatus for recoloring clothing images
By performing intrinsic image decomposition and theme color segmentation on clothing images, the problems of shadow influence and texture details loss in clothing images are solved, achieving a more natural coloring effect and a more efficient coloring process.
Patent Information
- Application Number
- CN202410719827.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-06-05
AI Technical Summary
During the process of heavy coloring of clothing images, clothing images are susceptible to shadows, resulting in unnatural coloring results, overflow of colors, and loss of texture details, resulting in poor shading effects and low efficiency.
By decomposing the initial clothing image intrinsic image, extracting reflections and shadow images, segmenting multiple theme color areas, and re-coloring these areas, finally synthesizing the re-colored reflections and shadow images to generate the target clothing image .
Reduces the effect of lighting on heavy coloring of clothing images, reduces the color distortion of non-themed colors on the clothing areas, and improves the effect and efficiency of heavy coloring.
Smart Images

Figure CN118298068B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and in particular, relates to a method and device for recoloring clothing images. Background Art
[0002] In the field of clothing design, clothing image recoloring is the process of changing the appearance and visual effects of clothes or fabrics by modifying the color information of color images while retaining the lighting effects and texture details in the image, which can bring convenience to clothing design.
[0003] In recent years, there are many image recoloring processing algorithms. A common method is the image recoloring algorithm based on reference images. This algorithm is generally given an original image and a reference image, and the color scheme of the reference image is transferred to the original image by matching the global or local properties of the image, so it is also called color migration. The principle of this algorithm is simple and clear, but when the color distribution of the two images is too different, it will produce unnatural coloring results due to excessive color stretching, which is usually manifested as color confusion or insufficient contrast. In addition, since the model acts on the global image, it is easy to lose local details in the source image during recoloring. Another common method is the image recoloring algorithm based on the palette. This algorithm usually extracts the theme color in the image through a clustering algorithm and changes the image color by editing the theme color of the image. However, it may not accurately capture the details and texture changes in the image, and is easily affected by lighting, resulting in unnatural coloring results. Therefore, in the process of image recoloring using the above methods, there are still problems such as unnatural coloring results, color overflow, loss of image texture details, blurred regional boundaries, and the need for global reconstruction.
[0004] At present, the problem that the coloring results in image recoloring are easily affected by image shadows, resulting in unnatural coloring results or color overflow, can be effectively solved by introducing intrinsic image decomposition. However, the intrinsic image decomposition method based on deep learning in the prior art is difficult to fully meet the original hypothesis of intrinsic decomposition, and the lack of sufficient constraints on the shadow map causes the re-synthesized original image to be too bright, too dark or overexposed. The problem of image texture detail loss, blurred or sticky regional boundaries in image recoloring can be solved to a certain extent by introducing image segmentation. However, the method of using binary label functions to represent image regions in the prior art cannot well describe the changes in the depth of image color due to the discontinuity of the binary label function. At the same time, when using global reconstruction, it will also affect other areas in the image. Summary of the invention
[0005] The embodiments of the present application provide a method and device for recoloring clothing images, which can solve the problems of poor coloring effect and low coloring efficiency in the prior art during the clothing image recoloring process, because clothing images are easily affected by shadows and clothing texture details are easily lost.
[0006] In a first aspect, an embodiment of the present application provides a method for recoloring a clothing image, the method comprising:
[0007] Acquire an initial clothing image; wherein the initial clothing image at least includes: a clothing area;
[0008] Performing intrinsic image decomposition on the initial clothing image to obtain a corresponding first reflection image and a first shadow image;
[0009] Extract all colors in the first reflection image to obtain multiple theme colors in the clothing area;
[0010] According to the plurality of theme colors, the clothing area is segmented to obtain a plurality of segmented areas; wherein each of the segmented areas corresponds to a theme color in the clothing area;
[0011] recoloring the theme color of at least one of the plurality of segmented areas to obtain a second reflection image;
[0012] The second reflection image is synthesized with the first shadow image to obtain a target clothing image.
[0013] In a possible implementation manner of the first aspect, performing intrinsic image decomposition on the initial clothing image to obtain a corresponding first reflection image and a first shadow image includes:
[0014] Decomposing the initial clothing image by a first preset intrinsic image decomposition model to obtain a corresponding initial reflection image and an initial shadow image;
[0015] The initial reflection image and the initial shadow image are optimized through a second preset intrinsic image decomposition model to obtain the corresponding first reflection image and the first shadow image; wherein the second preset intrinsic image decomposition model is represented as an improved model of the first preset intrinsic image decomposition model.
[0016] In a possible implementation manner of the first aspect, optimizing the initial reflection image and the initial shadow image by using a second preset intrinsic image decomposition model to obtain the corresponding first reflection image and the first shadow image includes:
[0017] Constructing an iterative model corresponding to the second preset intrinsic image decomposition model;
[0018] The initial reflection map and the initial shadow map are iteratively optimized through the iterative model until a preset iteration termination condition is met and the iteration is stopped to obtain the corresponding first reflection map and the first shadow map.
[0019] In a possible implementation manner of the first aspect, the second preset intrinsic image decomposition model is:
[0020] ;
[0021] ;
[0022] In the formula, is a single-channel image of the first reflection image that has been normalized; is a three-channel image of the first reflection image after normalization; is a single-channel image of the initial clothing image that has been normalized; represents the initial clothing image after normalization; ; ; ; ; is the constraint domain for performing intrinsic image decomposition on the initial clothing image; x is a pixel point in the initial clothing image; is the clothing area in the initial clothing image; is a single-channel image of the initial shadow map; is an image obtained by modulo the three-channel image of the initial reflection image; is a three-channel image of the initial reflection image; is a single-channel image of the first reflection image; is a single-channel image of the initial clothing image; , indicating that the initial clothing image can be obtained through a single-channel image of the first reflection image and the first shadow map Refactoring is a three-channel image of the initial clothing image; is the preset data item parameter; is the preset regularization parameter; A preset plug-and-play denoiser that operates on a single-channel image of the normalised first reflectance map.
[0023] In a possible implementation manner of the first aspect, the iteration model is:
[0024]
[0025] Wherein, the preset iteration termination condition is: ; ; is the Lagrange multiplier; k is the number of iterations; is the Lagrange multiplier when the number of iterations is the kth; is the Lagrange multiplier when the number of iterations is k+1; is the iteration step length; It is a preset plug-and-play denoiser; for from arrive The mapping of RE is and The error value between is a single-channel image of the first reflection image that has been normalized; is a single-channel image of the first reflection image that has been normalized when the number of iterations is the kth time; is a single-channel image of the first reflection image that has been normalized when the number of iterations is k+1; is a three-channel image of the first reflection image after normalization; is a single-channel image of the initial clothing image that has been normalized; represents the initial clothing image after normalization; ; ; ; ; is the preset data item parameter; is the preset regularization parameter; is a single-channel image of the first reflection image; , indicating that the initial clothing image can be obtained through a single-channel image of the first reflection image and the first shadow map Refactoring is an image obtained by modulo the three-channel image of the initial reflection image; is a three-channel image of the initial clothing image;
[0026] And, the three-channel image of the first reflection map is , the first shadow map is ;in, It is a single-channel image of the first reflection map that is calculated by the iterative model and is normalized.
[0027] In a possible implementation manner of the first aspect, segmenting the clothing region according to the multiple theme colors to obtain multiple segmented regions includes:
[0028] Constructing an improved image segmentation model according to the plurality of subject colors and fuzzy membership functions;
[0029] By using the improved image segmentation model, color region segmentation is performed on the clothing region in the first reflection image to obtain a plurality of segmented regions;
[0030] Wherein, the improved image segmentation model is:
[0031] ;
[0032] ;
[0033] In the formula, is the fuzzy membership function, used to represent the plurality of segmented regions; , Used to measure the fuzziness degree of the fuzzy membership function; is the pixel in the neighborhood of pixel x, that is , Pixel The radius is Pixels in the neighborhood of ; is the constraint domain of the improved image segmentation model; is the theme color of the i-th segmented area in the first reflection image; is a single-channel image of the first reflection map after normalization; ; is an image obtained by modulo the three-channel image of the initial reflection image; is a single-channel image of the first reflection image; is the initial clothing image after normalization; is the i-th sub-clothing region (i=1,2,…N) in the initial clothing image, and the clothing region is composed of N sub-clothing regions , , …, constitute; is a weighting function; N is an integer; and,
[0034] ;
[0035] In the formula, a is the normalization parameter, making ; is the standard deviation of the Gaussian function.
[0036] In a possible implementation manner of the first aspect, the fuzzy membership function for:
[0037] ;
[0038] in, ; In order to introduce variables, it is convenient to To express.
[0039] In a possible implementation manner of the first aspect, recoloring the theme color of at least one segmented area of the plurality of segmented areas to obtain a second reflection map includes:
[0040] Determine the segmented area to be recolored in the first reflection image;
[0041] According to the theme color of the segmented area, the changed new theme color and a preset color replacement formula, the color of the segmented area to be recolored is replaced to obtain the second reflection image;
[0042] Wherein, the preset color replacement formula is:
[0043] ;
[0044] In the formula, is the second reflection image; is the theme color of the segmented area, ; The new theme color after the change is as follows. ;in, .
[0045] In a possible implementation manner of the first aspect, synthesizing the second reflection image with the first shadow image to obtain a target clothing image includes:
[0046] According to the second reflection image, the first shadow image and a preset image synthesis formula, the second reflection image and the first shadow image are synthesized to obtain the target clothing image; wherein the preset image synthesis formula is:
[0047] ;
[0048] In the formula, is the target clothing image, is the second reflection map, is the first shadow map.
[0049] In a second aspect, an embodiment of the present application provides a clothing image recoloring device, the device comprising:
[0050] The acquisition module is used to acquire an initial clothing image; wherein the initial clothing image at least includes: a clothing area;
[0051] A decomposition module, used for performing intrinsic image decomposition on the initial clothing image to obtain a corresponding first reflection image and a first shadow image;
[0052] An extraction module, used for extracting all colors in the first reflection image to obtain a plurality of theme colors in the clothing area;
[0053] A segmentation module, used for segmenting the clothing area according to the plurality of theme colors to obtain a plurality of segmented areas; wherein each of the segmented areas corresponds to a theme color in the clothing area;
[0054] a recoloring module, used for recoloring the theme color of at least one segmented area of the plurality of segmented areas to obtain a second reflection image;
[0055] The reconstruction module is used to synthesize the second reflection image and the first shadow image to obtain a target clothing image.
[0056] In a third aspect, an embodiment of the present application provides a clothing image recoloring device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-described clothing image recoloring methods when executing the computer program.
[0057] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the clothing image recoloring method described in any one of the above items is implemented.
[0058] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute any of the above-described clothing image recoloring methods.
[0059] Compared with the prior art, the embodiments of the present application have the following beneficial effects: by performing intrinsic image decomposition on the initial clothing image including the clothing area, a corresponding first reflection map and a first shadow map are obtained; all colors in the first reflection map are extracted to obtain multiple theme colors in the clothing area; then, according to the multiple theme colors, the clothing area is segmented to obtain multiple segmented areas; wherein each segmented area corresponds to a theme color in the clothing area; the theme color of at least one segmented area of the multiple segmented areas is recolored to obtain a second reflection map; the second reflection map is synthesized with the first shadow map to obtain a target clothing image. The present application can reduce the influence of illumination on the recoloring of clothing images and reduce the color distortion of clothing areas corresponding to non-theme colors through the above method, thereby improving the effect and efficiency of recoloring of clothing images. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0061] Figure 1 It is a flowchart of a clothing image recoloring method provided by an embodiment of the present application;
[0062] Figure 2 is a flowchart of a clothing image recoloring method provided by another embodiment of the present application;
[0063] Figure 3 is a schematic diagram of the recoloring effect of the clothing image recoloring method provided by an embodiment of the present application in a model image;
[0064] Figure 4 is a schematic diagram comparing recoloring effects of different recoloring methods provided in an embodiment of the present application;
[0065] Figure 5 is a schematic diagram comparing the recoloring running time of different recoloring methods provided in an embodiment of the present application;
[0066] Figure 6 is a structural schematic diagram of a clothing image recoloring device provided by an embodiment of the present application;
[0067] Figure 7 It is a structural schematic diagram of a clothing image recoloring device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0068] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0069] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0070] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0071] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0072] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0073] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0074] See also Figure 1 , Figure 1 : is a flowchart of a clothing image recoloring method provided by an embodiment of the present application. The method comprises:
[0075] S11, obtaining an initial clothing image; wherein the initial clothing image at least includes: a clothing area;
[0076] S12, performing intrinsic image decomposition on the initial clothing image to obtain a corresponding first reflection image and a first shadow image;
[0077] S13, extracting all colors in the first reflection image to obtain multiple theme colors in the clothing area;
[0078] S14, segmenting the clothing area according to the multiple theme colors to obtain multiple segmented areas; wherein each segmented area corresponds to a theme color in the clothing area;
[0079] S15, recoloring the theme color of at least one of the multiple segmented areas to obtain a second reflection image;
[0080] S16: synthesize the second reflection image and the first shadow image to obtain a target clothing image.
[0081] It should be noted that, in this embodiment, the execution subject may be a terminal device such as a server, and no specific limitation is made to this.
[0082] In step S11, the initial clothing image is an image containing a clothing area that needs to be recolored, such as a photo of a person wearing a certain clothing.
[0083] In step S12, intrinsic image decomposition is an image processing technology in the field of computer vision, which is used to decompose the input original image into two intrinsic image components, namely, a reflection image and a shadow image. The reflection image represents the essential properties of the surface of an object, such as the color and texture of the object, and describes the degree of absorption, scattering and reflection of the incident light by the object; the reflection image is generally considered to be independent of lighting, and the reflection image remains unchanged for different lighting conditions. The shadow image represents the part of the environment affected by the lighting, which affects the visual effects such as the brightness and shadow of the object in the observed image. Generally speaking, intrinsic image decomposition is a multiplicative decomposition, that is, the original image can be decomposed into the product of the reflection image and the shadow image. In this embodiment, through the intrinsic image decomposition technology, the initial clothing image can be decomposed into a first reflection image that only shows the color and texture of the clothing, and a first shadow image that only shows the shadow. That is, the first reflection image and the first shadow image are reconstructed to obtain the initial clothing image.
[0084] In step S13, all colors in the first reflection image are first extracted, and then the colors of the clothing area are processed to obtain multiple theme colors in the clothing area. The theme colors refer to multiple colors that dominate in the first reflection image; these colors can distinguish different areas or patterns in the clothing area. For example, if the initial clothing image is a blue shirt with a white letter pattern, then in the first reflection image decomposed from the initial clothing image, blue and white are its theme colors.
[0085] In step S14, the clothing area in the first reflection image can be segmented into a plurality of different parts or regions, i.e., segmented regions, according to the plurality of theme colors in the clothing area. Each segmented region corresponds to a theme color. For example, if the initial clothing image is a blue shirt with a white letter pattern, then, according to the theme colors in the first reflection image being blue and white, the first reflection image can be segmented into a white letter pattern region and a blue background region.
[0086] In step S15, recoloring refers to changing the color of a segmented area in the first reflection image to another color, such as changing the blue background of the shirt to red. The new reflection image obtained by changing the color of a certain area in the first reflection image to another color is the second reflection image.
[0087] In step S16, the second reflection image is merged with the first shadow image to obtain a target clothing image. The target clothing image is the final image obtained after the initial clothing image is processed by the above series of processes, that is, the image obtained after recoloring part of the clothing area in the initial clothing image. For example, if the initial clothing image is a blue shirt with white letter patterns, after recoloring, the blue background of the shirt is changed to red, then the image containing a red shirt with white letter patterns is the target clothing image.
[0088] It can be understood that by performing intrinsic image decomposition on the initial clothing image including the clothing area, the corresponding first reflection map and first shadow map are obtained; all colors in the first reflection map are extracted to obtain multiple theme colors in the clothing area; then, according to the multiple theme colors, the clothing area is segmented to obtain multiple segmented areas; wherein each segmented area corresponds to a theme color in the clothing area; the theme color of at least one segmented area of the multiple segmented areas is recolored to obtain a second reflection map; the second reflection map is synthesized with the first shadow map to obtain a target clothing image. The present application obtains the first reflection map and the first shadow map by intrinsic image decomposition, thereby reducing the influence of illumination on the recoloring of the clothing image; the clothing area in the first reflection map is segmented by the extracted theme color, and the segmented area is recolored to reduce the color distortion of the image area corresponding to the non-target theme color, thereby improving the effect and efficiency of the recoloring of the clothing image.
[0089] In a possible implementation, performing intrinsic image decomposition on the initial clothing image to obtain a corresponding first reflection image and a first shadow image includes:
[0090] Decomposing the initial clothing image by a first preset intrinsic image decomposition model to obtain a corresponding initial reflection image and an initial shadow image;
[0091] The initial reflection image and the initial shadow image are optimized through the second preset intrinsic image decomposition model to obtain the corresponding first reflection image and the first shadow image; wherein the second preset intrinsic image decomposition model is represented as an improved model of the first preset intrinsic image decomposition model.
[0092] It should be noted that, generally speaking, intrinsic image decomposition is a multiplicative decomposition, that is, the original image can be decomposed into the product of a reflection image and a shadow image. In this embodiment, the first preset intrinsic image decomposition model is the existing VOS-Net-based intrinsic image decomposition; the model limits the area range of the new variable inverse shadow defined by it , then the shadow map This value range of the shadow map will bring inconvenience to practical use. In the image recoloring task, it is easy to cause excessive white exposure in the recolored image. It is usually necessary to scale it to a certain scale. region, which results in a certain color difference between the final synthesized image and the original image, which is usually manifested as the re-synthesized image being darker than the original image; at the same time, in order to obtain better segmentation results for recoloring in the subsequent stage, the reflection image corresponding to the initial clothing image in this embodiment is a piecewise constant image, which is difficult to meet with the intrinsic image decomposition based on VOS-Net. Therefore, a second preset intrinsic image decomposition model is required for decomposition, that is, the second preset intrinsic image decomposition model is optimized on the basis of the first preset intrinsic image decomposition model.
[0093] Specifically, the initial clothing image is decomposed by the first preset intrinsic image decomposition model to obtain an initial reflection map and an initial shadow map; on this basis, the initial reflection map and the initial shadow map are further optimized by the second preset intrinsic image decomposition model to obtain the corresponding first reflection map and first shadow map. At this time, when the decomposed first reflection map and the first shadow map are resynthesized, the resynthesized image is basically consistent with the original image, and a good restoration can be achieved.
[0094] In a possible implementation, the initial reflection image and the initial shadow image are optimized by using a second preset intrinsic image decomposition model to obtain a corresponding first reflection image and a first shadow image, including:
[0095] Constructing an iterative model corresponding to a second preset intrinsic image decomposition model;
[0096] The initial reflection map and the initial shadow map are iteratively optimized through the iterative model until the preset iteration termination condition is met and the iteration is stopped to obtain the corresponding first reflection map and first shadow map.
[0097] It should be noted that when the initial reflection map and the initial shadow map are optimized by the second preset intrinsic image decomposition model, the second preset intrinsic image decomposition model needs to be solved. Therefore, an iterative model for solving the second preset intrinsic image decomposition model is constructed, and the initial reflection map and the initial shadow map are gradually adjusted by the iterative model until the preset iteration termination condition is met to stop the iteration, and the first reflection map and the first shadow map are obtained. Among them, the first reflection map is the reflection map obtained after the initial reflection map is optimized; the first shadow map is the shadow map obtained after the initial shadow map is optimized. The preset iteration termination condition is a set of standards or conditions used to determine when to stop the iteration during the iteration process. These standards or conditions are set based on some metrics in the iteration process to ensure that the iteration model can stop when the optimal solution is reached, while avoiding unnecessary waste of computing resources. The preset iteration termination condition can be reaching the maximum number of iterations, the change in the objective function value is less than a threshold, the iteration time limit, or meeting a specific performance indicator.
[0098] In a possible implementation, the second preset intrinsic image decomposition model is:
[0099] ;
[0100] ;
[0101] In the formula, is a single-channel image of the first reflection map after normalization; is a three-channel image of the first reflection map after normalization; is a single-channel image of the normalized initial clothing image; represents the initial clothing image after normalization; ; ; ; ; is the constraint domain for the intrinsic image decomposition of the initial clothing image; x is the pixel point in the initial clothing image; is the clothing area in the initial clothing image; is a single-channel image of the initial shadow map; is the image obtained by modulo the three-channel image of the initial reflection image; is the three-channel image of the initial reflection map; is a single-channel image of the first reflection map; is a single-channel image of the initial clothing image; , indicating that the initial clothing image can be obtained through a single-channel image of the first reflection map and the first shadow map Refactoring is the three-channel image of the initial clothing image; is the preset data item parameter; is the preset regularization parameter; A pre-built plug-and-play denoiser that operates on a single-channel image with a normalized first reflectance map.
[0102] It should be noted that the specific process of optimizing the first preset intrinsic image decomposition model to obtain the second preset intrinsic image decomposition model is as follows:
[0103] Define the initial garment image , first reflection map In RGB space The three-channel image of the region, that is , define the first shadow map (x) is in RGB space A single-channel image of the region, i.e. , then for each pixel ,have . The initial clothing image The reflection map and shadow map output by the first preset intrinsic image decomposition model are defined as initial reflection maps and the initial shadow map .
[0104] In order to optimize the decomposition result of the first preset intrinsic image decomposition model while better inheriting the excellent decomposition result obtained by the first preset intrinsic image decomposition model, the following optimization goals are set:
[0105] (1-1)
[0106] In formula (1-1), is the three-channel image of the initial reflection map, representing the RGB space Three-channel image of the region; is a single-channel image of the initial shadow map, representing the RGB space A single-channel image of the region.
[0107] make , ,in, Representing the two norm, we can get the first constraint,
[0108] (1-2)
[0109] In formula (1-2), is a single-channel image of the first reflection image, which is obtained by converting the three-channel image of the first reflection image The image obtained by modulus; is a single-channel image of the initial clothing image, , indicating that the initial clothing image can be obtained through the single-channel image of the first reflection image and the first shadow map Refactoring.
[0110] Reintroducing variables , we can get the second constraint,
[0111] (1-3)
[0112] In formula (1-3), Represents the initial clothing image after normalization.
[0113] Since the plug-and-play denoiser tends to compress the output to the interval [0,1], it is necessary to normalize the optimization variables. ; ; , the second preset intrinsic image decomposition model can be obtained as:
[0114] (1-4)
[0115] (1-5)
[0116] In formula (1-4) and formula (1-5), is a single-channel image of the first reflection map after normalization. is the three-channel image of the first reflection map after normalization. is a single-channel image of the normalized initial clothing image; is the constraint domain for the intrinsic image decomposition of the initial clothing image; x is the pixel point in the initial clothing image; is the sub-clothing region in the initial clothing image; is the preset data item parameter; is the preset regularization parameter; A pre-built plug-and-play denoiser that operates on a single-channel image with a normalized first reflectance map.
[0117] It should be noted that the first two terms of the second preset intrinsic image decomposition model shown in formula (1-4) are data terms, which are mainly used to fit the optimization target in formula (1-1), that is, to optimize the initial reflection map and the initial shadow map; the last term is a regularization term, which is mainly used to smooth the image to a certain extent through the preset plug-and-play denoiser. , so that the first reflection map It is closer to a sliced constant image.
[0118] It should be noted that the plug-and-play denoiser can be implicitly used as a model-based approach to solve prior images of many inverse problems, usually trained through deep convolutional neural networks to provide effective prior information in the image restoration process. The preset plug-and-play denoiser is a pre-set plug-and-play denoiser model. In this embodiment, the preset plug-and-play denoiser can be a DRU-Net plug-and-play denoiser. By introducing a noise level map, the degree of noise removal can be freely controlled to achieve non-blind denoising. The preset plug-and-play denoiser can maintain the details of the image well while smoothing the image, and there is no need to design an additional complex iterative algorithm to solve the regularization term.
[0119] In this embodiment, the sub-garment regions are different partial regions constituting the entire garment region, such as a collar, sleeves, and other sub-garment regions of a shirt.
[0120] It can be understood that by establishing a second preset intrinsic image decomposition model based on the decomposition result of the first preset intrinsic image decomposition model, the problem that the re-synthesized original image will be too bright, too dark or overexposed due to the lack of sufficient constraints on the shadow map can be solved, and the brightness of the original image can be maintained while ensuring the image recoloring result; at the same time, by introducing a plug-and-play denoiser, the computational efficiency can be improved and the reflection image can be better smoothed, providing a better segmentation object for the subsequent stages.
[0121] In one possible implementation, the iteration model is:
[0122]
[0123] The preset iteration termination condition is: ; ; is the Lagrange multiplier; k is the number of iterations; is the Lagrange multiplier when the number of iterations is k; is the Lagrange multiplier when the number of iterations is k+1; is the iteration step length; It is a preset plug-and-play denoiser; for from arrive The mapping of RE is and The error value between is a single-channel image of the first reflection map after normalization; is a single-channel image of the first reflection image after normalization when the number of iterations is k; is a single-channel image of the first reflection image after normalization when the number of iterations is k+1; is the three-channel image of the first reflection map after normalization. is a single-channel image of the normalized initial clothing image; represents the initial clothing image after normalization; ; ; ; ; is the preset data item parameter; is the preset regularization parameter; is a single-channel image of the first reflection map; , indicating that the initial clothing image can be obtained through the single-channel image of the first reflection image and the first shadow map Refactoring is the image obtained by modulo the three-channel image of the initial reflection image; is the three-channel image of the initial clothing image;
[0124] And, the three-channel image of the first reflection map is , the first shadow map is ;in, is a single-channel image of the normalized first reflection map calculated by the iterative model.
[0125] It should be noted that, in this embodiment, the second preset intrinsic image decomposition model is solved by constructing an iterative model, and the solving process is as follows:
[0126] Given an initial clothing image and the initial clothing image Decomposition result of decomposition by the first preset intrinsic image decomposition model ,get ,initialization , given the relevant parameters , set the number of iterations ;
[0127] Repeat the following:
[0128] (1-6)
[0129] Until the preset iteration termination condition is met, that is, ; ; Stop iteration.
[0130] At this time, we get the numerical solution , is a single-channel image of the normalized first reflection image calculated by the iterative model; thus, a three-channel image of the first reflection image is obtained , the first shadow map , that is, after the initial clothing image is decomposed through the intrinsic image, the first reflection image and the first shadow image can be obtained.
[0131] It should be noted that in the above iterative process, is the Lagrange multiplier; k is the number of iterations; is the Lagrange multiplier when the number of iterations is k; is the Lagrange multiplier when the number of iterations is k+1; is the iteration step length; It is a preset plug-and-play denoiser; for from arrive The mapping of RE is and The error value between is a single-channel image of the first reflection map after normalization; is a single-channel image of the first reflection image after normalization when the number of iterations is k; is a single-channel image of the first reflection image after normalization when the number of iterations is k+1; is the three-channel image of the first reflection map after normalization. is a single-channel image of the normalized initial clothing image; represents the initial clothing image after normalization; ; ; ; ; is the preset data item parameter; is the preset regularization parameter; is a single-channel image of the first reflection map; , indicating that the initial clothing image can be obtained through the single-channel image of the first reflection image and the first shadow map Refactoring is the image obtained by modulo the three-channel image of the initial reflection image; is the three-channel image of the initial clothing image.
[0132] In a possible implementation, the clothing region is segmented according to multiple theme colors to obtain multiple segmented regions, including:
[0133] Construct an improved image segmentation model based on multiple subject colors and fuzzy membership functions;
[0134] By using an improved image segmentation model, the clothing area in the first reflection image is segmented into color areas to obtain multiple segmented areas;
[0135] Among them, the improved image segmentation model is:
[0136] ;
[0137] ;
[0138] In the formula, is a fuzzy membership function, used to represent multiple segmented regions; , Used to measure the fuzziness of the fuzzy membership function; is the pixel in the neighborhood of pixel x, that is , Pixel The radius is Pixels in the neighborhood of ; The constraint domain for the improved image segmentation model; is the theme color of the i-th segmented area in the first reflection image; is a single-channel image of the first reflection map after normalization; ; is the image obtained by modulo the three-channel image of the initial reflection image; is a single-channel image of the first reflection map; is the initial clothing image after normalization; is the i-th sub-clothing region in the initial clothing image (i=1,2,…N), and the clothing region consists of N sub-clothing regions , , …, constitute; is a weighting function; N is an integer; and,
[0139] ;
[0140] In the formula, a is the normalization parameter, making ; is the standard deviation of the Gaussian function.
[0141] It should be noted that, in this embodiment, the color of the clothing area in the first reflection image is extracted by an improved K-means algorithm (K-means algorithm) to obtain multiple theme colors in the clothing area. The improved K-means algorithm can extract the theme color of the image simply and efficiently, and has been widely used in the subsequent image recoloring field. The K-means algorithm has good clustering ability, but because the K-means clustering needs to continuously adjust the cluster center, when the amount of data is large, the computational cost of the K-means algorithm is very large. In order to accelerate the clustering process, the existing technology samples the color space and clusters at these sampling points to reduce the computational cost.
[0142] Specifically, the algorithm divides the RGB color space equally into grids, count the number of pixels in each grid, calculate the average color of the pixels in each grid, and The average color of the grid As clustering points. And because the K-means algorithm is sensitive to initial values, in order to select initial colors with large differences, the algorithm assigns weights to each sampled color. , the average color of the grid containing the most pixels is selected as the initial cluster center for the first time, and the weight of each sampled color is updated in subsequent iterations, and the weight is selected in each iteration The largest color is added to the cluster center set, and the weight update is as shown in formula (1-7):
[0143] (1-7)
[0144] in, In LAB space and The distance is an adjustable parameter. When the value is larger, the color difference is more obvious, the weight is larger, and the color is more likely to be selected as the cluster center. Repeat the above process until the theme color with large color difference is extracted. Among them, LAB space is color-opposition space.
[0145] It should be noted that after extracting multiple theme colors, in this embodiment, an improved image segmentation model is constructed based on the multiple theme colors and the fuzzy membership function; the clothing area in the first reflection image is segmented by color region to obtain multiple segmented regions. The fuzzy membership function is used to describe the degree of membership of an element in a fuzzy set to a set. In this embodiment, is a piecewise constant function, that is Area Can be divided into Sub-areas , where for all and ,have , , and for For each pixel, there is , we can get It is also a piecewise constant function. Therefore, we can use To represent the extracted data using K-means algorithm Multiple theme colors in , namely:
[0146] (1-8)
[0147] Further, for Pixels in the neighborhood ,have
[0148] (1-9)
[0149] in, Pixel The radius is Pixels in the neighborhood of .
[0150] By introducing the fuzzy membership function , To characterize the degree to which each sub-clothing area belongs to a certain theme color, that is, to represent multiple segmented areas. Thus, the improved image segmentation model can be obtained as follows:
[0151] (1-10)
[0152] (1-11)
[0153] In the formula, , Used to measure the fuzziness of the fuzzy membership function; The constraint domain for the improved image segmentation model; is the theme color of the i-th segmented area in the first reflection image; is a single-channel image of the first reflection map after normalization; ; is the image obtained by modulo the three-channel image of the initial reflection image; is a single-channel image of the first reflection map; is the initial clothing image after normalization; is the i-th sub-clothing region (i=1,2,…N) in the initial clothing image, and the clothing region is composed of N sub-clothing regions , , …, constitute; is a weighting function; N is an integer.
[0154] Among them, as the distance from pixel y to the neighborhood center x increases, it decreases. It can be defined as:
[0155] (1-12)
[0156] In formula (1-12), a is a normalization parameter, making ; is the standard deviation of the Gaussian function.
[0157] It can be understood that by introducing the fuzzy membership function into the improved image segmentation model, a smoother and more natural image recoloring result can be obtained, thereby improving the effect of recoloring the clothing image.
[0158] In one possible implementation, the fuzzy membership function for:
[0159] ;
[0160] in, ; To introduce variables, it is convenient to fuzzy membership function To express.
[0161] It should be noted that according to the improved image segmentation model and , we can get the analytical solution of the improved image segmentation model, namely the fuzzy membership function for:
[0162] (1-13)
[0163] in, , To introduce variables, it is convenient to fuzzy membership function Practice expression.
[0164] In a possible implementation, recoloring the theme color of at least one segmented area among the multiple segmented areas to obtain a second reflection map includes:
[0165] Determine the segmented area to be recolored in the first reflection image;
[0166] According to the theme color of the segmented area, the changed new theme color and the preset color replacement formula, the color of the segmented area to be recolored is replaced to obtain a second reflection image;
[0167] Among them, the preset color replacement formula is:
[0168] ;
[0169] In the formula, is the second reflection image; The theme color of the segmented area. ; To change the new theme color, ;in, .
[0170] It should be noted that when the fuzzy membership function is obtained After that, the first reflection map can be Since it is usually necessary to change only one or two theme colors when recoloring clothing images, in order to reduce the impact on other areas that do not need to change colors, in this embodiment, the color of the segmented area can be set to ; The new theme color after changing is , then
[0171] (1-14)
[0172] In the formula, This is the second reflection image.
[0173] It is understandable that since clothing image recoloring usually does not require changing all theme colors, the impact on non-theme colors can be reduced by recoloring the theme color of at least one of multiple segmented areas, i.e., local recoloring, thereby improving the effect of recoloring the clothing image.
[0174] In a possible implementation, synthesizing the second reflection image with the first shadow image to obtain a target clothing image includes:
[0175] According to the second reflection image, the first shadow image and the preset image synthesis formula, the second reflection image and the first shadow image are synthesized to obtain the target clothing image; wherein the preset image synthesis formula is:
[0176] ;
[0177] In the formula, is the target clothing image, is the second reflection map, This is the first shadow map.
[0178] Generally speaking, intrinsic image decomposition is a multiplicative decomposition, that is, the original image can be decomposed into the product of a reflection image and a shadow image. In other words, a clothing image can be decomposed into a reflection image and a shadow image; then, the corresponding reflection image and shadow image can be resynthesized to obtain a clothing image. In this embodiment, the second reflection image obtained after recoloring and the first shadow image are resynthesized to obtain a clothing image after recoloring, that is, a target clothing image. In other words, the second reflection image can be resynthesized to obtain a clothing image after recoloring, that is, a target clothing image. and the first shadow map Multiply to get the target clothing image .
[0179] Specifically, see Figure 2 , Figure 2 It is a flowchart of a clothing image recoloring method provided by another embodiment of the present application. Figure 2 In the method, the initial clothing image is decomposed by the first preset intrinsic image decomposition model (VOS-Net) to obtain the initial reflection map and the initial shadow map; the initial reflection map and the initial shadow map are optimized by the second preset intrinsic image decomposition model to obtain the first reflection map and the first shadow map; then, multiple theme colors are extracted based on the improved K-means algorithm; the first reflection map is segmented according to the improved image segmentation model to obtain multiple segmented areas; finally, the theme color of a selected segmented area is recolored according to the changed new theme color to obtain the second reflection map, and the second reflection map is synthesized with the first shadow map to obtain the target clothing image. It can be seen that Figure 2 In the first reflection map, the clothing area includes 5 theme colors. , from left to right are RGB(0,0,0), RGB(120,67,21), RGB(35,90,176), RGB(240,155,89), RGB(192,192,192), which correspond to five segmented areas respectively, that is, the hat and pants colors in the initial clothing image are RGB(0,0,0); the hair color is RGB(120,67,21), the top color is RGB(35,90,176), the face color is RGB(240,155,89), and the background color is RGB(192,192,192). Then, only the top color is recolored, changing the top color to RGB(240,134,80), and the target clothing image can be obtained. Figure 2In the figure, it can be seen that only the color of the top has changed, and the colors of the rest of the area have not changed. It should be noted that the synthetic image obtained by merging the initial reflection image and the initial shadow image has a poor synthesis effect compared with the initial clothing image, and there are heavier shadows. The synthetic image obtained by merging the first reflection image and the first shadow image is closer to the initial clothing image than the initial clothing image. It can be seen that after the optimization of the second preset intrinsic image decomposition model, a better decomposed image can be obtained.
[0180] It should be noted that, in order to verify the recoloring effect and recoloring efficiency of the clothing image recoloring method provided in this embodiment, a series of experimental verifications were carried out.
[0181] See also Figure 3 , Figure 3 FIG. 1 is a schematic diagram of the recoloring effect of the clothing image recoloring method provided by an embodiment of the present application in a model image. Figure 3 As shown in , column (1) is the initial clothing image and its corresponding theme color, and columns (2), (3), and (4) are the changed theme colors and the corresponding recoloring results. Figure 3 In (3-a), there are 5 theme colors in the image, and the last three theme colors from left to right are changed, that is, the colors of the plant patterns in the arms and tops of the characters are not changed. It can be seen that the clothing image recoloring method provided by the present application can perform recoloring well; Figure 3 In (3-b), Figure 3 (3-b) in the figure is a sweater-like garment containing more texture details. There are 4 theme colors in the image. The first two theme colors from left to right are changed, that is, the color of the horizontal stripes of the sweater is changed. It can be seen that the clothing image recoloring method provided in the present application can also well maintain the texture details in the clothing while achieving recoloring. This is because the first reflection image is smoothed in the intrinsic image decomposition stage to make it conform to the piecewise constant image. At this time, the first reflection image contains fewer texture details under the action of the regularization term. Since the synthesis result of the first reflection image and the first shadow image is close to the initial clothing image, the first shadow image will contain more information about the texture details of the clothing. In the recoloring process, the clothing image recoloring method provided in the present application does not perform any operation on the first shadow image, but only uses it as a tool for the final synthesis of the initial clothing image, so the texture details of the image can be better maintained.
[0182] Furthermore, in order to verify the effect of the clothing image recoloring method provided by this application, the most representative Han method in the field of textile image recoloring is selected for comparison. Figure 4 , Figure 4 FIG. 1 is a schematic diagram comparing the recoloring effects of different recoloring methods provided in one embodiment of the present application. Figure 4As shown, in Figure 4 In (4-a) and (4-b), due to the poor intrinsic image decomposition effect in the Han method, it is difficult to obtain a suitable solution to the intrinsic image decomposition problem without introducing sufficient priors. Therefore, the Han method judges the leg and hand areas as the same color as the pants for color replacement. It can be seen that the clothing image recoloring method provided in the present application can obtain good recoloring results, while the Han recoloring method not only misjudges the color of the human body in this figure, but also judges the shadow part as an object that needs to be recolored. It can be seen that the clothing image recoloring method of the present application has a better recoloring effect.
[0183] Furthermore, in order to verify the recoloring efficiency of the clothing image recoloring method of the present application, multiple clothing images of different sizes with equal length and width are selected, and two recoloring methods are run. The running time obtained is as follows: Figure 5 See Figure 5 , Figure 5 FIG. 1 is a schematic diagram comparing the recoloring runtimes of different recoloring methods provided in one embodiment of the present application. Figure 5 In the figure, the horizontal axis is the length and width of the clothing image, and the vertical axis is the running time (seconds) of different recoloring methods. Figure 5 In the figure, the Han method is represented by a square-straight line curve type; the clothing image recoloring method of the present application is represented by a circle-straight line curve type. By comparing the running time of the two methods on clothing images of different sizes, it can be seen that the clothing image recoloring method of the present application is significantly shorter than the Han recoloring method in terms of time spent, and as the image size continues to increase, the time gap becomes more obvious. When the image size is 512×512, the recoloring time of the clothing image recoloring method of the present application is 3.62 seconds, and the recoloring time of the Han method is 24.11 seconds; and when the image size reaches 2304×2304, the recoloring time of the clothing image recoloring method of the present application is only 41.22 seconds, and the recoloring time of the Han method is 503.15 seconds, which is more than ten times faster. It can be seen that the recoloring efficiency of the clothing image recoloring method of the present application is significantly improved.
[0184] It can be understood that, on the one hand, after obtaining the decomposition result of the intrinsic image decomposition, the clothing image recoloring method of the present application directly writes the analytical solution of the image segmentation problem according to the first-order optimal condition; on the other hand, the clothing image recoloring method of the present application chooses to use a plug-and-play denoiser as a regularization term to smooth the reflection image, and does not require additional algorithm design for solving. All sub-problems in the iterative model can be solved directly without iteration, which can greatly reduce the time spent on the program, and when the image size is larger, this plug-and-play denoiser can better play its parallel computing advantages and greatly reduce the time required for recoloring.
[0185] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean 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 the present application.
[0186] Corresponding to a clothing image recoloring method of the above embodiment, Figure 6 A schematic structural diagram of a clothing image recoloring device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0187] See also Figure 6 , the clothing image recoloring device 3 of this embodiment includes:
[0188] The acquisition module 31 is used to acquire an initial clothing image; wherein the initial clothing image at least includes: a clothing area;
[0189] A decomposition module 32 is used to perform intrinsic image decomposition on the initial clothing image to obtain a corresponding first reflection image and a first shadow image;
[0190] An extraction module 33 is used to extract all colors in the first reflection image to obtain multiple theme colors in the clothing area;
[0191] A segmentation module 34 is used to segment the clothing area according to the multiple theme colors to obtain multiple segmented areas; wherein each segmented area corresponds to a theme color in the clothing area;
[0192] A recoloring module 35, used for recoloring the theme color of at least one segmented area among the multiple segmented areas to obtain a second reflection image;
[0193] The reconstruction module 36 is used to synthesize the second reflection image and the first shadow image to obtain a target clothing image.
[0194] It can be understood that after the acquisition module 31 acquires the initial clothing image, first, the decomposition module 32 performs intrinsic image decomposition on the initial clothing image including the clothing area to obtain the corresponding first reflection map and first shadow map; secondly, the extraction module 33 is used to extract all colors in the first reflection map to obtain multiple theme colors in the clothing area; furthermore, the segmentation module 34 segments the clothing area according to the multiple theme colors to obtain multiple segmented areas; wherein each segmented area corresponds to a theme color in the clothing area; then, the recoloring module 35 recolors the theme color of at least one segmented area in the multiple segmented areas to obtain a second reflection map; finally, the reconstruction module 36 synthesizes the second reflection map with the first shadow map to obtain the target clothing image. This embodiment can reduce the influence of illumination on the recoloring of the clothing image and reduce the color distortion of the clothing area corresponding to the non-theme color through the above method, thereby improving the effect and efficiency of the recoloring of the clothing image.
[0195] It should be noted that the information interaction, execution process and other contents between the modules in the above-mentioned clothing image recoloring device 3 are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0196] The present application also provides a clothing image recoloring device, such as Figure 7 As shown, Figure 7 This is a schematic diagram of the structure of a clothing image recoloring device provided by an embodiment of the present application. Figure 7 The clothing image recoloring device 4 of this embodiment includes: a memory 41, a processor 42, and a computer program stored in the memory 41 and executable on the processor 42. When the processor 42 executes the computer program, the steps of any one of the above-mentioned clothing image recoloring method embodiments are implemented.
[0197] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0198] The embodiment of the present application also provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0199] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0200] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0201] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0202] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0203] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0204] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A clothing image recoloring method, characterized in that: include: Acquire an initial clothing image; wherein the initial clothing image at least includes: a clothing area; Performing intrinsic image decomposition on the initial clothing image to obtain a corresponding first reflection image and a first shadow image; Extract all colors in the first reflection image to obtain multiple theme colors in the clothing area; According to the plurality of theme colors, the clothing area is segmented to obtain a plurality of segmented areas; wherein each of the segmented areas corresponds to a theme color in the clothing area; recoloring the theme color of at least one of the plurality of segmented areas to obtain a second reflection image; synthesizing the second reflection image and the first shadow image to obtain a target clothing image; The step of performing intrinsic image decomposition on the initial clothing image to obtain a corresponding first reflection image and a first shadow image includes: Decomposing the initial clothing image by a first preset intrinsic image decomposition model to obtain a corresponding initial reflection image and an initial shadow image; The initial reflection image and the initial shadow image are optimized by a second preset intrinsic image decomposition model to obtain the corresponding first reflection image and the first shadow image; wherein the second preset intrinsic image decomposition model is represented by an improved model of the first preset intrinsic image decomposition model; Wherein, the second preset intrinsic image decomposition model is: ; ; In the formula, is a single-channel image of the first reflection image that has been normalized; is a three-channel image of the first reflection image after normalization; is a single-channel image of the initial clothing image that has been normalized; represents the initial clothing image after normalization; ; ; ; ; is the constraint domain for performing intrinsic image decomposition on the initial clothing image; x is a pixel point in the initial clothing image; is the clothing area in the initial clothing image; is a single-channel image of the initial shadow map; is an image obtained by modulo the three-channel image of the initial reflection image; is a three-channel image of the initial reflection image; is a single-channel image of the first reflection image; is a single-channel image of the initial clothing image; , indicating that the initial clothing image can be obtained through a single-channel image of the first reflection image and the first shadow map Refactoring is a three-channel image of the initial clothing image; is the preset data item parameter; is the preset regularization parameter; A preset plug-and-play denoiser that operates on a single-channel image of the normalised first reflectance map.
2. The clothing image recoloring method according to claim 1, characterized in that: The step of optimizing the initial reflection image and the initial shadow image by using a second preset intrinsic image decomposition model to obtain the corresponding first reflection image and the first shadow image includes: Constructing an iterative model corresponding to the second preset intrinsic image decomposition model; The initial reflection map and the initial shadow map are iteratively optimized through the iterative model until a preset iteration termination condition is met and the iteration is stopped to obtain the corresponding first reflection map and the first shadow map.
3. The clothing image recoloring method according to claim 2, characterized in that: The iterative model is: Wherein, the preset iteration termination condition is: ; ; is the Lagrange multiplier; k is the number of iterations; is the Lagrange multiplier when the number of iterations is the kth; is the Lagrange multiplier when the number of iterations is k+1; is the iteration step length; It is a preset plug-and-play denoiser; for from arrive The mapping of RE is and The error value between is a single-channel image of the first reflection image that has been normalized; is a single-channel image of the first reflection image that has been normalized when the number of iterations is the kth time; is a single-channel image of the first reflection image that has been normalized when the number of iterations is k+1; is a three-channel image of the first reflection image after normalization; is a single-channel image of the initial clothing image that has been normalized; represents the initial clothing image after normalization; ; ; ; ; is the preset data item parameter; is the preset regularization parameter; is a single-channel image of the first reflection image; , indicating that the initial clothing image can be obtained through a single-channel image of the first reflection image and the first shadow map Refactoring is an image obtained by modulo the three-channel image of the initial reflection image; is a three-channel image of the initial clothing image; is a three-channel image of the initial reflection image; And, the three-channel image of the first reflection map is ; The first shadow map is ;in, It is a single-channel image of the first reflection map that is calculated by the iterative model and is normalized.
4. The clothing image recoloring method according to claim 1, characterized in that: The step of segmenting the clothing region according to the plurality of theme colors to obtain a plurality of segmented regions includes: Constructing an improved image segmentation model according to the plurality of subject colors and fuzzy membership functions; By using the improved image segmentation model, color region segmentation is performed on the clothing region in the first reflection image to obtain a plurality of segmented regions; Wherein, the improved image segmentation model is: ; ; In the formula, is the fuzzy membership function, used to represent the plurality of segmented regions; , Used to measure the fuzziness degree of the fuzzy membership function; is the pixel in the neighborhood of pixel x, that is , Pixel The radius is Pixels in the neighborhood of ; is the constraint domain of the improved image segmentation model; is the theme color of the i-th segmented area in the first reflection image; is a single-channel image of the first reflection map after normalization; ; is an image obtained by modulo the three-channel image of the initial reflection image; is a single-channel image of the first reflection image; is the initial clothing image after normalization; is the i-th sub-clothing region (i=1,2,…N) in the initial clothing image, and the clothing region is composed of N sub-clothing regions , , …, constitute; is a weighting function; N is an integer; is the fuzziness of the fuzzy membership function of the segmented region where pixel y is located; and ; In the formula, a is the normalization parameter, making ; is the standard deviation of the Gaussian function; is the weighting function about pixel x; ow is the abbreviation of otherwise, which means except All other regions in this domain, i.e. hour, .
5. The clothing image recoloring method according to claim 4, characterized in that: The fuzzy membership function for: ; in, ; To introduce variables, it is convenient to describe the fuzzy membership function To express.
6. The clothing image recoloring method according to claim 5, characterized in that: The step of recoloring the theme color of at least one of the plurality of segmented areas to obtain a second reflection map comprises: Determine the segmented area to be recolored in the first reflection image; According to the theme color of the segmented area, the changed new theme color and a preset color replacement formula, the color of the segmented area to be recolored is replaced to obtain the second reflection image; Wherein, the preset color replacement formula is: ; In the formula, is the second reflection image; is the theme color of the segmented area, ; The new theme color after the change is as follows. ;in, ; is a three-channel image of the first reflection image.
7. The clothing image recoloring method according to claim 1, characterized in that: The step of synthesizing the second reflection image and the first shadow image to obtain a target clothing image includes: According to the second reflection image, the first shadow image and a preset image synthesis formula, the second reflection image and the first shadow image are synthesized to obtain the target clothing image; wherein the preset image synthesis formula is: ; In the formula, is the target clothing image, is the second reflection map, is the first shadow map.
8. A clothing image recoloring device, characterized in that: include: The acquisition module is used to acquire an initial clothing image; wherein the initial clothing image at least includes: a clothing area; A decomposition module, used for performing intrinsic image decomposition on the initial clothing image to obtain a corresponding first reflection image and a first shadow image; An extraction module, used for extracting all colors in the first reflection image to obtain a plurality of theme colors in the clothing area; A segmentation module, used for segmenting the clothing area according to the plurality of theme colors to obtain a plurality of segmented areas; wherein each of the segmented areas corresponds to a theme color in the clothing area; a recoloring module, used for recoloring the theme color of at least one segmented area of the plurality of segmented areas to obtain a second reflection image; A reconstruction module, used for synthesizing the second reflection image and the first shadow image to obtain a target clothing image; Wherein, the decomposition module is specifically used for: Decomposing the initial clothing image by a first preset intrinsic image decomposition model to obtain a corresponding initial reflection image and an initial shadow image; The initial reflection image and the initial shadow image are optimized by a second preset intrinsic image decomposition model to obtain the corresponding first reflection image and the first shadow image; wherein the second preset intrinsic image decomposition model is represented by an improved model of the first preset intrinsic image decomposition model; Wherein, the second preset intrinsic image decomposition model is: ; ; In the formula, is a single-channel image of the first reflection image that has been normalized; is a three-channel image of the first reflection image after normalization; is a single-channel image of the initial clothing image that has been normalized; represents the initial clothing image after normalization; ; ; ; ; is the constraint domain for performing intrinsic image decomposition on the initial clothing image; x is a pixel point in the initial clothing image; is the clothing area in the initial clothing image; is a single-channel image of the initial shadow map; is an image obtained by modulo the three-channel image of the initial reflection image; is a three-channel image of the initial reflection image; is a single-channel image of the first reflection image; is a single-channel image of the initial clothing image; , indicating that the initial clothing image can be obtained through a single-channel image of the first reflection image and the first shadow map Refactoring is a three-channel image of the initial clothing image; is the preset data item parameter; is the preset regularization parameter; A preset plug-and-play denoiser that operates on a single-channel image of the normalised first reflectance map.
