Virtual clothes wearing method and device, electronic equipment and storage medium
By constructing a mapping relationship between virtual clothing patterns and models, the problem of high computational load during the wearing of virtual clothing of different sizes on character models was solved, achieving efficient clothing wearing calculations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- LINGDI (ZHEJIANG) TECHNOLOGY CO LTD
- Filing Date
- 2024-11-22
- Publication Date
- 2026-05-29
AI Technical Summary
In applications such as online clothing purchases, 3D animation, and 3D video games, the process of wearing virtual clothing of different sizes on a character model requires independent and complex calculations, resulting in a huge amount of computation.
By determining the reference point of the pre-set garment pattern corresponding to the target grid point, the mapping relationship between the pre-set garment model and the target garment model is constructed, directly determining the correspondence and relative position between the target garment pattern and the target garment model, without the need for complex calculations on the target garment pattern and the model.
The computational load of virtual clothing wearing process of different sizes has been reduced, and the computational efficiency has been improved.
Smart Images

Figure CN122115793A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of graphics modeling, and more specifically, to a method, apparatus, electronic device, and computer-readable storage medium for virtual clothing wearing. Background Technology
[0002] In applications such as online clothing purchases, 3D animation, and 3D video games, it is necessary to model clothing and characters, and then dress the resulting virtual clothing on the corresponding character models. Due to different needs for virtual clothing and different body types of character models, the same style of virtual clothing may exist in different sizes.
[0003] In related technologies, the process of wearing virtual clothing of different sizes on the corresponding character model needs to be calculated independently, resulting in a huge amount of computation for the process of wearing virtual clothing of different sizes. Summary of the Invention
[0004] The purpose of this application is to provide a virtual clothing wearing method, device, electronic device, and computer-readable storage medium that can reduce the computational load of the virtual clothing wearing process of different sizes.
[0005] In a first aspect, embodiments of this application provide a virtual clothing wearing method for wearing a target clothing pattern onto a target clothing model. The virtual clothing wearing method includes: determining a reference point in a preset clothing pattern corresponding to a target grid point, wherein the target grid point is a grid point in the target clothing pattern; determining a model reference point in the preset clothing model corresponding to the reference point in the pattern, and a reference point positional relationship between the pattern reference point and the model reference point, based on a preset positional relationship between the preset clothing pattern and the preset clothing model; constructing a model mapping between the target clothing model and the preset clothing model; determining a target reference point in the target clothing model corresponding to the model reference point based on the model mapping; constructing a target correspondence between the target grid point and the target reference point, and determining a target positional relationship between the target grid point and the target reference point based on the reference point positional relationship; and wearing the target clothing pattern onto the target clothing model based on the target correspondence and the target positional relationship.
[0006] Compared with related technologies, the virtual clothing wearing method provided in this application first determines the reference point of the preset clothing pattern corresponding to the target grid point, that is, first establishes the correspondence between the preset clothing pattern and the target clothing pattern; then, based on the preset positional relationship between the preset clothing pattern and the preset clothing model, the model reference point corresponding to the reference point of the pattern in the preset clothing model, and the reference point positional relationship between the reference point of the pattern and the model reference point are determined, that is, the correspondence between the target clothing pattern and the preset clothing model is established using the preset positional relationship between the preset clothing pattern and the preset clothing model as a medium; then, a model mapping between the target clothing model and the preset clothing model is constructed; and the target reference point corresponding to the model reference point in the target clothing model is determined based on the model mapping; since the correspondence between the target clothing pattern and the preset clothing model has already been established... The correspondence between the target garment pattern and the target garment model is established, and the model mapping between the preset garment model and the target garment model is established. Using the preset garment model as an intermediary, the correspondence between the target garment pattern and the target garment model can be constructed. Specifically, the target correspondence between the target grid point and the target reference point is constructed, and the target positional relationship between the target grid point and the target reference point is determined according to the positional relationship of the reference point. Finally, the target garment pattern can be worn on the target garment model according to the target correspondence and target positional relationship. Using the known preset garment pattern and preset garment model as an intermediary, the correspondence and relative positional relationship between the target garment pattern and the target garment model can be directly determined. The target garment pattern can be worn on the target garment model without complex calculations on the target garment pattern and the target garment model, thereby reducing the amount of computation in the process of wearing virtual garments of different sizes.
[0007] In an optional embodiment, the outer contour edge of the target garment pattern corresponds one-to-one with the outer contour edge of the preset garment pattern. Determining the reference point of the pattern in the preset garment pattern corresponding to the target grid point includes: scaling the target garment pattern so that the lengths of the corresponding outer contour edges of the target garment pattern and the preset garment pattern are equal; determining the position parameters of the grid points on the outer contour edge of the target garment pattern before scaling as a first position parameter; determining the position parameters of the grid points on the outer contour edge of the target garment pattern after scaling as a second position parameter; determining the position parameters of the internal grid points of the target garment pattern before scaling as a third position parameter; determining the position parameters of the internal grid points of the target garment pattern after scaling as a fourth position parameter based on the first position parameter, the second position parameter, and the third position parameter; and determining the point in the preset garment pattern whose position parameter is the same as the second position parameter or the fourth position parameter as the reference point of the pattern. Since virtual garments of the same style but different sizes have the same outer contour edge connection method, that is, the outer contour edge of the target garment pattern corresponds one-to-one with the outer contour edge of the preset garment pattern, the target garment pattern is first scaled to make the outer contour of the target garment pattern and the preset garment pattern the same. This can improve the accuracy of the correspondence of the grid points on the outer contour, that is, the accuracy of the determined second position parameter is higher. After the outer contour is determined, the correspondence and position parameters of the internal grid points are determined. The internal grid points determined by the more accurate second position parameter also have higher accuracy in the scaled fourth position parameter, thereby improving the overall accuracy of the pattern reference point.
[0008] In an optional embodiment, determining the fourth position parameter as the internal grid point position parameter of the target garment pattern after scaling, based on the first position parameter, the second position parameter, and the third position parameter, includes: substituting the first position parameter, the second position parameter, and the third position parameter into a preset function, solving the preset function according to preset constraints to obtain the fourth position parameter. The preset constraints are that the change in the internal angle of each triangular grid in the target garment pattern before and after scaling is minimized. Using the minimum change in the internal angle of each triangular grid in the target garment pattern before and after scaling as a constraint can reduce the degree of deformation of the topology of the target garment pattern during scaling. A smaller degree of deformation of the topology can make the correspondence between the determined target garment pattern and the preset garment pattern more accurate, that is, it can improve the accuracy of the pattern reference point.
[0009] In an optional embodiment, the preset function is:
[0010]
[0011] Where T is the set of all triangular meshes t in the target garment pattern, i, j, k are the three vertices of the triangular mesh t, λ is the ratio of the sum of the outer contour side lengths of the target garment pattern to the sum of the outer contour side lengths of the preset garment pattern, u is the position parameter of the mesh point in the target garment pattern before deformation, and v is the position parameter of the mesh point in the target garment pattern after deformation; the step of solving the preset function according to the preset constraint conditions includes: substituting the first position parameter, the second position parameter, and the third position parameter into the preset function, and solving for the position parameter of the internal mesh point that minimizes the E value, which is the fourth position parameter.
[0012] In an optional embodiment, the target clothing model and the preset clothing model have the same topological structure, and the construction of the model mapping between the target clothing model and the preset clothing model includes: establishing a one-to-one correspondence between faces between the target clothing model and the preset clothing model based on face index as the model mapping.
[0013] In an optional embodiment, the topological structure of the target clothing model is inconsistent with that of the preset clothing model. The step of constructing a model mapping between the target clothing model and the preset clothing model includes: constructing a freely deformable initial reference model; adjusting the shape and posture of the initial reference model to obtain an original reference model and a target reference model, wherein the shape and posture of the original reference model are the same as those of the preset clothing model, and the shape and posture of the target reference model are the same as those of the target clothing model; constructing a first mapping relationship between the preset clothing model and the original reference model, and constructing a second mapping relationship between the target clothing model and the target reference model; and constructing the model mapping based on the first mapping relationship and the second mapping relationship. By constructing a freely deformable initial reference model, the shape and posture of the initial reference model are adjusted based on its deformation function to form an original reference model and a target reference model. Since the shape and posture of the original reference model are the same as those of the preset clothing model, a corresponding point can be found on the preset clothing model for each point on the original reference model. Similarly, since the shape and posture of the target reference model are the same as those of the target clothing model, a corresponding point can be found on the target clothing model for each point on the target reference model. Since the original reference model and the target reference model are formed by deformation of the same initial reference model, the correspondence between each point on the original reference model and each point on the target reference model is known. That is, the known correspondence between the original reference model and the target reference model can be used as an intermediary to construct a model mapping between the target clothing model and the preset clothing model.
[0014] In an optional embodiment, the initialization reference model includes a surface polygonal mesh composed of multiple mesh units. Adjusting the shape and orientation of the initialization reference model to obtain the original reference model and the target reference model includes: adjusting the position, shape, and size of each mesh unit so that the shape and orientation of the surface polygonal mesh are the same as the shape and orientation of the preset clothing model, thereby obtaining the original reference model; and adjusting the position, shape, and size of each mesh unit so that the shape and orientation of the surface polygonal mesh are the same as the shape and orientation of the target clothing model, thereby obtaining the target reference model.
[0015] Secondly, embodiments of this application provide a virtual clothing wearing device, comprising: a storage module for storing a preset clothing pattern, a preset clothing model, and a preset positional relationship between the preset clothing pattern and the preset clothing model; a pattern mapping module for determining a pattern reference point in the preset clothing pattern corresponding to a target grid point, wherein the target grid point is a grid point in the target clothing pattern; a clothing wearing module for determining, based on the preset positional relationship, a model reference point in the preset clothing model corresponding to the pattern reference point, and a reference point positional relationship between the pattern reference point and the model reference point; a model mapping module for constructing a model mapping between the target clothing model and the preset clothing model, and determining a target reference point in the target clothing model corresponding to the model reference point based on the model mapping; the clothing wearing module is further configured to construct a target correspondence between the target grid point and the target reference point, and determine a target positional relationship between the target grid point and the target reference point based on the reference point positional relationship, and wear the target clothing pattern on the target clothing model according to the target correspondence and the target positional relationship.
[0016] Compared with related technologies, the virtual clothing wearing device provided in this application first determines the plate reference point corresponding to the target mesh point in the preset clothing plate in the plate mapping module, that is, firstly, the correspondence between the preset clothing plate and the target clothing plate is constructed in the plate mapping module; then, the clothing wearing module can determine the model reference point corresponding to the plate reference point in the preset clothing model, as well as the reference point position relationship between the plate reference point and the model reference point, according to the preset position relationship between the preset clothing plate and the preset clothing model stored in the storage module. That is, the clothing wearing module constructs the correspondence between the target clothing plate and the preset clothing model using the preset position relationship between the preset clothing plate and the preset clothing model stored in the storage module as a medium; then, the model mapping module constructs the model mapping between the target clothing model and the preset clothing model; the clothing wearing module can then determine the target reference point corresponding to the model reference point in the target clothing model according to the model mapping. Accuracy; Since the clothing wearing module has already established the correspondence between the target clothing pattern and the preset clothing model, as well as the model mapping between the preset clothing model and the target clothing model, the clothing wearing module can use the preset clothing model as an intermediary to establish the correspondence between the target clothing pattern and the target clothing model. Specifically, it establishes the target correspondence between the target grid points and the target reference points, and determines the target positional relationship between the target grid points and the target reference points based on the positional relationship of the reference points. Finally, the target clothing pattern can be worn on the target clothing model according to the target correspondence and target positional relationship. Using the known preset clothing pattern and preset clothing model as an intermediary, the correspondence and relative positional relationship between the target clothing pattern and the target clothing model can be directly determined. There is no need to perform complex calculations on the target clothing pattern and the target clothing model to wear the target clothing pattern, thereby reducing the amount of computation in the process of wearing virtual clothing of different sizes.
[0017] Thirdly, embodiments of this application provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the virtual clothing wearing method as described above.
[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which is executed by a processor to implement the virtual clothing wearing method as described above. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings.
[0020] Figure 1 This is a flowchart illustrating the virtual clothing wearing method provided in Embodiment 1 of this application;
[0021] Figure 2 This is a schematic diagram of the target clothing panel and the preset clothing panel in the virtual clothing wearing method provided in Embodiment 1 of this application;
[0022] Figure 3 This is a schematic diagram of the process for determining the reference point of the plate in the virtual clothing wearing method provided in Embodiment 1 of this application;
[0023] Figure 4 This is a schematic diagram of the process of constructing a model mapping in the virtual clothing wearing method provided in Embodiment 1 of this application;
[0024] Figure 5 This is a schematic diagram of the structure of the virtual clothing wearing device provided in Embodiment 2 of this application;
[0025] Figure 6 This is a schematic diagram of the structure of the electronic device provided in Embodiment 3 of this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0027] Therefore, the following detailed description of embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the present application.
[0028] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0029] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0030] It should be noted that, where there is no conflict, the features in the embodiments of this application can be combined with each other.
[0031] Embodiment 1 of this application provides a virtual clothing wearing method for wearing a target clothing pattern onto a target clothing model, such as... Figure 1 As shown, the virtual clothing wearing method provided in this embodiment includes the following steps:
[0032] Step S101: Determine the reference point of the preset garment pattern that corresponds to the target grid point. The target grid point is the grid point in the target garment pattern.
[0033] In this step, both the preset garment pattern and the target garment pattern are composed of a large number of basic mesh units. The most common example is that they can be composed of triangular mesh units. The corresponding mesh points in this step are the vertices of each basic mesh unit, and the target mesh point is the mesh point in the target garment pattern. The pattern reference point is the point in the preset garment pattern whose relative position is the same as the relative position of the target mesh point in the target garment pattern. The pattern reference point can be a mesh point in the preset garment pattern, or a point within or on the edge of each basic mesh unit in the preset garment pattern. Any point whose relative position in the preset garment pattern is the same as the relative position of the target mesh point in the target garment pattern can be used as the pattern reference point.
[0034] Furthermore, in this step, the preset garment pattern and the target garment pattern are 2D patterns corresponding to different sizes of the same style of virtual garment. Therefore, the outer contour edges of the target garment pattern correspond one-to-one with the outer contour edges of the preset garment pattern. That is, the outer contour shape and internal topology of the target garment pattern may differ, but the number of outer contour edges of the target garment pattern and the preset garment pattern are the same, and their positions are basically the same. Figure 2 As shown, Figure 2 In this context, plate a is the preset garment pattern, and plates b and c (b and c are the same plate; in this embodiment, for ease of explanation of different technical features, the same plate is shown separately) are the target garment patterns. Plate a and plate b differ in size and topology, but their outer contour structures are identical. Both consist of six outer contour vertices (vertices a1, a2, a3, a4, a5, a6 for plate a; vertices b1, b2, b3, b4, b5, b6 for plate b) and six outer contour edges (outer contour edges A1, A2, A3, A4, A5, A6 for plate a; vertices B1, B2, B3, B4, B5, B6 for plate b). There is a one-to-one correspondence between the outer contour edges of plate a and the outer contour vertices and edges of plate b. Figure 2The outer contour vertices a1 and b1 correspond to each other, and the outer contour edges A1 and B1 correspond to each other...
[0035] Based on this, such as Figure 3 As shown, determining the reference point of the pre-set garment pattern piece corresponding to the target grid point in this step may specifically include the following steps:
[0036] Step S201: Scale the target garment pattern so that the lengths of the corresponding outer contour edges in the target garment pattern and the preset garment pattern are equal.
[0037] In this step, when scaling the target garment pattern, you can first determine the scaled positions of each grid point on the outer contour edge of the target garment pattern. Please continue referring to... Figure 2 , Figure 2 The points on the outer side of plate b are the magnified positions of the various grid points on the outer contour edge of plate b after the plate b is enlarged.
[0038] Furthermore, in this step, if the outer contour shape of the target garment pattern is exactly the same as that of the preset garment pattern, then each outer contour edge of the target garment pattern can be scaled with the same scaling ratio, making the lengths of corresponding outer contour edges in the target garment pattern and the preset garment pattern equal. Conversely, if the outer contour shapes of the target garment pattern and the preset garment pattern are not exactly the same, then each outer contour edge can be scaled with an independent scaling ratio, making the lengths of corresponding outer contour edges in the target garment pattern and the preset garment pattern equal.
[0039] Step S202: Determine the position parameters of the grid points on the outer contour edge of the target garment pattern before scaling as the first position parameter, determine the position parameters of the grid points on the outer contour edge of the target garment pattern after scaling as the second position parameter, and determine the position parameters of the internal grid points of the target garment pattern before scaling as the third position parameter.
[0040] In this step, since the target garment pattern is a known pattern, the position parameters of the grid points on the outer contour edge of the target garment pattern before scaling, i.e., the first position parameter, are also known position parameters, which can be directly obtained from the relevant parameters of the target garment pattern. Similarly, the position parameters of the internal grid points of the target garment pattern before scaling, i.e., the third position parameter, are also known position parameters, which can also be directly obtained from the relevant parameters of the target garment pattern.
[0041] The second position parameter can be obtained based on the correspondence between the grid points on the outer contour edge of the target garment pattern and the points on the outer contour of the preset garment pattern. Specifically, for each grid point e on the outer contour edge of the target garment pattern, the outer contour edge E to which the grid point e belongs can be determined, and the position ratio of the grid point e in its respective outer contour edge E can be calculated. The position ratio is the ratio between the length of the line segment between the grid point e and one vertex of its respective outer contour edge E and the total length of its respective outer contour edge E. Correspondingly, since there is a one-to-one correspondence between the outer contour edges of the target garment pattern and the outer contour edges of the preset garment pattern, there must exist a point e' on the outer contour edge E' of the preset garment pattern that has the same position ratio as the grid point e. The position parameter of point e' on the preset garment pattern is the position parameter of the grid point e on the outer contour edge of the target garment pattern, i.e., the third position parameter.
[0042] Since virtual garments of the same style but different sizes have the same outer contour edge connection method, that is, the outer contour edge of the target garment pattern corresponds one-to-one with the outer contour edge of the preset garment pattern, the target garment pattern is first scaled to make the outer contour of the target garment pattern and the preset garment pattern the same. This can improve the accuracy of the correspondence of the grid points on the outer contour, that is, the accuracy of the determined second position parameter is higher. After the outer contour is determined, the correspondence and position parameters of the internal grid points are determined. The internal grid points determined by the more accurate second position parameter also have higher accuracy in the scaled fourth position parameter, thereby improving the overall accuracy of the pattern reference point.
[0043] Step S203: Determine the fourth position parameter as the scaled position parameter of the internal grid points of the target garment plate based on the first position parameter, the second position parameter, and the third position parameter.
[0044] Specifically, in this step, the first, second, and third position parameters can be substituted into a preset function. The preset function is then solved according to preset constraints to obtain the fourth position parameter. The preset constraint is to minimize the change in the internal angle of each triangular mesh in the target garment pattern before and after scaling. Using the minimum change in the internal angle of each triangular mesh in the target garment pattern before and after scaling as a constraint reduces the degree of topological deformation of the target garment pattern during scaling. Less topological deformation makes the correspondence between the determined target garment pattern and the preset garment pattern more accurate, thus improving the accuracy of the pattern reference point.
[0045] In some embodiments of this application, the preset function may be, for example:
[0046]
[0047] Where T is the set of all triangular meshes t in the target garment pattern, i, j, k are the three vertices of the triangular mesh t, and the vertices of the triangular mesh are the mesh points of the target garment pattern. λ is the ratio of the sum of the outer contour side lengths of the target garment pattern to the sum of the outer contour side lengths of the preset garment pattern. u is the position parameter of the mesh point in the target garment pattern before deformation, and v is the position parameter of the mesh point in the target garment pattern after deformation. When calculating the fourth position parameter, the first, second, and third position parameters are substituted into this preset function to find the position parameter of the internal mesh point that minimizes the E value, thus obtaining the fourth position parameter.
[0048] Since the first position parameter is the position parameter of the grid points on the outer contour edge of the target garment panel before deformation, and the third position parameter is the position parameter of the grid points inside the target garment panel before deformation, the first and third position parameters correspond to the position parameters of all grid points on the target garment panel before deformation. Therefore, the first and third position parameters can be represented by u. ti u tj u tk , t∈T can be represented; the corresponding second and fourth positional parameters can also be represented by v tj v ti v tk The fourth position parameter can be obtained by substituting the first, second, and third position parameters into this preset function.
[0049] Step S204: Determine the point in the preset garment pattern whose position parameter is the same as the second position parameter or the fourth position parameter as the pattern reference point.
[0050] In this step, the positions of each point in the preset garment pattern are compared one by one with the second position parameter and the fourth position parameter to obtain the points that correspond to the second position parameter or the fourth position parameter. These points are the reference points of the garment pattern in the preset garment pattern.
[0051] Step S102: Based on the preset positional relationship between the preset garment pattern and the preset garment model, determine the model reference point corresponding to the reference point of the pattern in the preset garment model, as well as the reference point positional relationship between the pattern reference point and the model reference point.
[0052] In this step, since the preset positional relationship between the preset garment pattern and the preset garment model is known data, we take any reference point f on the preset garment pattern as an example. Based on the preset positional relationship between the preset garment pattern and the preset garment model, we can determine a point F on the preset garment model that uniquely corresponds to the reference point f. We can also determine the positional relationship between point F and the reference point f based on the preset positional relationship. On this basis, point F is the model reference point, and the positional relationship between point F and the reference point f is the reference point positional relationship between the reference point f and the model reference point F.
[0053] Step S103: Construct a model mapping between the target clothing model and the preset clothing model, and determine the target reference point in the target clothing model corresponding to the model reference point based on the model mapping.
[0054] In this step, if the target clothing model and the preset clothing model have the same topological structure, a one-to-one correspondence between the faces of the target clothing model and the preset clothing model can be directly established based on the face index as a model mapping. That is, when the target clothing model and the preset clothing model have the same topological structure, there is a one-to-one correspondence between each face and each point in the target clothing model and each face and each point in the preset clothing model. In this step, the one-to-one correspondence between the faces can be directly established based on the face index as a model mapping.
[0055] If the topological structure of the target clothing model is inconsistent with that of the preset clothing model, then a method such as Figure 4 The steps shown construct a model mapping between the target clothing model and the preset clothing model. Specific steps may include:
[0056] Step S301: Construct a freely deformable initial baseline model.
[0057] In some embodiments of this application, constructing a freely deformable initial baseline model can specifically be as follows: constructing a model such as... Figure 2 , Figure 3The illustrated initialization reference model includes a skeleton 10 and a surface polygonal mesh 20 covering the skeleton 10. The polygonal mesh 20 is composed of multiple polygonal mesh units. The skeleton may include structures such as a spine, upper limbs, and lower limbs. The skeleton can be adjusted in length, translated, and rotated to adjust the posture of the initialization reference model. The surface polygonal mesh covering the skeleton can be adjusted in relevant dimensional parameters, such as arm circumference, surface undulation, and length, to adjust the shape of the initialization reference model. Furthermore, in some embodiments of this disclosure, the skeleton of the initialization reference model can be specifically constructed according to the shapes of a preset clothing model and a target clothing model. For example, if the preset clothing model and the target clothing model only have a single upper limb and / or a single lower limb, the skeleton of the initialization reference model can also be set to include only a single upper limb and / or a single lower limb. Specifically, it can be set according to the actual structures of the preset clothing model and the target clothing model.
[0058] It is understood that in different embodiments of this disclosure, the preset clothing model, the target clothing model, and the initial reference model can be a human body model, an animal body model, or, for example, a clothing mannequin body model, and can be flexibly set according to actual needs.
[0059] In some embodiments of this application, the skeleton 10 facilitates the adjustment of the pose of the initialization reference model. In other embodiments of this application, the initialization reference model may only include a surface polygonal mesh. When it is necessary to adjust the pose of the initialization reference model, the pose of the initialization reference model can be adjusted by calculating and adjusting the position, shape, and size of each polygonal mesh unit under different poses.
[0060] Step S302: Adjust the shape and orientation of the initial reference model to obtain the original reference model and the target reference model.
[0061] Specifically, in this step, the shape and posture of the original reference model are the same as those of the preset clothing model, and the shape and posture of the target reference model are the same as those of the target clothing model. It is understood that due to fitting errors, in this embodiment, the similarity between the shape and posture of the original reference model and the preset clothing model is considered to be the same when the similarity reaches a preset threshold (which can be set according to actual needs, for example, 90%, 95%, 98%). For example, if the similarity between the shape and posture of the original reference model and the preset clothing model reaches 90% / 95% / 98% or higher, it is considered that the shape and posture of the original reference model are the same as those of the preset clothing model. Similarly, the similarity between the shape and posture of the target reference model and the target clothing model is also considered to be the same when the similarity reaches a preset threshold.
[0062] Corresponding to the different structures of the initialization reference model in different embodiments, in some embodiments of this application, adjusting the shape and orientation of the initialization reference model to obtain the original reference model can specifically be: adjusting the position, shape, and size of each mesh unit so that the shape and orientation of the surface polygonal mesh are the same as the shape and orientation of the preset clothing model, thus obtaining the original reference model. Similarly, adjusting the shape and orientation of the initialization reference model to obtain the target reference model can specifically be: adjusting the position, shape, and size of each mesh unit so that the shape and orientation of the surface polygonal mesh are the same as the shape and orientation of the target clothing model, thus obtaining the target reference model.
[0063] In some other embodiments of this application, adjusting the shape and posture of the initialization reference model to obtain the original reference model can specifically involve: adjusting the skeleton so that the posture of the initialization reference model is the same as the posture of the preset clothing model; constructing the dimensions of the surface polygon mesh based on the dimensions of the preset clothing model so that the shape of the initialization reference model is the same as the shape of the preset clothing model, thus obtaining the original reference model. Similarly, adjusting the shape and posture of the initialization reference model to obtain the target reference model can specifically involve: adjusting the skeleton so that the posture of the initialization reference model is the same as the posture of the target clothing model; constructing the dimensions of the surface polygon mesh based on the dimensions of the target clothing model so that the shape of the initialization reference model is the same as the shape of the target clothing model, thus obtaining the target reference model.
[0064] Step S303: Construct the first mapping relationship between the preset clothing model and the original benchmark model, and construct the second mapping relationship between the target clothing model and the target benchmark model.
[0065] In this step, since the shape and posture of the original reference model are the same as those of the preset clothing model, for each point on the preset clothing model, a corresponding point can be determined on the original reference model by calculation. The one-to-one correspondence between the points of the preset clothing model and the original reference model is the first mapping relationship.
[0066] Similarly, since the shape and posture of the target reference model are the same as those of the target clothing model, for each point on the target clothing model, a corresponding point can be determined on the target reference model by calculation. The one-to-one correspondence between the points of the target clothing model and the target reference model is the second mapping relationship.
[0067] After constructing the model mapping between the target clothing model and the preset clothing model according to the above method, the target reference point corresponding to the model reference point can be determined in the target clothing model according to the correspondence between the points in the model mapping.
[0068] Step S304: Construct a model mapping based on the first mapping relationship and the second mapping relationship.
[0069] In this step, since both the target datum model and the original datum model are obtained by transforming the initial datum model, their topologies are completely identical. A one-to-one mapping can be formed between each point in the target datum model and each point in the original datum model; that is, for each point in the original datum model, there exists a unique corresponding point in the target datum model. In other words, for any point Q1 on the preset clothing model, according to the first mapping relationship, a corresponding point Q2 can be determined on the original datum model. Since both the target datum model and the original datum model are obtained by transforming the initial datum model, and their topologies are completely identical, a unique point Q3 corresponding to point Q2 can be determined on the target datum model. Furthermore, according to the second mapping relationship between the target clothing model and the target datum model, a unique point Q4 corresponding to point Q3 can be found on the target clothing model. Thus, using points Q2 and Q3 as a medium, a correspondence is formed between point Q1 on the preset clothing model and point Q4 on the target clothing model, thereby determining the model mapping between the preset clothing model and the target clothing model.
[0070] Step S104: Construct the target correspondence between the target grid points and the target reference points, and determine the target positional relationship between the target grid points and the target reference points based on the positional relationship of the reference points. Then, put the target garment piece on the target garment model according to the target correspondence and the target positional relationship.
[0071] Since the reference point of the preset garment pattern corresponding to the target mesh point has been determined in step S101, that is, for any target mesh point Y1 on the target garment pattern, the reference point Y2 corresponding to the target mesh point Y1 is determined on the preset garment pattern; in step S102, the reference point of the model corresponding to the reference point of the pattern in the preset garment model, as well as the reference point position relationship between the reference point of the pattern and the reference point of the model, are determined, that is, for the reference point Y2, the corresponding model reference point Y3 on the preset garment model is determined, and the reference point position relationship between the reference point of the pattern and the reference point Y3 is known; in step S103, the model mapping between the target garment model and the preset garment model is constructed, and the target reference point corresponding to the model reference point is determined in the target garment model, that is, the target reference point Y4 corresponding to the model reference point Y3 can be determined according to the model mapping. In this step, using plate reference point Y2 and model reference point Y3 as intermediaries, the target correspondence between target mesh point Y1 and target reference point Y4 is constructed based on the known correspondence between plate reference point Y2 and model reference point Y3.
[0072] Similarly, in this step, the target position relationship between the target mesh point Y1 and the target reference point Y4 can be determined by using the plate reference point Y2 and the model reference point Y3 as intermediaries and based on the known reference point position relationship between the plate reference point Y2 and the model reference point Y3.
[0073] Finally, based on the target correspondence and target position relationship between target grid point Y1 and target reference point Y4, the target clothing plate can be worn on the target clothing model.
[0074] Compared with related technologies, in the virtual clothing wearing method provided in this embodiment, in step S101, the reference point of the preset clothing pattern corresponding to the target grid point is determined, that is, the correspondence between the preset clothing pattern and the target clothing pattern is first established; then in step S102, according to the preset positional relationship between the preset clothing pattern and the preset clothing model, the model reference point corresponding to the reference point of the pattern in the preset clothing model, and the reference point positional relationship between the pattern reference point and the model reference point are determined, that is, in step S102, the correspondence between the target clothing pattern and the preset clothing model is established using the preset positional relationship between the preset clothing pattern and the preset clothing model as a medium; then in step S103, the model mapping between the target clothing model and the preset clothing model is established; the target reference point corresponding to the model reference point in the target clothing model is determined according to the model mapping; since the target clothing pattern and the preset clothing model have already been established in step S102, the correspondence between the preset clothing pattern and the target clothing pattern is established. The correspondence between the preset clothing models and the model mapping between the preset clothing model and the target clothing model have been established in step S103. In step S104, the preset clothing model can be used as an intermediary to establish the correspondence between the target clothing piece and the target clothing model. Specifically, this involves establishing the target correspondence between the target grid point and the target reference point, and determining the target positional relationship between the target grid point and the target reference point based on the positional relationship of the reference point. Finally, the target clothing piece can be worn on the target clothing model based on the target correspondence and target positional relationship. By using the known preset clothing piece and preset clothing model as an intermediary, the correspondence and relative positional relationship between the target clothing piece and the target clothing model can be directly determined. This eliminates the need for complex calculations on the target clothing piece and the target clothing model, thereby reducing the computational load of the wearing process for virtual clothing of different sizes.
[0075] Embodiment 2 of this application provides a virtual clothing wearing device, such as... Figure 5As shown, the system includes: a storage module 501, which stores a preset garment pattern, a preset garment model, and a preset positional relationship between the preset garment pattern and the preset garment model; a pattern mapping module 502, which determines the pattern reference point in the preset garment pattern corresponding to the target mesh point, where the target mesh point is a mesh point in the target garment pattern; a garment wearing module 503, which determines the model reference point in the preset garment model corresponding to the pattern reference point, and the reference point positional relationship between the pattern reference point and the model reference point, based on the preset positional relationship; a model mapping module 504, which constructs a model mapping between the target garment model and the preset garment model, and determines the target reference point in the target garment model corresponding to the model reference point based on the model mapping; the garment wearing module 503 is also used to construct a target correspondence between the target mesh point and the target reference point, and determine the target positional relationship between the target mesh point and the target reference point based on the reference point positional relationship, and wear the target garment pattern on the target garment model according to the target correspondence and the target positional relationship.
[0076] It is understood that the aforementioned Embodiment 1 is an embodiment of the method corresponding to Embodiment 2, and it can be implemented in a corresponding manner to Embodiment 2. The specific implementation methods in step S101 of Embodiment 1 can be implemented by the plate mapping module 502 in Embodiment 2, the specific implementation methods in step S103 of Embodiment 1 can be implemented by the model mapping module 504 in Embodiment 2, and the specific implementation methods in steps S104 and S102 of Embodiment 1 can be implemented by the clothing wearing module 503 in Embodiment 2. Compared with related technologies, in the virtual clothing wearing device provided in this embodiment 2, the plate reference point corresponding to the target grid point in the preset clothing plate is first determined in the plate mapping module 502, that is, the correspondence between the preset clothing plate and the target clothing plate is first constructed in the plate mapping module 502; then the clothing wearing module 503 can determine the model reference point corresponding to the plate reference point in the preset clothing model, as well as the reference point position relationship between the plate reference point and the model reference point, according to the preset position relationship between the preset clothing plate and the preset clothing model stored in the storage module 501. That is, the clothing wearing module 503 constructs the correspondence between the target clothing plate and the preset clothing model using the preset position relationship between the preset clothing plate and the preset clothing model stored in the storage module 501 as a medium; then the model mapping module 504 constructs the model mapping between the target clothing model and the preset clothing model; the clothing wearing module 503 can then determine the reference point corresponding to the target clothing plate and the model reference point in the preset clothing model according to the model mapping. The target reference point corresponds to the target clothing pattern. Since the clothing wearing module 503 has already established the correspondence between the target clothing pattern and the preset clothing model, as well as the model mapping between the preset clothing model and the target clothing model, the clothing wearing module 503 can use the preset clothing model as an intermediary to establish the correspondence between the target clothing pattern and the target clothing model. Specifically, it establishes the target correspondence between the target grid point and the target reference point, and determines the target position relationship between the target grid point and the target reference point based on the position relationship of the reference point. Finally, the target clothing pattern can be worn on the target clothing model according to the target correspondence and target position relationship. Using the known preset clothing pattern and preset clothing model as an intermediary, the correspondence and relative position relationship between the target clothing pattern and the target clothing model can be directly determined. There is no need to perform complex calculations on the target clothing pattern and the target clothing model to wear the target clothing pattern, thereby reducing the amount of computation in the process of wearing virtual clothing of different sizes.
[0077] Embodiment 3 of this application provides an electronic device, such as... Figure 6As shown, it includes: at least one processor 601; and a memory 602 communicatively connected to at least one processor 601; wherein the memory 602 stores instructions executable by at least one processor 601, the instructions being executed by at least one processor 601 to enable at least one processor 601 to perform the methods in the above embodiments.
[0078] The memory and processor are connected via a bus, which can include any number of interconnecting buses and bridges, connecting various circuits of one or more processors and memories. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and will not be described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over the wireless medium via an antenna, which further receives data and transmits it to the processor.
[0079] The processor manages the bus and general processing, and also provides various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory is used to store data used by the processor during operation.
[0080] Embodiment 4 of this application relates to a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the method embodiments described above.
[0081] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0082] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for wearing virtual clothing, characterized in that, The virtual garment-wearing method includes: (This is used to attach a target garment pattern onto a target garment model.) Determine the reference point of the preset garment pattern that corresponds to the target grid point, wherein the target grid point is the grid point in the target garment pattern; Based on the preset positional relationship between the preset garment pattern and the preset garment model, determine the model reference point in the preset garment model that corresponds to the reference point of the pattern, and the reference point positional relationship between the reference point of the pattern and the reference point of the model; Construct a model mapping between the target clothing model and the preset clothing model; Based on the model mapping, determine the target reference point in the target clothing model that corresponds to the model reference point; Construct a target correspondence between the target grid points and the target reference points, and determine the target positional relationship between the target grid points and the target reference points based on the positional relationship of the reference points. Then, put the target garment pattern on the target garment model according to the target correspondence and the target positional relationship.
2. The virtual clothing wearing method according to claim 1, characterized in that, The outer contour edge of the target garment pattern corresponds one-to-one with the outer contour edge of the preset garment pattern. Determining the reference point of the garment pattern in the preset garment pattern corresponding to the target grid point includes: The target garment pattern is scaled so that the lengths of the corresponding outer contour edges in the target garment pattern and the preset garment pattern are equal. The position parameters of the grid points on the outer contour edge of the target garment pattern before scaling are determined as the first position parameters, the position parameters of the grid points on the outer contour edge of the target garment pattern after scaling are determined as the second position parameters, and the position parameters of the internal grid points of the target garment pattern before scaling are determined as the third position parameters. The fourth position parameter is determined by scaling the internal grid points of the target garment pattern based on the first position parameter, the second position parameter, and the third position parameter. The point in the preset garment pattern whose position parameter is the same as the second position parameter or the fourth position parameter is determined as the reference point of the pattern.
3. The virtual clothing wearing method according to claim 2, characterized in that, The step of determining the scaled position parameters of the internal grid points of the target garment pattern as the fourth position parameter based on the first position parameter, the second position parameter, and the third position parameter includes: Substitute the first position parameter, the second position parameter, and the third position parameter into a preset function, and solve the preset function according to the preset constraint to obtain the fourth position parameter. The preset constraint is that the change in the internal angle of each triangular grid in the target clothing pattern is minimized before and after scaling.
4. The virtual clothing wearing method according to claim 3, characterized in that, The preset function is: Where T is the set of all triangular meshes t in the target garment pattern, i, j, k are the three vertices of the triangular mesh t, the vertices are the mesh points of the triangular mesh t, λ is the ratio of the sum of the outer contour side lengths of the target garment pattern to the sum of the outer contour side lengths of the preset garment pattern, u is the position parameter of the mesh point in the target garment pattern before deformation, and u is the position parameter of the mesh point in the target garment pattern after deformation; The step of solving the preset function according to preset constraints includes: Determine the u corresponding to the first position parameter and the third position parameter ti u tj u tk Determine the v corresponding to the second position parameter tj v ti v tk Substituting the first position parameter, the second position parameter, and the third position parameter into the preset function, the position parameter of the internal grid point that minimizes the E value is the fourth position parameter.
5. The virtual clothing wearing method according to claim 1, characterized in that, The target clothing model has the same topological structure as the preset clothing model, and the construction of the model mapping between the target clothing model and the preset clothing model includes: The face index is used to establish a one-to-one correspondence between the face of the target clothing model and the preset clothing model as the model mapping.
6. The virtual clothing wearing method according to claim 1, characterized in that, The topological structure of the target clothing model is inconsistent with that of the preset clothing model. The construction of the model mapping between the target clothing model and the preset clothing model includes: Construct a freely deformable initial baseline model; Adjust the shape and posture of the initial reference model to obtain the original reference model and the target reference model. The shape and posture of the original reference model are the same as the shape and posture of the preset clothing model, and the shape and posture of the target reference model are the same as the shape and posture of the target clothing model. Construct a first mapping relationship between the preset clothing model and the original benchmark model, and construct a second mapping relationship between the target clothing model and the target benchmark model; The model mapping is constructed based on the first mapping relationship and the second mapping relationship.
7. The virtual clothing wearing method according to claim 6, characterized in that, The initialization reference model includes a surface polygonal mesh composed of multiple mesh elements. Adjusting the shape and orientation of the initialization reference model to obtain the original reference model and the target reference model includes: Adjust the position, shape, and size of each mesh unit so that the shape and orientation of the surface polygon mesh are the same as the shape and orientation of the preset clothing model, thus obtaining the original reference model; The position, shape, and size of each mesh unit are adjusted so that the shape and orientation of the surface polygon mesh are the same as the shape and orientation of the target clothing model, thus obtaining the target reference model.
8. A virtual clothing wearing device, characterized in that, include: A storage module is used to store a preset garment pattern, a preset garment model, and a preset positional relationship between the preset garment pattern and the preset garment model. A plate mapping module is used to determine the plate reference point in a preset garment plate that corresponds to the target grid point, wherein the target grid point is a grid point in the target garment plate. The clothing wearing module is used to determine, according to the preset positional relationship, the model reference point corresponding to the plate reference point in the preset clothing model, and the reference point positional relationship between the plate reference point and the model reference point; A model mapping module is used to construct a model mapping between the target clothing model and the preset clothing model, and to determine the target reference point in the target clothing model corresponding to the model reference point based on the model mapping; The clothing wearing module is also used to construct the target correspondence between the target grid point and the target reference point, and to determine the target position relationship between the target grid point and the target reference point according to the position relationship of the reference point, and to wear the target clothing piece on the target clothing model according to the target correspondence and the target position relationship.
9. An electronic device, characterized in that, include: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the virtual clothing wearing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by a processor to implement the virtual clothing wearing method according to any one of claims 1 to 7.