CN107464289B - Virtual clothing wearing method, device, equipment and storage medium - Google Patents

Virtual clothing wearing method, device, equipment and storage medium Download PDF

Info

Publication number
CN107464289B
CN107464289B CN201710657291.5A CN201710657291A CN107464289B CN 107464289 B CN107464289 B CN 107464289B CN 201710657291 A CN201710657291 A CN 201710657291A CN 107464289 B CN107464289 B CN 107464289B
Authority
CN
China
Prior art keywords
vertex
clothing
garment
standard
virtual object
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710657291.5A
Other languages
Chinese (zh)
Other versions
CN107464289A (en
Inventor
吴松城
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Black Mirror Technology Co., Ltd.
Original Assignee
Xiamen Black Mirror Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Black Mirror Technology Co ltd filed Critical Xiamen Black Mirror Technology Co ltd
Priority to CN201710657291.5A priority Critical patent/CN107464289B/en
Publication of CN107464289A publication Critical patent/CN107464289A/en
Application granted granted Critical
Publication of CN107464289B publication Critical patent/CN107464289B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/006Mixed reality

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Display Devices Of Pinball Game Machines (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the application discloses a virtual clothing wearing method, which comprises the steps of obtaining theoretical change positions of all vertexes of a first clothing through deformation scale values of a target virtual object relative to a standard virtual object and standard positions of all vertexes of the first clothing; and then, constructing a first objective function according to the difference between the theoretical change position and the actual change position of each vertex of the first clothing and a preset rule to obtain the actual change position of the first clothing. According to the method, the actual change positions of all the vertexes of the first garment are obtained by the method for solving the first objective function, the target virtual object wearing the first garment can be obtained without multiple iterations, the algorithm is simple, the calculation time is reduced, and the calculation efficiency is improved.

Description

Virtual clothing wearing method, device, equipment and storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a virtual clothing wearing method, apparatus, device, and storage medium.
Background
The virtual clothing wearing technology based on the three-dimensional space model refers to wearing clothing and/or ornaments on a virtual object, and the technology is widely applied at present. For example, if a user sees a certain piece of clothing during an online shopping process and wants to know how the user wears the clothing before purchasing, the online shopping platform may provide a virtual fitting service for the user, that is, a corresponding three-dimensional virtual character model is generated through body type information provided by the user, and then the three-dimensional model of the clothing selected by the user is synthesized with the three-dimensional virtual character model of the user, so as to simulate the effect of the user "wearing" the clothing, thereby helping the user make a purchasing decision. For another example, in the virtual game, the user can optionally select the sex, the physical characteristics and the decorations of the virtual character, a three-dimensional character model can be obtained according to the sex and the physical characteristics, and the selected clothes correspond to the three-dimensional clothes model. The virtual character image which the user wants to obtain can be presented by synthesizing the three-dimensional virtual character model and the three-dimensional clothing model by utilizing the virtual clothing wearing technology.
Virtual wear is most important to ensure that the fit and lack of penetration between the apparel and the virtual object. Existing virtual apparel wearing technologies typically employ irregular object-based collision detection algorithms to achieve the above objectives. Firstly, dividing irregular and complete clothes into a plurality of clothes fragments, wherein each clothes fragment is surrounded by a first cuboid object, and the sizes of the first cuboid objects corresponding to the clothes fragments can be the same or different. Similarly, the irregular and complete virtual object is also divided into a plurality of virtual object fragments, each virtual object fragment is surrounded by a second cuboid object, and the sizes of the second cuboid objects corresponding to the virtual object fragments can be the same or different.
Next, traversing the first cuboid objects surrounding the apparel piece, for each first cuboid object traversed, performing the step of determining whether the first cuboid object and all the second cuboid objects overlap, if so, moving the first cuboid object such that the first cuboid object and all the second cuboid objects do not overlap. Simultaneously, in order to make dress laminating virtual object, on the basis of guaranteeing first cuboid object and second cuboid object nonoverlapping, still need to guarantee that first cuboid object can not be too far away with holistic virtual object distance, if too far away, also need move first cuboid object to the suitable position that is close to virtual object.
Since each time a first cuboid object is moved, it may affect the movement of the positions of other first cuboid objects, so that each time a first cuboid object is moved, all first cuboid objects need to be traversed again until all first cuboid objects and all second cuboid objects are non-overlapping and have a suitable distance.
Therefore, multiple iterations are needed for virtual clothing wearing based on an irregular collision detection algorithm, the algorithm is high in complexity, long in calculation time and low in efficiency.
Disclosure of Invention
In order to solve the problems that in the prior art, virtual clothing wearing is carried out based on an irregular collision detection algorithm, the algorithm is high in complexity, the calculation time is long, and the efficiency is low, the application provides a virtual clothing wearing method, a virtual clothing wearing device, equipment and a storage medium, the calculation time for virtual clothing wearing is shortened, the calculation efficiency is improved, and the visual effect of virtual clothing wearing is guaranteed.
The embodiment of the application provides a virtual clothing wearing method, which comprises the following steps:
acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, wherein the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment;
obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
Optionally, the method further includes:
and synthesizing the first clothing and the target virtual object by using the actual change positions of the vertexes of the first clothing and the positions of the vertexes of the target virtual object to obtain the target virtual object wearing the first clothing.
Optionally, the preset rule at least includes one of the following rules:
a first rule:
changing the size of the first garment from the standard position to the actual change position at each vertex of the first garment, wherein the first garment is similar in shape;
the second rule is as follows:
the first apparel formed from the actual changing positions of the vertices of the first apparel is smooth.
Optionally, if there is a second clothing besides the first clothing, obtaining the theoretical change position of each vertex of the first clothing according to the standard position of each vertex of the first clothing and the deformation scale value includes:
and obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment, the deformation scale value and a first adaptive parameter value, wherein the first adaptive parameter value represents the scale which needs to be adjusted for adapting to the second garment of the first garment.
Optionally, the synthesizing, by using the actual change position of each vertex of the first clothing and the position of each vertex of the target virtual object, the first clothing and the target virtual object includes:
acquiring the standard position of each vertex of the second clothing, wherein the standard position of each vertex of the second clothing is the position of each vertex of the second clothing when the standard virtual object wears the second clothing;
obtaining the theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing and the deformation scale value;
constructing a second objective function according to the difference between the theoretical change position of each vertex of the second clothing and the actual change position of each vertex of the second clothing and a preset rule, and obtaining the actual change position of the second clothing when the second objective function meets a second preset condition, wherein the actual change position of the second clothing is matched with the position of the target virtual object wearing the first clothing;
synthesizing the first clothing, the second clothing and the target virtual object by using the actual change positions of the vertexes of the first clothing, the actual change positions of the vertexes of the second clothing and the positions of the vertexes of the target virtual object to obtain the target virtual object wearing the first clothing and the second clothing.
Optionally, the obtaining the theoretical variation position of each vertex of the second clothing according to the standard position of each vertex of the second clothing and the deformation scale value includes:
and obtaining the theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing, the deformation scale value and a second adaptive parameter value, wherein the second adaptive parameter value represents the scale which needs to be adjusted for adapting to the first clothing of the second clothing.
Optionally, the obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment, the deformation scale value, and the first adaptive parameter value includes:
determining the vertex overlapped with the second clothing in the first clothing according to the standard position of each vertex of the first clothing and the standard position of each vertex of the second clothing to form a first vertex set;
and obtaining the theoretical change position of each vertex in the first vertex set according to the standard position of each vertex in the first vertex set, the deformation scale value and the first adaptive parameter value.
Optionally, the obtaining the theoretical variation position of each vertex of the second clothing according to the standard position of each vertex of the second clothing, the deformation scale value, and the second adaptive parameter value includes:
determining the vertex overlapped with the first clothing in the second clothing according to the standard position of each vertex of the first clothing and the standard position of each vertex of the second clothing to form a second vertex set;
and obtaining the theoretical change position of each vertex in the second vertex set according to the standard position of each vertex in the second vertex set, the deformation scale value and the second adaptive parameter value.
Optionally, the obtaining of the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value includes:
acquiring the position of each vertex of the standard virtual object;
determining a third vertex set corresponding to each vertex of the first garment according to the standard position of each vertex of the first garment and the positions of each vertex of the standard virtual object, wherein the third vertex set is a vertex of the standard virtual object, the distance between which and the vertex of the first garment meet preset conditions;
determining the position of a central point corresponding to each vertex of the first clothing according to the position of each vertex in the third vertex set;
and obtaining the theoretical change position of the vertex of the first garment according to the position of the central point, the distance between the vertex of the first garment and the central point and the deformation scale value.
Optionally, the obtaining the theoretical variation position of each vertex of the second clothing according to the standard position of each vertex of the second clothing and the deformation scale value includes:
determining a fourth vertex set corresponding to each vertex of the second clothing according to the standard position of each vertex of the second clothing and the position of each vertex of the standard virtual object, wherein the fourth vertex set is a vertex of the standard virtual object, the distance between which and the vertex of the second clothing meets a preset condition;
determining the position of a central point corresponding to each vertex of the second clothing according to the position of each vertex in the fourth vertex set;
and obtaining the theoretical change position of the vertex of the second clothing according to the position of the central point, the distance between the vertex of the second clothing and the central point and the deformation scale value.
Optionally, the determining, according to the standard positions of the vertices of the first garment and the standard positions of the vertices of the second garment, the vertex of the first garment that overlaps with the second garment, and forming the first vertex set includes:
taking the intersection of the fifth vertex set and the sixth vertex set as the seventh vertex set; the fifth vertex set is a set formed by combining all the third vertex sets, and the sixth vertex set is a set formed by combining all the fourth vertex sets;
and taking a set formed by the vertexes of the first garment corresponding to all the vertexes in the seventh vertex set as the first vertex set.
Optionally, the determining, according to the standard positions of the vertices of the first garment and the standard positions of the vertices of the second garment, the vertex of the second garment that overlaps with the first garment, and forming a second vertex set includes:
and taking a set formed by the vertexes of the second clothes corresponding to all the vertexes in the seventh vertex set as the second vertex set.
The embodiment of the application provides a virtual dress dresses and dresses device, the device includes:
the system comprises an acquisition unit, a processing unit and a control unit, wherein the acquisition unit is used for acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, and the standard position of each vertex of the first garment is the position of each vertex of the first garment when the standard virtual object wears the first garment;
the first determining unit is used for obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and the second determining unit is used for constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
Optionally, the apparatus further comprises:
and the synthesizing unit is used for synthesizing the first clothing and the target virtual object by utilizing the actual change position of each vertex of the first clothing and the position of each vertex of the target virtual object to obtain the target virtual object wearing the first clothing.
Optionally, the preset rule at least includes one of the following rules:
a first rule:
changing the size of the first garment from the standard position to the actual change position at each vertex of the first garment, wherein the first garment is similar in shape;
the second rule is as follows:
the first apparel formed from the actual changing positions of the vertices of the first apparel is smooth.
Optionally, if there is a second garment in addition to the first garment, the first determining unit includes:
and the first determining subunit is configured to obtain a theoretical change position of each vertex of the first clothing according to the standard position of each vertex of the first clothing, the deformation scale value, and a first adaptive parameter value, where the first adaptive parameter value represents a scale that needs to be adjusted for adapting to the second clothing.
Optionally, the synthesizing unit includes:
a second obtaining unit, configured to obtain a standard position of each vertex of the second garment, where the standard position of each vertex of the second garment is a position where each vertex of the second garment is located when the standard virtual object wears the second garment;
the third determining unit is used for obtaining the theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing and the deformation scale value;
a fourth determining unit, configured to construct a second objective function according to a difference between the theoretical change position of each vertex of the second clothing and the actual change position of each vertex of the second clothing and a preset rule, and obtain an actual change position of the second clothing when the second objective function meets a second preset condition, where the actual change position of the second clothing matches a position of the target virtual object wearing the first clothing;
and the first synthesizing subunit is configured to synthesize the first garment, the second garment, and the target virtual object by using the actual change position of each vertex of the first garment, the actual change position of each vertex of the second garment, and the position of each vertex of the target virtual object, so as to obtain the target virtual object wearing the first garment and the second garment.
Optionally, the third determining unit includes:
and the third determining subunit is configured to obtain a theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing, the deformation scale value, and a second adaptive parameter value, where the second adaptive parameter value represents a scale that needs to be adjusted for adapting to the first clothing.
Optionally, the first determining subunit includes:
the first forming unit is used for determining the vertexes of the first clothing, which are overlapped with the second clothing, according to the standard positions of the vertexes of the first clothing and the standard positions of the vertexes of the second clothing to form a first vertex set;
and the first determining module is used for obtaining the theoretical change position of each vertex in the first vertex set according to the standard position of each vertex in the first vertex set, the deformation scale value and the first adaptive parameter value.
Optionally, the third determining subunit includes:
the second forming unit is used for determining the vertexes of the second clothing, which are overlapped with the first clothing, according to the standard positions of the vertexes of the first clothing and the standard positions of the vertexes of the second clothing to form a second vertex set;
and the second determining module is used for obtaining the theoretical change position of each vertex in the second vertex set according to the standard position of each vertex in the second vertex set, the deformation scale value and the second adaptive parameter value.
Optionally, the first determining unit includes:
a third obtaining unit, configured to obtain positions of vertices of the standard virtual object;
a fourth determining subunit, configured to determine, according to the standard position of each vertex of the first clothing and the positions of each vertex of the standard virtual object, a third vertex set corresponding to each vertex of the first clothing, where the third vertex set is a vertex of the standard virtual object whose distance from the vertex of the first clothing satisfies a preset condition;
a fifth determining subunit, configured to determine, according to the position of each vertex in the third vertex set, a position of a central point corresponding to the vertex of the first clothing;
and a sixth determining subunit, configured to obtain a theoretical change position of the vertex of the first garment according to the position of the central point, the distance between the vertex of the first garment and the central point, and the deformation scale value.
Optionally, the third determining unit includes:
a seventh determining subunit, configured to determine, according to the standard position of each vertex of the second clothing and the positions of each vertex of the standard virtual object, a fourth vertex set corresponding to each vertex of the second clothing, where the fourth vertex set is a vertex of the standard virtual object whose distance from the vertex of the second clothing satisfies a preset condition;
an eighth determining subunit, configured to determine, according to the position of each vertex in the fourth vertex set, a position of a central point corresponding to the vertex of the second clothing;
and the ninth determining subunit is used for obtaining the theoretical change position of the vertex of the second clothing according to the position of the central point, the distance between the vertex of the second clothing and the central point and the deformation scale value.
Optionally, the first forming unit sets an intersection of a fifth vertex set and a sixth vertex set as the seventh vertex set; the fifth vertex set is a set formed by combining all the third vertex sets, and the sixth vertex set is a set formed by combining all the fourth vertex sets;
and taking a set formed by the vertexes of the first garment corresponding to all the vertexes in the seventh vertex set as the first vertex set.
Optionally, the second forming unit takes a set formed by vertices of the second garment corresponding to each vertex in the seventh vertex set as the second vertex set.
An embodiment of the present application provides an electronic device, which includes:
a processor and a memory storing a program;
wherein the processor, when executing the program, performs the following:
acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, wherein the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment;
obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
An embodiment of the present application further provides a storage medium for storing a program, where the program, when executed, causes an electronic device to:
acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, wherein the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment;
obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
According to the method, theoretical change positions of all vertexes of a first garment are obtained through deformation scale values of a target virtual object relative to a standard virtual object and standard positions of all vertexes of the first garment; and then, constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, and obtaining the actual change position of the first clothing when the first objective function meets a first preset condition. When the first clothes are worn by the target virtual object, the actual change positions of all vertexes of the first clothes are calculated by solving the first objective function, repeated iteration is not needed, the algorithm is simple, the calculation time is shortened, and the calculation efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a virtual clothing wearing method provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of calculating a theoretical variation position of each vertex of the first clothing according to the embodiment of the present application;
fig. 3 is a schematic flowchart of synthesizing a first garment and a target virtual object according to an embodiment of the present application;
fig. 4 is a schematic flowchart of calculating a theoretical variation position of each vertex of the second clothing according to the embodiment of the present application;
fig. 5 is a block diagram of a virtual clothing wearing apparatus provided in the embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, the figure is a flowchart of a virtual clothing wearing method provided in the embodiment of the present application.
The virtual clothing wearing method provided by the embodiment comprises the following steps:
s101, obtaining a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, wherein the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment.
The standard virtual object may be a virtual object that is not deformed. The virtual object may be a virtual model, such as a virtual human model, or a virtual animal model. In this embodiment, the standard virtual object may be constructed based on a three-dimensional space coordinate system, and the standard virtual object may be composed of a plurality of vertices, and each vertex may have its own position in the three-dimensional space coordinate system.
The target virtual object may be a virtual object that is deformed relative to a standard virtual object, in this embodiment, taking the target virtual object as a human, the standard virtual object may be set according to a standard body type of the human, and the target virtual object may be set to have a different body type according to needs, so that the deformation may be that the body type of the target virtual object is enlarged or reduced relative to the standard virtual object, or the shoulder width is widened, etc. The deformation may be represented by: the position of the vertex on the target virtual object is changed by a positional difference from the position of the corresponding vertex on the standard virtual object. The deformation degree can be represented by a deformation scale value, and the deformation scale value of the target virtual object can be one or multiple, for example, different positions correspond to different deformation scale values.
In this embodiment, the first accessory may also be constructed based on a three-dimensional coordinate system, and the first accessory may be composed of a plurality of vertices, and each vertex may have its own position in the three-dimensional coordinate system. The first article of clothing may be clothing, such as clothes, pants, gloves, hats, shoes, etc., or may be an article of apparel, such as a necklace, a ring, headwear, etc.
S102, obtaining theoretical change positions of all vertexes of the first garment according to the standard positions of all vertexes of the first garment and the deformation scale values.
If the first clothing is worn on the standard virtual object, and the wearing needs to enable the first clothing and the target virtual object to be attached and not to penetrate through, the position of each vertex of the first clothing can be defined as the standard position of each vertex of the first clothing; if the first garment is worn on the target virtual object, in order to make the first garment fit and not penetrate through the target virtual object, the positions of the vertices of the first garment may be changed relative to the standard positions of the vertices of the first garment so as to match the positions of the vertices on the target virtual object. The variation of each vertex of the first garment can be determined according to the deformation scale value, and then the theoretical variation position of each vertex of the first garment is calculated according to the standard position of each vertex of the first garment and the deformation scale value.
Referring to fig. 2, fig. 2 is a schematic flow chart illustrating a process of calculating theoretical variation positions of vertices of the first garment. S102 may include:
s201, acquiring the position of each vertex of the standard virtual object.
S202, determining a third vertex set corresponding to each vertex of the first garment according to the standard position of each vertex of the first garment and the positions of each vertex of the standard virtual object, wherein the third vertex set is a vertex of the standard virtual object, and the distance between the third vertex set and the vertex of the first garment meets a preset condition.
As an example, the third vertex set may be derived by a neighbor algorithm, which may also be referred to as a K-nearest neighbor (KNN) classification algorithm. The KNN classification may be classified by measuring distances between different feature values. The algorithm, given a training data set, finds K instances (i.e., the K neighbors mentioned above) in the training data set that are closest to the instance for a new input instance, and classifies the input instance into a class if most of the K instances belong to the class. The new input instance may be each vertex on the first ornament, and the K most adjacent instances of that instance may be a third set of vertices. The preset condition may be that a vertex on the standard virtual object is closest to the vertex of the first garment. In this embodiment, for each vertex on the first apparel, the first K vertices (i.e., the closer vertices in the three-dimensional space coordinate system) that are closest to the vertex of the first apparel are obtained on the standard virtual object by using the KNN classification algorithm, respectively, to form a third vertex set.
S203, determining the position of the central point corresponding to each vertex of the first clothing according to the positions of the vertices in the third vertex set.
The number of vertices in the third vertex set is not limited, and the third vertex set may have 1 vertex or a plurality of vertices. When the third vertex set has 1 vertex, the center point corresponding to the vertex of the first service is the vertex; when there are multiple vertices in the third vertex set, for example, 4 vertices, the positions of the center points of the 4 vertices may be calculated according to the positions of the 4 vertices.
S204, obtaining the theoretical change position of the vertex of the first garment according to the position of the central point, the distance between the vertex of the first garment and the central point and the deformation scale value.
It should be noted that, in the implementation, since the target virtual object wears different strategies, that is, only the first clothing may be worn by the target virtual object and the first clothing fits the target virtual object, or other clothing may be worn on the inner layer and/or the outer layer of the first clothing in addition to the first clothing, the method for calculating the theoretical change position of the vertex of the first clothing according to S204 may also be slightly different. The strategy of wearing clothes by the target virtual object specifically comprises the following conditions: the first apparel may be the innermost layer and no other apparel outside; possibly, the clothes are worn on the innermost layer and other clothes are arranged outside; it is also possible to wear the outermost layer with other apparel inside; it is also possible to wear the middle-most layer with other apparel inside and other apparel outside.
As an example, when a first garment is worn on the innermost layer and no other garment is on the outside, the formula for calculating the theoretical change position of the vertex of the first garment may be:
Figure BDA0001369627210000131
wherein the content of the first and second substances,
Figure BDA0001369627210000132
representing the theoretical change position of each vertex of the first clothes; vcenterRepresenting the positions of the central points corresponding to all the vertexes on the first garment; dcenterRepresenting a distance of the vertex of the first garment from the center point; scale (V)humanModel) Representing the deformation scale value. Scale (V) when the deformation scale value is not largehumanModel) The value may be 1.0. And when the deformation scale value is larger, determining the deformation scale value according to the actual deformation degree.
When the target virtual object wears clothes, other clothes besides the first clothes are worn on the inner layer and/or the outer layer of the first clothes, the calculation method of the theoretical change position of the vertex of the first clothes will be described later.
S103, constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, and obtaining the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
The theoretical change positions of the vertices of the first garment are the change positions of the vertices of the first garment when the target virtual object wears the first garment, which are calculated according to known conditions, and the actual change positions of the vertices of the first garment are finally obtained in this embodiment, and can be used to obtain the target virtual object wearing the first garment, so as to ensure the visual effect of virtual garment wearing. In practical application, a first objective function can be constructed by using the difference, so that the actual change position of each vertex of the first garment can be obtained by solving through the first objective function in the step.
As an example, the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing can be expressed by a formula:
Figure BDA0001369627210000133
wherein, Vtarget1The actual changing position of each vertex of the first ornament,
Figure BDA0001369627210000134
representing the theoretical variation position of each vertex of the first dress, E3Represents for all vertices Vtarget1And
Figure BDA0001369627210000135
modulo summation of the difference.
In this embodiment, the preset rule may include at least one of the following two rules:
the first preset rule is as follows: and changing the size of the first clothing from the standard position to the actual change position at each vertex of the first clothing, wherein the first clothing is similar in shape.
The first accessory may change in size according to a deformation scale value of the target virtual object, for example, if the target virtual object is tall and big relative to the standard virtual object, the first accessory may be correspondingly enlarged in order to make the first accessory fit on the target virtual object. However, the change of the first garment may be a change of the first garment in a size increase or a size decrease, that is, a change in a direction in which the shape of the first garment is scaled, so as to avoid a type of deformation such as a left-right twist as much as possible. As an example, the first preset rule may be formulated as:
E1=∑||Q-QE||
and Q represents that the first clothes are worn on the target virtual object, the size of the first clothes is changed, and the first clothes deform when the shape of the first clothes is similar to the shape of the first clothes.
Figure BDA0001369627210000141
V=[v2-v1,v3-v1,v4-v1],
Figure BDA0001369627210000142
v1、v2And v3The standard position coordinates of the vertices of the triangular face of the first garment are respectively, the triangular face can be composed of three vertices, the three vertices are not any three vertices but three vertices for assembling the first garment, namely, the triangular face of the first garment is used for assembling the first garment. Each side of a triangular face has only two vertexes. When the size of the first clothes changes, the first clothes can be regarded as that each triangular surface is realized through movement, so the deformation degree of the size of the first clothes can be represented by the movement amplitude of each triangular surface. v. of4Is a standard position coordinate of a vertex on the unit normal direction of the first triangular surface;
Figure BDA0001369627210000143
and
Figure BDA0001369627210000144
triangular face tops each being a target virtual object to be worn with a first garmentThe actual position coordinates of the point or points,
Figure BDA0001369627210000145
is the actual position coordinates of the apex in the unit normal direction of the triangular face of the target virtual object wearing the first garment. QERepresenting deformations of the target virtual object, QEMay be:
Figure BDA0001369627210000146
wherein scale represents the deformation scale value of the target virtual object, scale and scale (V)humanModel) Are meant to be the same. scale may take a value greater than 1, e.g., the target virtual object is tall relative to the standard virtual object; a value smaller than 1 may also be taken, for example, the target virtual object is slim relative to the standard virtual object; it is also possible to take a value equal to 1. If the deformation of the target virtual object is global, then Q is calculatedEThen, all scales are the same; if the deformation of the target virtual object is localized, e.g., the upper body of the target virtual object is fat relative to the standard virtual object and the lower body is of the standard body type, then Q is calculated for the upper bodyEAnd calculating the Q of the lower bodyEThe scale values may be different.
E1Representing Q and Q corresponding to all triangular faces respectivelyEModulo summation of the difference.
With reference to the above idea, the first objective function may be determined according to a difference between a theoretical change position of each vertex of the first clothing and an actual change position of each vertex of the first clothing, and the first preset rule.
The second rule is as follows: the first apparel formed from the actual changing positions of the vertices of the first apparel is smooth.
In this embodiment, the purpose of the smoothing of the first clothing is to avoid the phenomenon that the obtained actual changing positions of the vertexes of the first clothing are crowded together. The first clothes can be smoothed by adopting triangular faces, and if each pair of adjacent triangular faces is smooth, the first clothes formed by splicing are also smooth. The adjacent triangular surfaces refer to two triangular surfaces with one edge overlapped.
As an example, a first garment may be smoothed using a difference between a degree of deformation of a first triangular face and a degree of deformation of a second triangular face of the first garment, the first and second triangular faces being faces composed of respective three vertices, the first and second triangular faces being used to piece together the first garment, the first and second triangular faces being adjacent triangular faces.
The expression smoothing the first decoration may be:
Figure BDA0001369627210000151
where n ═ adj (m) denotes that the triangular face n of the first garment is adjacent to the triangular face m of the first garment, and Q denotes that the triangular face n of the first garment is adjacent to the triangular face m of the first garmentmQ (mentioned above) corresponding to the triangular surface m is shown, QnDenotes Q (mentioned above), N, corresponding to the triangular face NTriangleThe number of triangular faces of the first garment is indicated. E2Representing Q corresponding to all triangular facesmAnd QnModulo summation of the difference.
In order to embody the above idea, the objective function may be determined according to a difference between a theoretical change position of each vertex of the first garment and an actual change position of each vertex of the first garment, and the second preset rule.
In this embodiment, the two methods may be adopted, that is, the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing is utilized, and one of the two preset rules is utilized to determine the first objective function, so as to solve the actual change position of the first clothing. The difference between the theoretical change position of each vertex of the first ornament and the actual change position of each vertex of the first ornament can be utilized, and two preset rules are simultaneously used for determining the first objective function. For example, a first objective function can be obtained:
E=β1E12E23E3
wherein, beta1、β2、β3Are respectively an objective function E1、E2、E3The weight of (c). For different target virtual objects, can be for beta1、β2、β3Setting different values to make the visual effect of the target virtual object wearing the first dress better after synthesis.
It is to be understood that the design of the two rules and the objective function corresponding to each rule do not constitute a limitation of the present application, and those skilled in the art may design the rules and the objective functions corresponding to the rules according to specific situations.
In this embodiment, the first preset condition may be to minimize the first objective function, that is, when the first objective function is minimized, the actual change position of each vertex of the first clothing at that time is solved. The minimum value may be slightly larger than the minimum value, and the present application is not limited thereto.
According to the method, theoretical change positions of all vertexes of a first garment are obtained through deformation scale values of a target virtual object relative to a standard virtual object and standard positions of all vertexes of the first garment; then, constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, and obtaining the actual change position of the first clothing when the first objective function meets a first preset condition; and finally, synthesizing the first clothing and the target virtual object by using the actual change position of each vertex of the first clothing and the position of each vertex of the target virtual object to obtain the target virtual object wearing the first clothing. When the first clothes are worn by the target virtual object, the actual change positions of all vertexes of the first clothes are calculated by solving the first objective function, repeated iteration is not needed, the algorithm is simple, the calculation time is shortened, and the calculation efficiency is improved.
In this embodiment, after the actual change positions of the vertices of the first garment are determined, the target virtual object wearing the first garment may be obtained according to the actual change positions of the vertices of the first garment and the positions of the vertices of the target virtual object. Specifically, the actual change position of each vertex of the first clothing and the position of each vertex of the target virtual object may be utilized to synthesize the first clothing and the target virtual object, so as to obtain the target virtual object wearing the first clothing.
In this embodiment, the actual change position of each vertex of the first clothing and the position of each vertex of the target virtual object are determined, and the position data of each vertex of the two parts are synthesized to obtain the position data of all the vertices of the target virtual object wearing the first clothing, so that the target virtual object wearing the first clothing can be obtained.
The above embodiments describe specific methods for obtaining a target virtual object wearing a first garment when the target virtual object is wearing the first garment. In addition to the first apparel, the target virtual object may also wear second apparel, which may be clothing, such as, for example, clothing, pants, gloves, hats, shoes, etc., or accessories, such as, for example, necklaces, rings, headwear, etc. The second garment may be one piece or multiple pieces. If a second article of apparel is present in addition to the first article of apparel, the first article of apparel and the second article of apparel may overlap, thereby deforming the first article of apparel. For example, if the first garment is a jacket and the second garment is pants, there is a possibility that the jacket is laid under the pants, which may cause the jacket and the pants to overlap near the waist, and the clothes may be deformed by the compression of the pants. In view of the deformation of the first garment caused by the overlapping of the first garment and the second garment, the S102 may include: and obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment, the deformation scale value and a first adaptive parameter value, wherein the first adaptive parameter value represents the scale which needs to be adjusted for adapting to the second garment of the first garment.
It should be noted that, the first fitting parameter value represents a dimension that the first garment needs to be adjusted to fit the second garment. It is to be understood that the first adaptive parameter value is for a vertex of the overlapping portion of the first garment and the second garment. Therefore, the theoretical change position of each vertex of the first garment is obtained according to the standard position of each vertex of the first garment, the deformation scale value and the first adaptive parameter value. One possible implementation is: firstly, determining vertexes (on a standard virtual object) overlapped with the second dress in the first dress according to the standard positions of the vertexes of the first dress and the standard positions of the vertexes of the second dress to form a first vertex set; and then, obtaining the theoretical change position of each vertex in the first vertex set according to the standard position of each vertex in the first vertex set, the deformation scale value and the first adaptive parameter value.
When the target virtual object wears a second garment in addition to the first garment, the formula for calculating the theoretical change positions of the vertices of the first garment overlapped with the second garment may be changed to:
Figure BDA0001369627210000171
wherein scale' may be used as the first adaptive parameter value. When the theoretical change positions of the vertexes of the first clothing are determined by using the first adaptive parameter values, the selection of the first adaptive parameter values is related to a strategy of wearing the clothing, namely the wearing position of the first clothing.
As an example, the target virtual object wears three layers of clothes, each layer of clothes has a default interval m, when the clothes are worn, enough interval between the clothes is met to ensure that the clothes cannot be crossed, and when the clothes are extruded and deformed, the clothes are adjusted to ensure the visual effect. Thus, when a first garment is worn on the innermost layer and a second garment is worn on the outside, the first garment is subjected to a certain compression, and therefore the theoretical change position of each vertex in the first set of vertices can be adjusted by a first adaptation parameter value, e.g. a first adaptationThe parameter value scale' is (1+ m × n), n represents the degree to which the first garment is adjusted due to the compression, and n may be adjusted according to the number of pieces of the second garment on the outer layer of the first garment, i.e., may be decreased as the number of pieces of the second garment on the outer layer of the first garment increases. While other vertices of the first garment that do not overlap the second garment, i.e., vertices outside of the first set of vertices, may still be used
Figure BDA0001369627210000181
The theoretical change position is calculated.
When the first garment is worn on the outermost layer and the second garment is worn inside, for each vertex of the first garment overlapping the second garment, in order to satisfy the interval m between the garments, it can be adjusted by a first adaptive parameter value, for example, the first adaptive parameter value may be (1+ m × s), and s is the number of pieces of the second garment plus 1. Since the second garment is pressed by the first garment while inside, there is a corresponding second adaptive parameter value. The first adaptive value may also be determined based on a second adaptive parameter value scale "for the second garment. For example, if the second adaptive parameter value scale "of the second clothing closest to the first clothing is (1+ m × n '), and n ' represents the degree to which the second clothing is adjusted, the first adaptive parameter value may be (1+ m × s × n ').
When the first clothes are worn on the middle layer and the second clothes exist inside and outside, in the formula for calculating the theoretical change positions of the vertexes of the first clothes, the first adaptive parameter value needs to consider the extrusion of the second clothes on the outer layer and the layer number of the second clothes on the inner layer. For the part overlapped with the inner layer, the visual effect is not influenced due to the intersection, and a first adaptive parameter value can be selected according to the first clothes in the innermost layer; for portions not covered by the second garment of the outer layer, the first adaptive parameter value may be selected as the first garment is outermost.
When the target virtual object wears both the first garment and the second garment, refer to fig. 3, which is a schematic flow chart of the synthesis of the first garment and the target virtual object provided in the embodiment of the present application. Synthesizing the first clothing and the target virtual object to obtain the target virtual object wearing the first clothing may include, for example, the following steps:
s301, obtaining the standard position of each vertex of the second clothing, wherein the standard position of each vertex of the second clothing is the position of each vertex of the second clothing when the standard virtual object wears the second clothing.
In this embodiment, the second clothing may also be constructed based on a three-dimensional coordinate system, and the second clothing may be composed of a plurality of vertices, and each vertex may have its own position in the three-dimensional coordinate system.
S302, obtaining the theoretical change position of each vertex of the second clothes according to the standard position of each vertex of the second clothes and the deformation scale value.
When calculating the theoretical change position of each vertex of the second clothing, the calculation formula and the calculation method for calculating the theoretical change position of each vertex of the first clothing can be referred to, firstly, the standard position of each vertex of the second clothing is obtained, then, the standard position of each vertex of the second clothing is correspondingly changed according to the deformation scale value of the target virtual object relative to the standard virtual object, and further, the theoretical change position of each vertex of the second clothing is obtained.
Referring to fig. 4, fig. 4 shows a schematic flow chart of calculating the theoretical variation positions of vertices of the second garment. S302 may include:
s401, determining a fourth vertex set corresponding to each vertex of the second clothing according to the standard position of each vertex of the second clothing and the position of each vertex of the standard virtual object, wherein the fourth vertex set is a vertex of the standard virtual object, and the distance between the vertex of the second clothing and the vertex of the standard virtual object meets a preset condition.
As an example, the fourth vertex set may be found according to a KNN classification algorithm, and the preset condition may be that a vertex on the standard virtual object is closest to the vertex of the second garment. In this embodiment, the KNN classification algorithm may be understood as that, a three-dimensional data point set exists on both the second garment and the standard virtual object, and according to each vertex on the second garment, on the standard virtual object, a fourth vertex set which is matched with each vertex on the second garment and is closer to the vertex is obtained by using the KNN classification algorithm.
S402, determining the position of the central point corresponding to each vertex of the second clothing according to the position of each vertex in the fourth vertex set.
The number of vertices in the fourth vertex set is not limited, and the fourth vertex set may have 1 vertex or a plurality of vertices. When the fourth vertex set has 1 vertex, the central point corresponding to the vertex of the first service is the vertex; when there are multiple vertices in the fourth vertex set, for example, 4 vertices, the positions of the center points of the 4 vertices may be calculated according to the positions of the 4 vertices.
And S403, obtaining the theoretical change position of the vertex of the second clothing according to the position of the central point, the distance between the vertex of the second clothing and the central point and the deformation scale value.
The method and formula for calculating the theoretical change position of the vertex of the second garment refer to the method and formula for calculating the theoretical change position of the vertex of the first garment.
When both the first and second apparel are present, not only may the first apparel be deformed, but the second apparel may also be deformed accordingly, as the first and second apparel may have overlapping portions. Thus, S302 may include: and obtaining the theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing, the deformation scale value and a second adaptive parameter value, wherein the second adaptive parameter value represents the scale which needs to be adjusted for adapting to the first clothing of the second clothing. The second adaptive parameter value selection method refers to the first adaptive parameter value selection method.
It should be noted that, as the second adaptive parameter value represents the dimension that the second clothing needs to be adjusted to adapt to the first clothing, the second adaptive parameter value represents the dimension that the second clothing needs to be adjusted to adapt to the first clothing. It is to be understood that the second adaptive parameter value is for a vertex where the second garment and the first garment (on the standard virtual object) overlap. Therefore, the theoretical variation position of each vertex of the second clothing is obtained according to the standard position of each vertex of the second clothing, the deformation scale value and the second adaptive parameter value, and one possible implementation manner is as follows: firstly, determining vertexes of the second clothing which are overlapped with the first clothing according to the standard positions of the vertexes of the first clothing and the standard positions of the vertexes of the second clothing to form a second vertex set; and then obtaining the theoretical change position of each vertex in the second vertex set according to the standard position of each vertex in the second vertex set, the deformation scale value and the second adaptive parameter value.
As an example, the foregoing has introduced a third vertex set on the standard virtual object corresponding to each vertex of the first clothing and a fourth vertex set on the standard virtual object corresponding to each vertex of the second clothing, where determining the vertex of the first clothing that overlaps with the second clothing according to the standard position of each vertex of the first clothing and the standard position of each vertex of the second clothing, and forming the first vertex set includes: taking the intersection of the fifth vertex set and the sixth vertex set as the seventh vertex set; the fifth vertex set is a set formed by combining all the third vertex sets, and the sixth vertex set is a set formed by combining all the fourth vertex sets; and taking a set formed by the vertexes of the first garment corresponding to all the vertexes in the seventh vertex set as the first vertex set. Determining the vertex overlapped with the first clothing in the second clothing according to the standard position of each vertex of the first clothing and the standard position of each vertex of the second clothing, and forming a second vertex set comprises: and taking a set formed by the vertexes of the second clothes corresponding to all the vertexes in the seventh vertex set as the second vertex set.
For example, the first clothing is clothing, the second clothing is trousers, the third vertex set on the standard virtual object corresponding to the vertex a 'on the clothing is { a, B, C, D }, and the third vertex set on the standard virtual object corresponding to the vertex B' on the clothing is { C, D, E, F }, and since the two third vertex sets have repeated vertices, the two third vertex sets are combined to obtain a fifth vertex set { a, B, C, D, E, F }; the fourth vertex set on the standard virtual object corresponding to the vertex C 'on the trousers is { a, B, M, N }, and the fourth vertex set on the standard virtual object corresponding to the vertex D' on the trousers is { M, N, H, K }, and since the two fourth vertex sets have repeated vertices, the two fourth vertex sets are combined to obtain the sixth vertex set { a, B, M, N, H, K }. The fifth vertex set and the sixth vertex set intersect { a, B } as said seventh vertex set, it being understood that the seventh vertex set is a set of vertices of the garment and of the trousers corresponding to the standard virtual object in the waist overlapping portion, the vertices a and B of the seventh vertex set corresponding to the vertices a 'on the garment, so that the first vertex set comprises the vertices a'. After the seventh set of vertices { A, B } is obtained, vertices A and B in the seventh set of vertices correspond to vertices C 'on the pants, so the second set of vertices includes vertices C'.
S303, constructing a second objective function according to the difference between the theoretical change position of each vertex of the second clothing and the actual change position of each vertex of the second clothing and a preset rule, and obtaining the actual change position of the second clothing when the second objective function meets a second preset condition, wherein the actual change position of the second clothing is matched with the position of the target virtual object wearing the first clothing.
The theoretical change position of the first clothing and the actual change position of the first clothing related in the first objective function are correspondingly replaced into the theoretical change position of the second clothing and the actual change position of the second clothing. The second preset condition may be to minimize the second objective function, thereby obtaining an actual change location of the second garment.
S304, synthesizing the first clothes, the second clothes and the target virtual object by using the actual change positions of the vertexes of the first clothes, the actual change positions of the vertexes of the second clothes and the positions of the vertexes of the target virtual object to obtain the target virtual object wearing the first clothes and the second clothes.
In this embodiment, the actual change position of each vertex of the first garment, the actual change position of each vertex of the second garment, and the position of each vertex of the target virtual object are determined, and the position data of each vertex of the three parts are synthesized to obtain the position data of all the vertices of the target virtual object wearing the first garment and the second garment, so that the target virtual object wearing the first garment and the second garment can be obtained.
In this embodiment, the target virtual object wears both the first garment and the second garment, and the target virtual object wearing the first garment and the second garment can be obtained by calculating the actual change positions of the vertices of the first garment, the actual change positions of the vertices of the second garment, and the positions of the vertices of the target virtual object, and synthesizing the first garment, the second garment, and the target virtual object. When a plurality of clothes are extruded possibly due to overlapping, the actual change positions of all the vertexes of the first clothes, the actual change positions of all the vertexes of the second clothes and the positions of all the vertexes of the target virtual object can be accurately determined by the embodiment, so that clothes intersection is avoided, and the visual effect is not influenced. In addition, the method of the embodiment uses the second objective function to calculate the actual change position of the second clothing, does not need to perform multiple iterations, has a simple algorithm, reduces the calculation time, and improves the calculation efficiency.
Based on the virtual clothing wearing method provided by the embodiment, the embodiment of the application also provides a virtual clothing wearing device, and the working principle of the virtual clothing wearing device is explained in detail below by combining the attached drawings.
Referring to fig. 5, the figure is a block diagram of a virtual clothing wearing apparatus provided in an embodiment of the present application.
The virtual dress that this embodiment provided dresses device includes: a first acquisition unit 501, a first determination unit 502 and a second determination unit 503.
The first obtaining unit 501 is configured to obtain a deformation scale value of a target virtual object relative to a standard virtual object, and a standard position of each vertex of a first garment, where the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment;
the first determining unit 502 is configured to obtain a theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
the second determining unit 503 is configured to construct a first objective function according to a difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain an actual change position of the first clothing when the first objective function meets a first preset condition, where the actual change position of the first clothing is matched with the position of the target virtual object.
In this embodiment, the target virtual object wears both the first garment and the second garment, and the target virtual object wearing the first garment and the second garment can be obtained by calculating the actual change positions of the vertices of the first garment, the actual change positions of the vertices of the second garment, and the positions of the vertices of the target virtual object, and synthesizing the first garment, the second garment, and the target virtual object. When a plurality of clothes are extruded possibly due to overlapping, the actual change positions of all the vertexes of the first clothes, the actual change positions of all the vertexes of the second clothes and the positions of all the vertexes of the target virtual object can be accurately determined by the embodiment, so that clothes intersection is avoided, and the visual effect is not influenced. In addition, the method of the embodiment uses the second objective function to calculate the actual change position of the second clothing, does not need to perform multiple iterations, has a simple algorithm, reduces the calculation time, and improves the calculation efficiency.
Optionally, the apparatus further comprises:
and the synthesizing unit is used for synthesizing the first clothing and the target virtual object by utilizing the actual change position of each vertex of the first clothing and the position of each vertex of the target virtual object to obtain the target virtual object wearing the first clothing.
Optionally, the preset rule at least includes one of the following rules:
a first rule:
changing the first garment from the standard position to the actual change position at each vertex of the first garment, wherein the first garment only changes in size and is similar in shape;
the second rule is as follows:
the first apparel formed from the actual changing positions of the vertices of the first apparel is smooth.
Optionally, if there is a second garment in addition to the first garment, the first determining unit 502 includes:
and the first determining subunit is configured to obtain a theoretical change position of each vertex of the first clothing according to the standard position of each vertex of the first clothing, the deformation scale value, and a first adaptive parameter value, where the first adaptive parameter value represents a scale that needs to be adjusted for adapting to the second clothing.
Optionally, the synthesizing unit 504 includes:
a second obtaining unit, configured to obtain a standard position of each vertex of the second garment, where the standard position of each vertex of the second garment is a position where each vertex of the second garment is located when the standard virtual object wears the second garment;
the third determining unit is used for obtaining the theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing and the deformation scale value;
a fourth determining unit, configured to construct a second objective function according to a difference between the theoretical change position of each vertex of the second clothing and the actual change position of each vertex of the second clothing and a preset rule, and obtain an actual change position of the second clothing when the second objective function meets a second preset condition, where the actual change position of the second clothing matches a position of the target virtual object wearing the first clothing;
and the first synthesizing subunit is configured to synthesize the first garment, the second garment, and the target virtual object by using the actual change position of each vertex of the first garment, the actual change position of each vertex of the second garment, and the position of each vertex of the target virtual object, so as to obtain the target virtual object wearing the first garment and the second garment.
Optionally, the third determining unit includes:
and the third determining subunit is configured to obtain a theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing, the deformation scale value, and a second adaptive parameter value, where the second adaptive parameter value represents a scale that needs to be adjusted for adapting to the first clothing.
Optionally, the first determining subunit includes:
the first forming unit is used for determining the vertexes of the first clothing, which are overlapped with the second clothing, according to the standard positions of the vertexes of the first clothing and the standard positions of the vertexes of the second clothing to form a first vertex set;
and the first determining module is used for obtaining the theoretical change position of each vertex in the first vertex set according to the standard position of each vertex in the first vertex set, the deformation scale value and the first adaptive parameter value.
Optionally, the third determining subunit includes:
the second forming unit is used for determining the vertexes of the second clothing, which are overlapped with the first clothing, according to the standard positions of the vertexes of the first clothing and the standard positions of the vertexes of the second clothing to form a second vertex set;
and the second determining module is used for obtaining the theoretical change position of each vertex in the second vertex set according to the standard position of each vertex in the second vertex set, the deformation scale value and the second adaptive parameter value.
Optionally, the first determining unit 502 includes:
a third obtaining unit, configured to obtain positions of vertices of the standard virtual object;
a fourth determining subunit, configured to determine, according to the standard position of each vertex of the first clothing and the positions of each vertex of the standard virtual object, a third vertex set corresponding to each vertex of the first clothing, where the third vertex set is a vertex of the standard virtual object whose distance from the vertex of the first clothing satisfies a preset condition;
a fifth determining subunit, configured to determine, according to the position of each vertex in the third vertex set, a position of a central point corresponding to the vertex of the first clothing;
and a sixth determining subunit, configured to obtain a theoretical change position of the vertex of the first garment according to the position of the central point, the distance between the vertex of the first garment and the central point, and the deformation scale value.
Optionally, the third determining unit includes:
a seventh determining subunit, configured to determine, according to the standard position of each vertex of the second clothing and the positions of each vertex of the standard virtual object, a fourth vertex set corresponding to each vertex of the second clothing, where the fourth vertex set is a vertex of the standard virtual object whose distance from the vertex of the second clothing satisfies a preset condition;
an eighth determining subunit, configured to determine, according to the position of each vertex in the fourth vertex set, a position of a central point corresponding to the vertex of the second clothing;
and the ninth determining subunit is used for obtaining the theoretical change position of the vertex of the second clothing according to the position of the central point, the distance between the vertex of the second clothing and the central point and the deformation scale value.
Optionally, the first forming unit sets an intersection of a fifth vertex set and a sixth vertex set as the seventh vertex set; the fifth vertex set is a set formed by combining all the third vertex sets, and the sixth vertex set is a set formed by combining all the fourth vertex sets;
and taking a set formed by the vertexes of the first garment corresponding to all the vertexes in the seventh vertex set as the first vertex set.
Optionally, the second forming unit takes a set formed by vertices of the second garment corresponding to each vertex in the seventh vertex set as the second vertex set.
Based on the virtual clothing wearing method and device provided by the above embodiments, the embodiment of the application further provides an electronic device, and the working principle of the electronic device is described in detail below.
The present embodiment also provides an electronic device, including:
a processor and a memory storing a program.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the purpose of improving the reality of the target face with the target expression synthesized according to the target expression is achieved by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
Wherein the processor, when executing the program, performs the following:
acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, wherein the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment;
obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
Based on the virtual clothing wearing method, the virtual clothing wearing device and the electronic equipment provided by the embodiments, the embodiments of the application also provide a storage medium, and the working principle of the storage medium is described in detail below.
Embodiments of the present application provide a storage medium for storing programs including, but not limited to, disk storage, CD-ROM, optical storage, and the like.
The program, when executed, causes an electronic device to:
acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, wherein the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment;
obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
When introducing elements of various embodiments of the present application, the articles "a," "an," "the," and "said" are intended to mean that there are one or more of the elements. The terms "comprising," "including," and "having" are intended to be inclusive and mean that there may be additional elements other than the listed elements.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, device, and storage medium embodiments, since they are substantially similar to the method embodiments, they are described relatively simply, and reference may be made to some descriptions of the method embodiments for relevant points. The above-described apparatus embodiments are merely illustrative, and the units and modules described as separate components may or may not be physically separate. In addition, some or all of the units and modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The foregoing is directed to embodiments of the present application and it is noted that numerous modifications and adaptations may be made by those skilled in the art without departing from the principles of the present application and are intended to be within the scope of the present application.

Claims (21)

1. A virtual apparel wearing method, the method comprising:
acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, wherein the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment;
obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
2. The method of claim 1, further comprising:
and synthesizing the first clothing and the target virtual object by using the actual change positions of the vertexes of the first clothing and the positions of the vertexes of the target virtual object to obtain the target virtual object wearing the first clothing.
3. The method of claim 1, wherein the preset rule comprises at least one of:
a first rule:
changing the size of the first garment from the standard position to the actual change position at each vertex of the first garment, wherein the first garment is similar in shape;
the second rule is as follows:
the first apparel formed from the actual changing positions of the vertices of the first apparel is smooth.
4. The method of claim 1 or 3, wherein if a second garment exists in addition to the first garment, the obtaining the theoretical variation position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value comprises:
and obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment, the deformation scale value and a first adaptive parameter value, wherein the first adaptive parameter value represents the scale which needs to be adjusted for adapting to the second garment of the first garment.
5. The method of claim 2, wherein if a second garment exists in addition to the first garment, the obtaining the theoretical variation position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value comprises:
and obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment, the deformation scale value and a first adaptive parameter value, wherein the first adaptive parameter value represents the scale which needs to be adjusted for adapting to the second garment of the first garment.
6. The method of claim 5, wherein the synthesizing the first garment and the target virtual object using the actual changed positions of the vertices of the first garment and the positions of the vertices of the target virtual object comprises:
acquiring the standard position of each vertex of the second clothing, wherein the standard position of each vertex of the second clothing is the position of each vertex of the second clothing when the standard virtual object wears the second clothing;
obtaining the theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing and the deformation scale value;
constructing a second objective function according to the difference between the theoretical change position of each vertex of the second clothing and the actual change position of each vertex of the second clothing and a preset rule, and obtaining the actual change position of the second clothing when the second objective function meets a second preset condition, wherein the actual change position of the second clothing is matched with the position of the target virtual object wearing the first clothing;
synthesizing the first clothing, the second clothing and the target virtual object by using the actual change positions of the vertexes of the first clothing, the actual change positions of the vertexes of the second clothing and the positions of the vertexes of the target virtual object to obtain the target virtual object wearing the first clothing and the second clothing.
7. The method of claim 6, wherein obtaining the theoretical variation position of each vertex of the second garment according to the standard position of each vertex of the second garment and the deformation scale value comprises:
and obtaining the theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing, the deformation scale value and a second adaptive parameter value, wherein the second adaptive parameter value represents the scale which needs to be adjusted for adapting to the first clothing of the second clothing.
8. The method of claim 6, wherein obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment, the deformation scale value, and the first adaptive parameter value comprises:
determining the vertex overlapped with the second clothing in the first clothing according to the standard position of each vertex of the first clothing and the standard position of each vertex of the second clothing to form a first vertex set;
and obtaining the theoretical change position of each vertex in the first vertex set according to the standard position of each vertex in the first vertex set, the deformation scale value and the first adaptive parameter value.
9. The method of claim 8, wherein obtaining the theoretical variation position of each vertex of the second garment according to the standard position of each vertex of the second garment, the deformation scale value, and the second adaptive parameter value comprises:
determining the vertex overlapped with the first clothing in the second clothing according to the standard position of each vertex of the first clothing and the standard position of each vertex of the second clothing to form a second vertex set;
and obtaining the theoretical change position of each vertex in the second vertex set according to the standard position of each vertex in the second vertex set, the deformation scale value and the second adaptive parameter value.
10. The method of claim 1, wherein obtaining the theoretical variation position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value comprises:
acquiring the position of each vertex of the standard virtual object;
determining a third vertex set corresponding to each vertex of the first garment according to the standard position of each vertex of the first garment and the positions of each vertex of the standard virtual object, wherein the third vertex set is a vertex of the standard virtual object, the distance between which and the vertex of the first garment meet preset conditions;
determining the position of a central point corresponding to each vertex of the first clothing according to the position of each vertex in the third vertex set;
and obtaining the theoretical change position of the vertex of the first garment according to the position of the central point, the distance between the vertex of the first garment and the central point and the deformation scale value.
11. The method of claim 6, wherein obtaining the theoretical variation position of each vertex of the second garment according to the standard position of each vertex of the second garment and the deformation scale value comprises:
determining a fourth vertex set corresponding to each vertex of the second clothing according to the standard position of each vertex of the second clothing and the position of each vertex of the standard virtual object, wherein the fourth vertex set is a vertex of the standard virtual object, the distance between which and the vertex of the second clothing meets a preset condition;
determining the position of a central point corresponding to each vertex of the second clothing according to the position of each vertex in the fourth vertex set;
and obtaining the theoretical change position of the vertex of the second clothing according to the position of the central point, the distance between the vertex of the second clothing and the central point and the deformation scale value.
12. The method of claim 11, wherein determining vertices of the first garment that overlap the second garment based on the canonical locations of the vertices of the first garment and the canonical locations of the vertices of the second garment, forming a first set of vertices comprises:
taking the intersection of the fifth vertex set and the sixth vertex set as a seventh vertex set; the fifth vertex set is a set formed by combining all the third vertex sets, and the sixth vertex set is a set formed by combining all the fourth vertex sets;
and taking a set formed by the vertexes of the first garment corresponding to all the vertexes in the seventh vertex set as the first vertex set.
13. The method of claim 12, wherein determining vertices of the second garment that overlap the first garment based on the canonical locations of the vertices of the first garment and the canonical locations of the vertices of the second garment, forming a second set of vertices comprises:
and taking a set formed by the vertexes of the second clothes corresponding to all the vertexes in the seventh vertex set as the second vertex set.
14. A virtual garment wearing apparatus, the apparatus comprising:
the system comprises an acquisition unit, a processing unit and a control unit, wherein the acquisition unit is used for acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, and the standard position of each vertex of the first garment is the position of each vertex of the first garment when the standard virtual object wears the first garment;
the first determining unit is used for obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and the second determining unit is used for constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
15. The apparatus of claim 14, further comprising:
and the synthesizing unit is used for synthesizing the first clothing and the target virtual object by utilizing the actual change position of each vertex of the first clothing and the position of each vertex of the target virtual object to obtain the target virtual object wearing the first clothing.
16. The apparatus of claim 15, wherein if a second garment exists in addition to the first garment, the first determining unit comprises:
and the first determining subunit is configured to obtain a theoretical change position of each vertex of the first clothing according to the standard position of each vertex of the first clothing, the deformation scale value, and a first adaptive parameter value, where the first adaptive parameter value represents a scale that needs to be adjusted for adapting to the second clothing.
17. The apparatus of claim 16, wherein the synthesis unit comprises:
a second obtaining unit, configured to obtain a standard position of each vertex of the second garment, where the standard position of each vertex of the second garment is a position where each vertex of the second garment is located when the standard virtual object wears the second garment;
the third determining unit is used for obtaining the theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing and the deformation scale value;
a fourth determining unit, configured to construct a second objective function according to a difference between the theoretical change position of each vertex of the second clothing and the actual change position of each vertex of the second clothing and a preset rule, and obtain an actual change position of the second clothing when the second objective function meets a second preset condition, where the actual change position of the second clothing matches a position of the target virtual object wearing the first clothing;
and the first synthesizing subunit is configured to synthesize the first garment, the second garment, and the target virtual object by using the actual change position of each vertex of the first garment, the actual change position of each vertex of the second garment, and the position of each vertex of the target virtual object, so as to obtain the target virtual object wearing the first garment and the second garment.
18. The apparatus of claim 17, wherein the third determining unit comprises:
and the third determining subunit is configured to obtain a theoretical change position of each vertex of the second clothing according to the standard position of each vertex of the second clothing, the deformation scale value, and a second adaptive parameter value, where the second adaptive parameter value represents a scale that needs to be adjusted for adapting to the first clothing.
19. The apparatus of claim 17, wherein the first determining subunit comprises:
the first forming unit is used for determining the vertexes of the first clothing, which are overlapped with the second clothing, according to the standard positions of the vertexes of the first clothing and the standard positions of the vertexes of the second clothing to form a first vertex set;
and the first determining module is used for obtaining the theoretical change position of each vertex in the first vertex set according to the standard position of each vertex in the first vertex set, the deformation scale value and the first adaptive parameter value.
20. An electronic device, characterized in that the electronic device comprises:
a processor and a memory storing a program;
wherein the processor, when executing the program, performs the following:
acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, wherein the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment;
obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
21. A storage medium storing a program, wherein the program, when executed, causes an electronic device to:
acquiring a deformation scale value of a target virtual object relative to a standard virtual object and a standard position of each vertex of a first garment, wherein the standard position of each vertex of the first garment is a position where each vertex of the first garment is located when the standard virtual object wears the first garment;
obtaining the theoretical change position of each vertex of the first garment according to the standard position of each vertex of the first garment and the deformation scale value;
and constructing a first objective function according to the difference between the theoretical change position of each vertex of the first clothing and the actual change position of each vertex of the first clothing and a preset rule, so as to obtain the actual change position of the first clothing when the first objective function meets a first preset condition, wherein the actual change position of the first clothing is matched with the position of the target virtual object.
CN201710657291.5A 2017-08-03 2017-08-03 Virtual clothing wearing method, device, equipment and storage medium Active CN107464289B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710657291.5A CN107464289B (en) 2017-08-03 2017-08-03 Virtual clothing wearing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710657291.5A CN107464289B (en) 2017-08-03 2017-08-03 Virtual clothing wearing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN107464289A CN107464289A (en) 2017-12-12
CN107464289B true CN107464289B (en) 2020-10-30

Family

ID=60548143

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710657291.5A Active CN107464289B (en) 2017-08-03 2017-08-03 Virtual clothing wearing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN107464289B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104821006A (en) * 2015-05-18 2015-08-05 浙江理工大学 Dynamic clothing simulation method based on human body mixed enclosing box
CN105528799A (en) * 2014-10-21 2016-04-27 三星电子株式会社 Virtual fitting device and virtual fitting method thereof
KR101720016B1 (en) * 2015-10-16 2017-03-27 광운대학교 산학협력단 A clothing fitting system with a mirror display by using salient points and the method thereof

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015184875A (en) * 2014-03-24 2015-10-22 株式会社東芝 Data processing device and data processing program
KR101740326B1 (en) * 2015-03-23 2017-06-08 한국전자통신연구원 Realistic experience apparatus based augmented reality and method of providing realistic experience based augmented reality

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105528799A (en) * 2014-10-21 2016-04-27 三星电子株式会社 Virtual fitting device and virtual fitting method thereof
CN104821006A (en) * 2015-05-18 2015-08-05 浙江理工大学 Dynamic clothing simulation method based on human body mixed enclosing box
KR101720016B1 (en) * 2015-10-16 2017-03-27 광운대학교 산학협력단 A clothing fitting system with a mirror display by using salient points and the method thereof

Also Published As

Publication number Publication date
CN107464289A (en) 2017-12-12

Similar Documents

Publication Publication Date Title
US10347041B2 (en) System and method for simulating realistic clothing
TWI554951B (en) Apparatus and method for rendering virtual try-on
US11055888B2 (en) Appearance-flow-based image generation
KR101911133B1 (en) Avatar construction using depth camera
GB2535302A (en) Methods for generating a 3D virtual body model of a person combined with a 3D garment image, and related devices, systems and computer program products
US8976230B1 (en) User interface and methods to adapt images for approximating torso dimensions to simulate the appearance of various states of dress
US20230093102A1 (en) Method, System, and Device of Generating a Reduced-Size Volumetric Dataset
US20150269291A1 (en) Data processing apparatus and data processing program
KR20170133455A (en) 3D garment correction technique using gestures
US10395404B2 (en) Image processing device for composite images, image processing system and storage medium
KR102348137B1 (en) a computer aided method for generating transferred patterns for garment draped on an avatar
US11734887B2 (en) Generating clothing patterns of garment using bounding volumes of body parts
JP2022036963A (en) Size measurement system
KR20140108451A (en) Avatar 3 dimensional clothes automatically transferring wearing method
CN107464289B (en) Virtual clothing wearing method, device, equipment and storage medium
CN105046738A (en) Clothes dynamic three-dimension making method and making apparatus
JP7024876B2 (en) Detection device, processing device, detection method, and processing program
CN112329227A (en) Sports garment type generation method and system
KR102627035B1 (en) Device and method for generating user avatar based on attributes detected in user image and controlling natural motion of the user avatar
CN117333601B (en) Digital virtual clothing generation method and device based on artificial intelligence
Li et al. 3D fashion fast modeling from photographs
CN113117335B (en) Game role control method and related device
KR20220056025A (en) Method and apparatus for customising game character
KR20230077647A (en) Method of providing a realistic fashion metaverse service, apparatus thereof, and computationally non-transitory readable medium for storing a program thereof
Yan et al. Animation of Refitted 3D Garment Models for Reshaped Bodies

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20190221

Address after: 361000 Fujian Xiamen Torch High-tech Zone Software Park Innovation Building Area C 3F-A193

Applicant after: Xiamen Black Mirror Technology Co., Ltd.

Address before: 9th Floor, Maritime Building, 16 Haishan Road, Huli District, Xiamen City, Fujian Province, 361000

Applicant before: XIAMEN HUANSHI NETWORK TECHNOLOGY CO., LTD.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant