An image processing method and apparatus
Patent Information
- Application Number
- CN202210539084.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-18
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2042-05-18
AI Technical Summary
[0038] When the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described in the image processing method provided in the first aspect above.
Smart Images

Figure CN117152386B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital marketing technology, and in particular to an image processing method and apparatus. Background Technology
[0002] In virtual try-on scenarios, images of the garment's smooth and wrinkled appearance are often used as data pairs to train the virtual try-on model using deep learning, thereby making the virtual try-on effect more realistic.
[0003] Typically, images of the smooth surface of clothing are virtual images generated by the merchant, while images of the folds are more difficult to obtain. Therefore, there is an urgent need for a method to generate images of the folds of clothing based on images of the smooth surface, thereby obtaining the data pairs required for the virtual fitting model. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide an image processing method and apparatus that can generate a target wrinkle matrix through a wrinkle function and a target parameter matrix; and use the target wrinkle matrix to process the image to be processed to generate a wrinkled image, thereby achieving the purpose of generating a wrinkled image based on a smooth image of clothing, obtaining the data pairs required for deep learning training of a virtual fitting model, meeting the training requirements of the virtual fitting model, and thus improving the realism of the fitting effect in the virtual fitting scene.
[0005] In addition, generating the target parameter matrix by using noise perturbation of the noise function can make the generated wrinkle layer have a better realistic effect; randomly rotating the wrinkle layer and adding it to a random position in the image to be processed can make the wrinkles of the clothing more visually realistic, thus meeting the requirement of high realism in the fitting effect.
[0006] To achieve the above objectives, according to a first aspect of the present invention, an image processing method is provided, comprising:
[0007] Obtain a wrinkle processing request for the image to be processed; the wrinkle processing request indicates the wrinkle matrix size, wrinkle function, and initial parameter vector;
[0008] Based on the size of the fold matrix and the initial parameter vector, determine the target parameter matrix corresponding to the fold layer to be generated;
[0009] Based on the target parameter matrix, the wrinkle matrix size, and the wrinkle function, generate the target wrinkle matrix corresponding to the wrinkle layer to be generated;
[0010] The image to be processed is processed according to the target wrinkle matrix to generate a wrinkle image.
[0011] Optionally, the wrinkle processing request also indicates a noise function;
[0012] The target parameter matrix corresponding to the wrinkle layer to be generated is determined based on the size of the wrinkle matrix, the initial parameter vector, and the noise function.
[0013] Optionally, the size of the fold matrix indicates the number of rows in the fold matrix, and determining the target parameter matrix corresponding to the fold layer to be generated includes:
[0014] The intermediate parameter matrix is determined based on the number of rows in the fold matrix and the initial parameter vector;
[0015] A noise matrix is generated based on the number of rows in the fold matrix and the noise function;
[0016] The sum of the intermediate parameter matrix and the corresponding noise matrix is used as the target parameter matrix.
[0017] Optionally, the noise function is constructed based on a Gaussian function or a random function.
[0018] Optionally, determining the intermediate parameter matrix based on the number of rows in the fold matrix and the initial parameter vector includes:
[0019] Based on the number of rows in the folded matrix and the division ratio, determine the multiple sub-matrices corresponding to the folded matrix and the division order;
[0020] For each submatrix: determine the subparameter matrix corresponding to the submatrix based on the number of rows of the submatrix, the row index of the submatrix, and the initial parameter vector;
[0021] The multiple sub-parameter matrices corresponding to the multiple sub-matrices are combined into the intermediate parameter matrix according to the division order.
[0022] Optionally, the size of the fold matrix further indicates the number of columns in the fold matrix, and generating the target fold matrix corresponding to the fold layer to be generated includes:
[0023] For each row of the target parameter matrix, the row fold matrix corresponding to the target parameter vector is generated based on the target parameter vector, the number of columns in the fold matrix of the fold layer to be generated, and the fold function.
[0024] Based on the number of rows in the wrinkle matrix, the row wrinkle matrices corresponding to each row are concatenated to obtain the target wrinkle matrix.
[0025] Optionally, processing the image to be processed according to the target wrinkle matrix to generate a wrinkled image includes:
[0026] Determine the pixel matrix of the image to be processed;
[0027] The target wrinkle matrix and the pixel matrix are summed to generate the wrinkle image.
[0028] Optionally, the method further includes:
[0029] Generate a wrinkle layer based on the target wrinkle matrix;
[0030] The wrinkle layer is randomly rotated, and the rotated wrinkle layer is added to a random position in the image to be processed.
[0031] According to a second aspect of the present invention, an image processing apparatus is provided, comprising: an acquisition module, a determination module, and a production module; wherein,
[0032] The acquisition module is used to acquire a wrinkle processing request for the image to be processed; the wrinkle processing request indicates the wrinkle matrix size, wrinkle function, and initial parameter vector;
[0033] The determining module is used to determine the target parameter matrix corresponding to the wrinkle layer to be generated based on the size of the wrinkle matrix and the initial parameter vector.
[0034] The generation module is used to generate a target wrinkle matrix corresponding to the wrinkle layer to be generated based on the target parameter matrix, the wrinkle matrix size, and the wrinkle function; and to process the image to be processed based on the target wrinkle matrix to generate a wrinkle image.
[0035] According to a third aspect of the present invention, an electronic device is provided, comprising:
[0036] One or more processors;
[0037] Storage device for storing one or more programs.
[0038] When the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described in the image processing method provided in the first aspect above.
[0039] According to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements any of the methods described in the image processing method provided in the first aspect above.
[0040] One embodiment of the above invention has the following advantages or beneficial effects: it can generate a target wrinkle matrix through a wrinkle function and a target parameter matrix; and use the target wrinkle matrix to process the image to be processed to generate a wrinkle image, thereby achieving the purpose of generating a wrinkle image based on the flat image of clothing, obtaining the data pairs required for deep learning training of the virtual fitting model, meeting the training requirements of the virtual fitting model, and thus improving the realism of the fitting effect in the virtual fitting scene.
[0041] In addition, generating the target parameter matrix by using noise perturbation of the noise function can make the generated wrinkle layer have a better realistic effect; randomly rotating the wrinkle layer and adding it to a random position in the image to be processed can make the wrinkles of the clothing more visually realistic, thus meeting the requirement of high realism in the fitting effect.
[0042] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0043] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0044] Figure 1 This is a schematic flowchart of an image processing method provided in one embodiment of the present invention;
[0045] Figure 2 This is a schematic diagram of a wrinkling function provided in one embodiment of the present invention;
[0046] Figure 3 This is a schematic diagram of a fold matrix provided in one embodiment of the present invention;
[0047] Figure 4 This is a schematic diagram of another fold matrix provided in one embodiment of the present invention;
[0048] Figure 5 This is a flowchart illustrating an image processing method provided in another embodiment of the present invention;
[0049] Figure 6 This is a schematic diagram of the structure of an image processing device provided in one embodiment of the present invention;
[0050] Figure 7 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0051] Figure 8 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0052] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0053] It should be noted that, unless otherwise specified, the embodiments of the present invention and the technical features thereof can be combined with each other.
[0054] like Figure 1 As shown, this embodiment of the invention provides an image processing method, which may include the following steps S101 to S104:
[0055] Step S101: Determine the wrinkle processing request for the image to be processed; the wrinkle processing request indicates the wrinkle matrix size, wrinkle function and initial parameter vector.
[0056] Step S102: Determine the target parameter matrix corresponding to the wrinkle layer to be generated based on the size of the wrinkle matrix and the initial parameter vector.
[0057] Step S103: Generate the target wrinkle matrix corresponding to the wrinkle layer to be generated based on the target parameter matrix, the wrinkle matrix size, and the wrinkle function.
[0058] Step S104: Process the image to be processed according to the target wrinkle matrix to generate a wrinkle image.
[0059] It is understood that one application scenario of this invention is to automatically generate a wrinkled clothing image with a pleated effect from a flat clothing image. The position, size, and number of pleats can be randomly specified. In other words, a flat clothing image can be processed multiple times to generate a wrinkled clothing image with multiple pleats.
[0060] Therefore, the image to be processed can be a flat garment image with a smooth effect, or a pleated garment image with one or more pleats.
[0061] In one embodiment of the present invention, each image processing step may include: generating a target wrinkle matrix, wherein the pixel value of each row of the target wrinkle matrix can be determined by a pre-constructed wrinkle function and a preset initial parameter vector; then using the target wrinkle matrix to generate a wrinkle layer; and then using the wrinkle layer to process the image to be processed, thereby generating a wrinkle image with a wrinkle effect.
[0062] For example, the generated target wrinkle matrix F can be summed with the pixel matrix I0 of the image to be processed to generate a pixel matrix I1, thus forming a wrinkled image.
[0063]
[0064] Therefore, the wrinkle processing request for the image to be processed may include the wrinkle matrix size, wrinkle function, and initial parameter vector of the target wrinkle matrix to be generated.
[0065] The size of the fold matrix can include the number of rows and columns of the fold matrix. For example, the size of the fold matrix F is h×w, where h is the number of rows and w is the number of columns.
[0066] In one embodiment of the present invention, the wrinkling function can be constructed based on the cosine function, and the element values of each row of the target wrinkling matrix can be obtained according to the wrinkling function.
[0067] For example, we can define the column index x of each row of the fold matrix F as taking values in the range {0, 1, 2, ..., w-1}, where w is the number of columns in the fold matrix. Then, the fold function f can be expressed as follows:
[0068]
[0069]
[0070] It can be understood that the wrinkle function f can be divided into five parts. The middle part (-1 < μ ≤ 1) has a positive function value. When it is summed with I0, the pixel value of the middle part of the wrinkle layer is increased by the corresponding positive value based on the pixel value of the image to be processed, which increases the pixel value of the image to be processed. This is reflected in the generated wrinkle image as the raised part of the wrinkle. The two sides (-3 < μ ≤ -1 or 1 < μ ≤ 3) have negative function values. When they are summed with the image to be processed, the pixel value of the two sides of the wrinkle layer is increased by the corresponding negative value based on the pixel value of the image to be processed, which decreases the pixel value of the image to be processed. This is reflected in the generated wrinkle image as the shadow part on both sides of the wrinkle.
[0071] Figure 2 This is a schematic diagram of the wrinkle function f(x), with x as the horizontal axis. a, b, c, d, and e are the parameters of the wrinkle function. a (0 < a < w) represents the width of the wrinkles in the wrinkle layer to be generated. To avoid abrupt changes in wrinkle boundaries during subsequent image processing, i.e., to prevent generated wrinkles from occupying the entire wrinkle layer, the value of a can be set to a < w / 2. This ensures that f(x) = 0 when x = 0 and x = w - 1.
[0072] b (0 < b < w) represents the position of the midpoint of the fold. In one embodiment of the present invention, b can be set to... δ represents a relatively small perturbation; The wrinkle layer corresponds to the starting point on the x-axis. The x-axis endpoint corresponds to the wrinkle layer; c (c > 0) represents the maximum value of the target wrinkle matrix F, i.e., the maximum value when -1 < μ ≤ 1; d (d > 0) represents the absolute value of the minimum value of the target wrinkle matrix F when -3 < μ ≤ -1; e (e > 0) represents the absolute value of the minimum value of the target wrinkle matrix F when 1 < μ ≤ 3; and eps represents a very small positive number to prevent the denominator from being 0 when calculating μ.
[0073] It is understandable that a, b, c, d, and e can form the parameter vector of the target fold matrix. In the fold processing request, the initial parameter vector can be set to [a0 b0 c0 d0 e0].
[0074] In one embodiment of the present invention, in order to simulate a realistic wrinkle effect, the pixel values of each row of the target wrinkle matrix to be generated should not be completely identical, requiring a certain difference in wrinkle pixel values to make the wrinkles appear more realistic. Therefore, the parameter vector corresponding to each row of the target wrinkle matrix to be generated can be set to be different, thereby forming a target parameter matrix corresponding to the target wrinkle matrix. For example, if the number of rows of the target wrinkle matrix F is h, then the wrinkle function of each row can be expressed as f. i (x), the corresponding objective parameter matrix can be represented as P = [p i |i = 1, 2, ..., h], where p i The parameter vector in the i-th row [a i b i c i d i e i ].
[0075] When generating the target parameter matrix, the following method is preferably used: the target parameter matrix corresponding to the wrinkle layer to be generated is determined according to the size of the wrinkle matrix, the initial parameter vector and the noise function.
[0076] In one embodiment of the present invention, an intermediate parameter matrix is first determined, and then the intermediate parameter matrix is perturbed by a noise function to generate the target parameter matrix, so as to achieve the effect of forming noise perturbation on the target wrinkle matrix, thereby making the wrinkle image have a realistic wrinkle effect.
[0077] Specifically, an intermediate parameter matrix can be determined first using the following method provided in the embodiments of the present invention: based on the number of rows of the folded matrix and the division ratio, determine the multiple sub-matrices corresponding to the folded matrix and the division order; for each sub-matrix: based on the number of rows of the sub-matrix, the row index of the sub-matrix, and the initial parameter vector, determine the sub-parameter matrix corresponding to the sub-matrix; combine the multiple sub-parameter matrices corresponding to the multiple sub-matrices according to the division order to form the intermediate parameter matrix.
[0078] It is understandable that in real life, the folds in clothing tend to become flatter at both ends, while the middle part is more prominent. The folds gradually widen and then narrow again from top to bottom. To simulate a realistic fold effect, in one embodiment of this invention, the target fold matrix F (with fold matrix size (h, w)) to be generated can be divided into three sub-matrices—upper, middle, and lower—according to a top-to-bottom division order, corresponding to F1, F2, and F3, respectively, based on the number of rows h of the fold matrix. The size of F1 is (h / 4, w); the size of F2 is (h / 2, w); and the size of F3 is (h / 4, w), with a division ratio of 1:2:1. In sub-matrix F2, the parameter vector for each row is the initial parameter vector [a0 b0 c0 d0 e0]. That is, for sub-matrix F2, the element values of each row are composed of the same function f. A schematic diagram of the element values of sub-matrix F2 and x, y can be shown as follows. Figure 3 As shown, it can be represented as:
[0079]
[0080] Then, the element value F2(x, y) in the y-th row and x-th column of submatrix F2 can be:
[0081]
[0082] Assuming h is 8, then the subparameter matrix P2 corresponding to submatrix F2 can represent a matrix with h / 2 rows, which is a 4-row subparameter matrix:
[0083]
[0084] For a realistic effect, each row of the parameter vector in the two submatrices F1 and F3 of F is set to a different parameter vector.
[0085] For submatrices F1 and F3, the parameter vector of each row is related to the row index j within its submatrix, and is [a j b j c j d j e j ]:
[0086]
[0087] The submatrix F1 can be represented as follows:
[0088]
[0089] The row indices of submatrix F1 can be set from top to bottom as follows: The element value F1(x, y) in the y-th row and x-th column of submatrix F1:
[0090] F1(x, y) = f y (x),
[0091] Assuming h is 8, then the subparameter matrix P1 corresponding to submatrix F1 is a matrix with h / 4 rows, i.e., a 2-row subparameter matrix:
[0092]
[0093] Similarly, for submatrix F3, in order to make the pleating effect narrower at the top and bottom, the row numbers of submatrix F3 can be set from bottom to top as follows: Submatrix F3 can be represented as:
[0094]
[0095] The element F1(x, y) in the y-th row and x-th column of submatrix F3:
[0096]
[0097] Assuming h is 8, then the subparameter matrix P3 corresponding to submatrix F3 is a matrix with h / 4 rows, i.e., a 2-row subparameter matrix.
[0098]
[0099] A diagram illustrating the elements of submatrix F3 in relation to x and y can be shown as follows: Figure 4 As shown, it can be understood that the schematic relationship between the element values of submatrix F1 and x and y is... Figure 4 The symmetrical image of the middle image with the x-axis as the midline is not shown here.
[0100] In embodiments of the present invention, P1, P2, and P3 can be combined into an intermediate parameter matrix P according to the partitioning order. For example, when the number of rows h of the fold matrix is 8, the intermediate parameter matrix P can be:
[0101]
[0102] After determining the intermediate parameter matrix, a noise matrix can be added to the intermediate parameter matrix using a noise function to obtain a target parameter matrix with noise perturbation. Specifically, the following method provided in the embodiments of the present invention can be used: determine the intermediate parameter matrix according to the number of rows of the folded matrix and the initial parameter vector; generate a noise matrix according to the number of rows of the folded matrix and the noise function; and use the sum of the intermediate parameter matrix and the corresponding noise matrix as the target parameter matrix.
[0103] The noise function can be constructed based on a Gaussian function or a random function. Taking the construction of a noise function based on a Gaussian function as an example, the noise function g can be expressed as:
[0104]
[0105] Where α, β, and γ are hyperparameters, α can be set randomly, and β and γ can generally be set to: 1≤β≤h. h is the row number of the fold matrix, i = 1, 2, ..., h.
[0106] For each column of the intermediate parameter matrix P, hyperparameters can be randomly set to obtain the column noise vector corresponding to each parameter a, b, c, d, e. For example, for the column with parameter a, a column noise vector G can be generated. a =[g(i)|i=1,2,...,h]. Therefore, multiple column noise vectors can be generated for the multiple columns corresponding to the intermediate parameter matrix P, and these multiple column noise vectors can be combined to form a noise matrix G, such as [G a G b G c G d G e ].
[0107] The sum of the intermediate parameter matrix and the corresponding noise matrix is used as the target parameter matrix. For example:
[0108] P′=P+G
[0109] Of course, noise matrices can be added multiple times to the intermediate parameter matrix, making the parameter matrix more random and improving the realism of the wrinkled layer to be generated.
[0110] In one embodiment of the present invention, generating the target wrinkle matrix corresponding to the wrinkle layer to be generated can be achieved by the following steps: for each row of the target parameter vector in the target parameter matrix: generating a row wrinkle matrix corresponding to the target parameter vector based on the target parameter vector, the number of columns of the wrinkle matrix of the wrinkle layer to be generated, and the wrinkle function; and concatenating the row wrinkle matrices corresponding to each row based on the number of rows of the wrinkle matrix to obtain the target wrinkle matrix.
[0111] After obtaining P′, each row of the target wrinkle matrix can be represented by the parameter vector [a] of each row in P′. i b i c i d i e i The number of columns w and the column index x of the fold matrix are substituted into the fold function f(x) to obtain the row fold matrix. The obtained row fold matrix is then concatenated according to the row index to obtain a target fold matrix.
[0112] Then, the image to be processed is processed using the target wrinkle matrix to generate a wrinkled image. This can be done in the following manner according to an embodiment of the present invention: determining the pixel matrix of the image to be processed; performing a summation operation between the target wrinkle matrix and the pixel matrix to generate the wrinkled image.
[0113] For example, aligning the wrinkle matrix F with the size (H×W) of the pixel matrix I0 of the image to be processed, that is, enlarging the target wrinkle matrix F to (H×W) and filling the added part with 0 values, can be used to perform a summation operation with the pixel matrix I0 to generate a pixel matrix I1, thus forming a wrinkled image.
[0114]
[0115] Understandably, the magnified F can be called F'. All elements in F' except for the elements of the F matrix are filled with 0. The position of F in the magnified F' can be arbitrary. In other words, in the generated wrinkle image, the position of the wrinkle layer in the wrinkle image is random. This can better meet the requirement of realistic wrinkle effect in virtual fitting scene.
[0116] Of course, in another embodiment of the present invention, the wrinkled image can also be generated in the following manner: a wrinkled layer is generated according to the target wrinkled matrix; the wrinkled layer is randomly rotated, and the rotated wrinkled layer is added to a random position of the image to be processed.
[0117] For example, F can be randomly rotated and then enlarged to generate F', which is then summed with I0 to form a wrinkled image, thus achieving a more realistic effect of random wrinkle direction. Alternatively, a pixel matrix I2 of the same size as F can be randomly extracted from the pixel matrix I0 of the image to be processed, and F can be summed with I2 to generate a pixel matrix I. FThis creates a wrinkle layer, which is then randomly rotated and added to a random position in the image to be processed, thus forming a wrinkled image. It's understandable that the random position added to the image should be close to the pixel values of the generated wrinkle layer to avoid significant differences in image pixels.
[0118] Of course, different sizes of target wrinkle matrices can be generated multiple times, and different noise perturbations can be randomly added using a noise function. Then, these multiple target wrinkle matrices of different sizes can be used to process the image to be processed multiple times to generate multiple wrinkle layers. Then, multiple wrinkle layers of different sizes and directions can be randomly added to the image to be processed, thereby achieving a more realistic effect of clothing wrinkles in real life, further improving the realism of the virtual fitting scene.
[0119] Taking the generation of a wrinkled image of clothing from a flat image as an example, this paper provides a detailed description of an image processing method according to another embodiment of the present invention. The specific steps are as follows: Figure 5 ,include:
[0120] Step S501: Obtain the wrinkle processing request for the image to be processed.
[0121] Step S502: Determine the size of the target wrinkle matrix to be generated, the wrinkle function, and the initial parameter vector.
[0122] The target fold matrix has dimensions h (number of rows) and w (number of columns) and the initial parameter vector is [a0 b0 c0 d0 e0].
[0123] Step S503: Determine the intermediate parameter matrix P based on the initial parameter vector and the number of rows in the fold matrix.
[0124] Step S504: Determine the target parameter matrix P' based on the intermediate parameter matrix P and the noise function.
[0125] Step S505: Determine the target wrinkle matrix F based on the target parameter matrix P' and the wrinkle function.
[0126] Step S506: Determine the pixel matrix of the image to be processed, and perform a summation operation between the target wrinkle matrix F and the pixel matrix to generate a wrinkle layer.
[0127] Step S507: Randomly rotate the wrinkle layer and add it to a random position in the image to be processed.
[0128] According to an embodiment of the present invention, an image processing method is provided, which can generate a target wrinkle matrix through a wrinkle function and a target parameter matrix; and use the target wrinkle matrix to process the image to be processed to generate a wrinkle image, thereby achieving the purpose of generating a wrinkle image based on the flat image of clothing, obtaining the data pairs required for deep learning training of the virtual fitting model, satisfying the training requirements of the virtual fitting model, and thus improving the realism of the fitting effect in the virtual fitting scene.
[0129] In addition, generating the target parameter matrix by using noise perturbation of the noise function can make the generated wrinkle layer have a better realistic effect; randomly rotating the wrinkle layer and adding it to a random position in the image to be processed can make the wrinkles of the clothing more visually realistic, thus meeting the requirement of high realism in the fitting effect.
[0130] like Figure 6 As shown, this embodiment of the invention provides an image processing apparatus 600, including: an acquisition module 601, a determination module 602, and a generation module 603; wherein,
[0131] The acquisition module 601 is used to acquire a wrinkle processing request for the image to be processed; the wrinkle processing request indicates the wrinkle matrix size, wrinkle function and initial parameter vector;
[0132] The determining module 602 is used to determine the target parameter matrix corresponding to the wrinkle layer to be generated based on the size of the wrinkle matrix and the initial parameter vector.
[0133] The generation module 603 is used to generate a target wrinkle matrix corresponding to the wrinkle layer to be generated based on the target parameter matrix, the wrinkle matrix size and the wrinkle function; and to process the image to be processed based on the target wrinkle matrix to generate a wrinkle image.
[0134] In one embodiment of the present invention, the determining module 602 is used to determine the target parameter matrix corresponding to the wrinkle layer to be generated based on the wrinkle matrix size, the initial parameter vector and the noise function.
[0135] In one embodiment of the present invention, the determining module 602 is configured to determine an intermediate parameter matrix based on the number of rows in the folded matrix and the initial parameter vector; generate a noise matrix based on the number of rows in the folded matrix and the noise function; and use the sum of the intermediate parameter matrix and the corresponding noise matrix as the target parameter matrix.
[0136] In one embodiment of the present invention, the determining module 602 is used to determine that the noise function is constructed based on a Gaussian function or a random function.
[0137] In one embodiment of the present invention, the determining module 602 is used to determine multiple sub-matrices corresponding to the folded matrix and the division order according to the number of rows of the folded matrix and the division ratio; for each sub-matrix: determine the sub-parameter matrix corresponding to the sub-matrix according to the number of rows of the sub-matrix, the row index of the sub-matrix and the initial parameter vector; and combine the multiple sub-parameter matrices corresponding to the multiple sub-matrices respectively into the intermediate parameter matrix according to the division order.
[0138] In one embodiment of the present invention, the generation module 603 is used to generate a row fold matrix corresponding to the target parameter vector for each row of the target parameter matrix, based on the target parameter vector, the number of columns of the fold matrix of the fold layer to be generated, and the fold function; and to concatenate the row fold matrices corresponding to each row based on the number of rows of the fold matrix to obtain the target fold matrix.
[0139] In one embodiment of the present invention, the generation module 603 is used to determine the pixel matrix of the image to be processed; and to perform a summation operation between the target wrinkle matrix and the pixel matrix to generate the wrinkle image.
[0140] In one embodiment of the present invention, the generation module 603 is used to generate a wrinkle layer according to the target wrinkle matrix; randomly rotate the wrinkle layer; and add the rotated wrinkle layer to a random position of the image to be processed.
[0141] An image processing apparatus provided by an embodiment of the present invention can generate a target wrinkle matrix through a wrinkle function and a target parameter matrix; and process the image to be processed using the target wrinkle matrix to generate a wrinkle image, thereby achieving the purpose of generating a wrinkle image based on a flat image of clothing, obtaining the data pairs required for deep learning training of a virtual fitting model, satisfying the training requirements of the virtual fitting model, and thus improving the realism of the fitting effect in the virtual fitting scene.
[0142] In addition, generating the target parameter matrix by using noise perturbation of the noise function can make the generated wrinkle layer have a better realistic effect; randomly rotating the wrinkle layer and adding it to a random position in the image to be processed can make the wrinkles of the clothing more visually realistic, thus meeting the requirement of high realism in the fitting effect.
[0143] Figure 7 An exemplary system architecture 700 is shown that can be applied to the image processing method or image processing apparatus of the present invention.
[0144] like Figure 7As shown, system architecture 700 may include terminal devices 701, 702, and 703, a network 704, and a server 705. Network 704 serves as the medium for providing communication links between terminal devices 701, 702, and 703 and server 705. Network 704 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0145] Users can use terminal devices 701, 702, and 703 to interact with server 705 via network 704 to receive or send messages, etc.
[0146] Terminal devices 701, 702, and 703 can be various electronic devices with displays that support information browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0147] Server 705 can be a server that provides various services, such as a background management server that supports image processing requests made by users using terminal devices 701, 702, and 703. The background management server can generate wrinkled images from the received image processing requests and other data, and feed the image processing results back to the terminal devices.
[0148] It should be noted that the image processing method provided in the embodiments of the present invention is generally executed by server 705, and correspondingly, the image processing device is generally located in server 705.
[0149] It should be understood that Figure 7 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0150] The following is for reference. Figure 8 It shows a schematic diagram of the structure of a computer system 800 suitable for implementing a terminal device of the present invention. Figure 8 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0151] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 802 or programs loaded from storage section 808 into random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the system 800. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0152] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.
[0153] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit (CPU) 801, it performs the functions defined above in the system of this invention.
[0154] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0155] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0156] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including an acquisition module, a determination module, and a generation module. The names of these modules do not necessarily limit the module itself; for example, the acquisition module can also be described as a "module for acquiring wrinkle processing requests".
[0157] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs that, when executed by the device, cause the device to include: acquiring a wrinkle processing request for an image to be processed; the wrinkle processing request indicating a wrinkle matrix size, a wrinkle function, and an initial parameter vector; determining a target parameter matrix corresponding to a wrinkle layer to be generated based on the wrinkle matrix size and the initial parameter vector; generating a target wrinkle matrix corresponding to the wrinkle layer to be generated based on the target parameter matrix, the wrinkle matrix size, and the wrinkle function; and processing the image to be processed based on the target wrinkle matrix to generate a wrinkled image.
[0158] According to the technical solution of the present invention, a target wrinkle matrix can be generated through a wrinkle function and a target parameter matrix; and the target wrinkle matrix is used to process the image to be processed to generate a wrinkle image, thereby achieving the purpose of generating a wrinkle image based on the flat image of clothing, obtaining the data pairs required for deep learning training of the virtual fitting model, meeting the training requirements of the virtual fitting model, and thus improving the realism of the fitting effect in the virtual fitting scene.
[0159] In addition, generating the target parameter matrix by using noise perturbation of the noise function can make the generated wrinkle layer have a better realistic effect; randomly rotating the wrinkle layer and adding it to a random position in the image to be processed can make the wrinkles of the clothing more visually realistic, thus meeting the requirement of high realism in the fitting effect.
[0160] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. An image processing method, characterized in that, include: Obtain the wrinkle processing request for the image to be processed; The wrinkle processing request specifies the wrinkle matrix size, wrinkle function, and initial parameter vector; Based on the size of the fold matrix and the initial parameter vector, determine the target parameter matrix corresponding to the fold layer to be generated; Based on the target parameter matrix, the wrinkle matrix size, and the wrinkle function, generate the target wrinkle matrix corresponding to the wrinkle layer to be generated; The image to be processed is processed according to the target wrinkle matrix to generate a wrinkle image; The wrinkle processing request also indicates a noise function, and the wrinkle matrix size indicates the number of rows in the wrinkle matrix; The determination of the target parameter matrix corresponding to the wrinkle layer to be generated includes: The intermediate parameter matrix is determined based on the number of rows in the fold matrix and the initial parameter vector; A noise matrix is generated based on the number of rows in the fold matrix and the noise function; The sum of the intermediate parameter matrix and the corresponding noise matrix is used as the target parameter matrix.
2. The method according to claim 1, characterized in that, The noise function is constructed based on a Gaussian function or a random function.
3. The method according to claim 1, characterized in that, The step of determining the intermediate parameter matrix based on the number of rows in the fold matrix and the initial parameter vector includes: Based on the number of rows in the folded matrix and the division ratio, determine the multiple sub-matrices corresponding to the folded matrix and the division order; For each submatrix: determine the subparameter matrix corresponding to the submatrix based on the number of rows of the submatrix, the row index of the submatrix, and the initial parameter vector; The multiple sub-parameter matrices corresponding to the multiple sub-matrices are combined into the intermediate parameter matrix according to the division order.
4. The method according to claim 1, characterized in that, The size of the fold matrix also indicates the number of columns in the fold matrix. Generating the target fold matrix corresponding to the fold layer to be generated includes: For each row of the target parameter matrix, the row fold matrix corresponding to the target parameter vector is generated based on the target parameter vector, the number of columns in the fold matrix of the fold layer to be generated, and the fold function. Based on the number of rows in the wrinkle matrix, the row wrinkle matrices corresponding to each row are concatenated to obtain the target wrinkle matrix.
5. The method according to claim 1, characterized in that, The step of processing the image to be processed according to the target wrinkle matrix to generate a wrinkle image includes: Determine the pixel matrix of the image to be processed; The target wrinkle matrix and the pixel matrix are summed to generate the wrinkle image.
6. The method according to claim 5, characterized in that, Also includes: Generate a wrinkle layer based on the target wrinkle matrix; The wrinkle layer is randomly rotated, and the rotated wrinkle layer is added to a random position in the image to be processed.
7. An image processing apparatus, characterized in that, include: The module includes an acquisition module, a determination module, and a generation module; among which, The acquisition module is used to acquire a wrinkle processing request for the image to be processed; the wrinkle processing request indicates the wrinkle matrix size, wrinkle function, and initial parameter vector; The determining module is used to determine the target parameter matrix corresponding to the wrinkle layer to be generated based on the size of the wrinkle matrix and the initial parameter vector. The generation module is used to generate a target wrinkle matrix corresponding to the wrinkle layer to be generated based on the target parameter matrix, the wrinkle matrix size, and the wrinkle function; and to process the image to be processed based on the target wrinkle matrix to generate a wrinkle image. The wrinkle processing request also indicates a noise function, and the wrinkle matrix size indicates the number of rows in the wrinkle matrix; The determining module is also used for: The intermediate parameter matrix is determined based on the number of rows in the fold matrix and the initial parameter vector; A noise matrix is generated based on the number of rows in the fold matrix and the noise function; The sum of the intermediate parameter matrix and the corresponding noise matrix is used as the target parameter matrix.
8. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.
9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.
Citation Information
Patent Citations
A capsule endoscopic image three-dimensional reconstruction method and system
CN109448041A
Image processing method and device
CN113744364A