A method and system for measuring fabric parameters
By using Green strain tensor model and image processing technology, the problem of insufficient authenticity of cloth parametric modeling in the prior art is solved, and higher accuracy of cloth parameter measurement and modeling is achieved.
Patent Information
- Application Number
- CN202210399244.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2042-04-15
AI Technical Summary
In the existing virtual fitting technology, the authenticity of fabric parameterized modeling is insufficient, especially the particle spring model has major defects in simulating fabric movement.
The Green strain tensor model is used in combination with image processing technology, and the deformation gradient of the key points is determined by obtaining the images before and after the deformation of the fabric, and the optimal value of the fabric parameters is obtained through iterative optimization.
It improves the accuracy of fabric parameter measurement and the authenticity of modeling, and can more accurately simulate the movement and deformation of fabric.
Smart Images

Figure CN114647969B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of virtual fitting technology, and in particular to a method and system for measuring cloth parameters. Background Art
[0002] With the rapid development of VR technology in recent years, humans have developed a strong interest in virtual technology. Coupled with the rise of major online shopping platforms, virtual fitting has emerged. It allows users to experience the effect of wearing clothes without going to physical stores. Unlike most clothes currently produced by the fashion industry, it can modify clothes according to personal preferences, truly achieving personalized customization of clothes without leaving home. Virtual fitting involves fabric parameter measurement, which requires fabric parametric modeling. At present, the mass spring model is commonly used to model the movement of fabric, but the authenticity of its modeling is still lacking. Summary of the invention
[0003] The purpose of the present invention is to provide a method and system for measuring cloth parameters.
[0004] To achieve the above object, the present invention provides the following solutions:
[0005] A method for measuring cloth parameters, comprising:
[0006] Obtain the target cloth image before and after deformation;
[0007] Determine the first coordinate of the key point of the target cloth before deformation according to the image before deformation; the key point is an artificial marker point;
[0008] Determine the second coordinates of the deformed key points of the target cloth according to the deformed image;
[0009] determining a deformation gradient of the key point according to the first coordinate and the second coordinate;
[0010] Randomly assigning initial values of cloth parameters to each of the key points;
[0011] Determine the force of each of the key points according to the cloth parameters, the deformation gradient of the key points and the Green strain tensor model;
[0012] Determine the loss function value according to the force at each key point;
[0013] The cloth parameters are adjusted according to the loss function value, and the step of determining the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model is jumped to the step of determining the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model, until the loss function value satisfies the iteration stop condition, the jump is stopped, and the optimal value of the cloth parameter is obtained; the optimal value of the cloth parameter is used for cloth simulation.
[0014] Optionally, determining the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model specifically includes:
[0015] Determining the Green strain tensor of each of the key points in the deformed image of the target cloth according to the deformation gradient of the key points;
[0016] Determining the warp and weft directions of the target fabric;
[0017] Determine the stiffness matrix of the target cloth according to the cloth parameters;
[0018] Determining the Green stress tensor of each of the key points in the deformed image of the target cloth according to the Green strain tensor and the stiffness matrix;
[0019] Determining the strain energy density corresponding to each of the key points in the deformed image of the target cloth according to the Green strain tensor and the Green stress tensor;
[0020] Determining the strain energy of the target cloth after deformation according to the strain energy density;
[0021] Obtaining the acceleration of each of the key points according to the strain energy;
[0022] determining the quality of each of the key points;
[0023] The force on each of the key points is calculated according to the acceleration and the mass of the key points.
[0024] Optionally, the fabric parameters are iteratively optimized using an Adam adaptive gradient descent method.
[0025] Optionally, the target cloth is a mesh cloth, and the key point is a junction point of the mesh; determining the strain energy of the target cloth after deformation according to the strain energy density specifically includes: dividing the mesh of the target cloth image before deformation or the target cloth image after deformation into triangular meshes along a diagonal line;
[0026] Determine the strain energy of the triangular mesh according to the strain energy density and the area of the triangular mesh where the key point is located;
[0027] The strain energy of the target cloth after deformation is determined according to the strain energy of each of the triangular meshes.
[0028] Optionally, the coordinates of each key point are obtained using a least squares method.
[0029] A cloth parameter measurement system, the system comprising:
[0030] An image acquisition module is used to acquire an image of the target cloth before and after deformation;
[0031] A first coordinate acquisition module, used to determine the first coordinate of the key point of the target cloth before deformation according to the image before deformation; the key point is an artificial mark point;
[0032] A second coordinate acquisition module, used to determine the second coordinates of the key points of the target cloth after deformation according to the deformed image;
[0033] A deformation gradient determination module, used to determine the deformation gradient of the key point according to the first coordinate and the second coordinate;
[0034] An initial value assignment module for cloth parameters, used for randomly assigning initial values of cloth parameters to each of the key points;
[0035] A key point force determination module, used to determine the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model;
[0036] A loss function value determination module is used to determine the loss function value according to the force of each key point;
[0037] The cloth parameter optimal value determination module is used to adjust the cloth parameters according to the loss function value, and jump to the force step of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model, until the loss function value meets the iteration stop condition, stop jumping, and obtain the optimal value of the cloth parameter; the optimal value of the cloth parameter is used for cloth simulation.
[0038] Optionally, the force determination module of the key points specifically includes: determining the Green strain tensor of each of the key points in the deformed image of the target cloth according to the deformation gradient of the key points; determining the warp and weft directions of the target cloth; determining the stiffness matrix of the target cloth according to the cloth parameters; determining the Green stress tensor of each of the key points in the deformed image of the target cloth according to the Green strain tensor and the stiffness matrix; determining the strain energy density corresponding to each of the key points in the deformed image of the target cloth according to the Green strain tensor and the Green stress tensor; determining the strain energy of the target cloth after deformation according to the strain energy density; obtaining the acceleration of each of the key points according to the strain energy; determining the mass of each of the key points; and calculating the force of each of the key points according to the acceleration and the mass of the key points.
[0039] Optionally, the fabric parameters are iteratively optimized using an Adam adaptive gradient descent method.
[0040] Optionally, the target cloth is a mesh cloth, and the key point is a junction point of the mesh; determining the strain energy of the target cloth after deformation according to the strain energy density specifically includes: dividing the mesh of the target cloth image before deformation or the target cloth image after deformation into triangular meshes along a diagonal line;
[0041] Determine the strain energy of the triangular mesh according to the strain energy density and the area of the triangular mesh where the key point is located;
[0042] The strain energy of the target cloth after deformation is determined according to the strain energy of each of the triangular meshes.
[0043] Optionally, the coordinates of each key point are obtained using a least squares method.
[0044] According to the specific embodiment provided by the present invention, the following technical effects are disclosed: obtaining the image before and after deformation of the target cloth; determining the first coordinate of the key point of the target cloth before deformation according to the image before deformation; the key point is an artificial mark point; determining the second coordinate of the key point of the target cloth after deformation according to the image after deformation; determining the deformation gradient of the key point according to the first coordinate and the second coordinate; randomly assigning initial values of cloth parameters to each of the key points; determining the force of each of the key points according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model; determining the loss function value according to the force of each key point; adjusting the cloth parameters according to the loss function value, and jumping to the step of determining the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model, until the loss function value meets the iteration stop condition, stop jumping, and obtain the optimal value of the cloth parameter; the optimal value of the cloth parameter is used for cloth simulation. The cloth parameter measurement method of the present invention adopts the Green strain tensor model to model the cloth, and the obtained cloth parameters are highly accurate, thereby improving the authenticity of its modeling. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 A schematic diagram of a method for measuring cloth parameters provided in Example 1 of the present invention;
[0047] Figure 2 This is a picture of the target fabric provided in Example 1 of the present invention after being deformed by the external force applied by the weight;
[0048] Figure 3 A schematic diagram of triangular mesh division provided in Example 1 of the present invention;
[0049] Figure 4 A diagram showing the effect of the test function v provided in Example 1 of the present invention;
[0050] Figure 5 This is a rendering of the optimization result obtained by using the Green strain tensor model provided in Example 1 of the present invention;
[0051] Figure 6 This is a rendering of the optimization effect obtained by using the mass-spring model provided in Example 1 of the present invention;
[0052] Figure 7 This is a simulation effect diagram using the Green strain tensor model and the optimal value of the second cloth parameter provided in Example 1 of the present invention;
[0053] Figure 8 The particle spring model provided in Example 1 of the present invention and Figure 6 The effect diagram of simulation of optimized fabric parameters;
[0054] Fig. 9 This is a simulation effect diagram of hanging cloth using cloth parameters optimized by the Green strain tensor model of the present invention;
[0055] Fig.10 This is a simulation effect diagram of cloth falling on a sphere using cloth parameters optimized by the Green strain tensor model of the present invention;
[0056] Fig.11 This is a structural diagram of a cloth parameter measurement system provided in Example 2 of the present invention. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] The object of the present invention is to provide a method and system for measuring cloth parameters. The method adopts the Green strain tensor model to model the cloth, and the obtained cloth parameters are highly accurate, thereby improving the authenticity of its modeling.
[0059] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0060] Example 1
[0061] The present invention provides a method for measuring cloth parameters. Figure 1 , the method comprises the following steps:
[0062] Step 101: Obtain the image of the target cloth before and after deformation.
[0063] In this embodiment, the target fabric is cut into a square along a certain warp and weft direction, and an external force is applied to the fabric using a fishing line and a weight to deform the fabric. A binocular camera is used to capture an image of the target fabric before and after deformation. The deformed image is shown in FIG. Figure 2 As shown, the target cloth can be cloth of any material.
[0064] Step 102: determining first coordinates of key points of the target cloth before deformation according to the image before deformation; the key points are artificial marker points.
[0065] Step 103: determining the second coordinates of the deformed key points of the target cloth according to the deformed image.
[0066] In this embodiment, Matlab is used to perform corner detection to obtain the pixel coordinates of the intersection points of the cloth mesh in the two photos. These intersection points are also called key points. Through these key points, the cloth can be reconstructed. In order to convert the pixel coordinates of the intersection points into world coordinates, the camera's internal and external parameters are required, as shown in the following formula:
[0067]
[0068] The two matrices on the right side of the equal sign are the camera's intrinsic parameter matrix and extrinsic parameter matrix. The f in the intrinsic parameter matrix is x With f y is the focal length of the camera, x0 and y0 are the coordinates of the principal point, and s is the axis tilt parameter. The 3x3 R element in the external parameter matrix is the rotation matrix of the camera, and the 3x1 column vector in the external parameter matrix is the translation matrix of the camera. The internal and external parameter matrices of the camera can be obtained by camera calibration. u and v are the pixel coordinates of the key points, and X, Y, and Z are the world coordinates of the key points. If the product of the internal and external parameter matrices is the m matrix, it is shown as follows:
[0069]
[0070] Among them, the elements in the m matrix are the multiplication of the corresponding row and column elements of the camera's internal and external parameter matrices. Then formula (1) can be written as:
[0071]
[0072] After expanding the matrix in (3), we can get:
[0073] (um 31 -m 11 )X+(um 32 -m 12 )Y+(um 33 -m 13 )Z=m 14 -um 34 (4)
[0074] (vm 31 -m 21 )X+(vm 32 -m 22 )Y+(vm 33 -m 23 )Z=m 24 -vm 34 (5)
[0075] For this key point, there are currently two equations, but there are three unknowns that need to be solved. Since two cameras are used, two of the above equations will be obtained, that is, four equations, which becomes the solution of an overdetermined equation system. The world coordinates of this key point can be obtained by using the least squares method.
[0076] The cloth is cut along different warp and weft directions to obtain multiple square cloths. Multiple sets of target cloth images before and after deformation are obtained through a binocular camera. Steps 101-103 are repeated to obtain several sets of key point coordinates. These groups are randomly divided into training groups and test groups. The training group is used to optimize cloth parameters, and the test group is used to test the quality of the optimized cloth parameters.
[0077] Step 104: Determine the deformation gradient of the key point according to the first coordinate and the second coordinate.
[0078] Step 105: Randomly assign initial values of cloth parameters to each of the key points.
[0079] Step 106: Determine the force of each of the key points according to the cloth parameters, the deformation gradient of the key points and the Green strain tensor model.
[0080] Step 107: Determine the loss function value according to the force of each key point.
[0081] Step 108: adjusting the cloth parameters according to the loss function value, and jumping to the step of determining the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model, until the loss function value meets the iteration stop condition, stopping the jump and obtaining the optimal value of the cloth parameter; the optimal value of the cloth parameter is used for cloth simulation.
[0082] In this embodiment, steps 104 to 108 are the process of determining the optimal values of the fabric parameters, which are specifically as follows:
[0083] The world coordinates of the key points of the training group obtained in step 103 before and after deformation are used as input to model the cloth. The modeling method is as follows:
[0084] Connect the input key points into a square grid, and then follow Figure 3 By connecting the diagonals of the square grid in a way, the cloth can be divided into many triangular grids, such as △ABC and △BCD, which maintain the basic shape of the cloth and control the stretching of the cloth. Although the existence of these triangular grids can resist the bending of the cloth perpendicular to the BC side, they cannot resist the bending of the cloth along the BC side. For this reason, another type of triangular grid needs to be introduced. Connecting the other diagonal of the square grid will obtain another set of triangular grids in different directions, such as △ABD and △ACD, which can resist the bending of the cloth along the BC side, and of course they also control the stretching of the cloth. The combination of these two types of triangular grids can control the stretching and bending of the cloth, which will make the deformed cloth tend to change towards the shape before deformation. Generate triangular grids for the key points before deformation and the key points after deformation, a total of two groups. For each triangular mesh before deformation, a two-dimensional material coordinate system is established with the centroid of the triangular mesh as the origin and the plane of the triangular mesh as the XOY plane, thereby calculating the material coordinate system coordinates of the three key points of the triangular mesh. Since the material coordinate system is two-dimensional, the calculated material coordinate system coordinates are also two-dimensional. For each triangular mesh after deformation, the three-dimensional world coordinate system coordinates of the key points obtained in step 103 are used.
[0085] The Green strain tensor is used to calculate the force on the key points. The formula is as follows:
[0086] (dL) 2 -(dl) 2 =dxdx-dudu=Fdu*Fdu-dudu=du T (F T FI)du=2du T *∈*du (6)
[0087] Where dL and dl are the lengths of the line element before and after deformation, respectively, and dx and du are the line elements before and after deformation, respectively. They are a pair of vectors, and F is the deformation gradient, I is the unit matrix, and ∈ is the Green strain tensor of the key point. Furthermore, the deformation gradient is equal to the derivative of the world coordinate system coordinates of the line element after deformation to the material coordinate system coordinates before deformation, and the following formula can be obtained:
[0088]
[0089] Where x is the world coordinate system coordinate of the line element after deformation, u is the material coordinate system coordinate of the line element before deformation, and δ is the Kronecker symbol. In the Green strain tensor model, the material coordinate system coordinates of the three key points of the triangular mesh before deformation obtained above are used. The coordinates of the center of gravity of the triangular mesh can represent the material coordinate system coordinates of any point in the triangular mesh before deformation. The formula is as follows:
[0090]
[0091] Where u is the coordinate of the arbitrary point in the material coordinate system before deformation, m is the coordinate of the three key points of the triangular mesh in the material coordinate system before deformation, and b is the coordinate of the center of gravity. The coordinate of the arbitrary point in the world coordinate system after deformation can also be expressed in the same way as follows:
[0092]
[0093] Where x is the world coordinate system coordinate of the arbitrary point after deformation, and p is the world coordinate system coordinate of the three key points of the triangular mesh after deformation, that is, the second coordinate in step 103. The simultaneous equations (8) and (9) are obtained:
[0094]
[0095] in:
[0096]
[0097]
[0098] The deformation gradient of this arbitrary point can be expressed as follows:
[0099]
[0100] Where: i =[δ i1 δ i2 0] (14)
[0101] When the δ subscripts are the same, the δ value is 1, otherwise the δ value is 0.
[0102] It can be seen from the above formula that the deformation gradient of any point is independent of the position of the arbitrary point, that is, the deformation gradient of any point in the same triangular mesh is the same as the deformation gradient of the key point.
[0103] The Green stress tensor of each key point in the deformed image of the target cloth is determined according to the Green strain tensor and the stiffness matrix of the key point obtained above, and the calculation process is as follows:
[0104]
[0105] where ∈ 11 and ∈ 22 is the linear strain, and ∈ 12 is the shear strain, which is obtained by the above calculation, and σ 11 , σ 22 and σ 12 are the corresponding three Green stresses. The parameters in the stiffness matrix are the cloth parameters that need to be measured, a total of nine. Cloth has anisotropic characteristics, and the stiffness matrix corresponding to anisotropic materials is generally an asymmetric matrix. However, considering that this will increase the complexity of the entire cloth model, from an engineering practical point of view, this asymmetry is often ignored and treated as a symmetric matrix. The symmetric stiffness matrix is as follows:
[0106]
[0107] The stiffness matrix is further simplified, and the simplified stiffness matrix is as follows:
[0108]
[0109] Among them, c ij is the influence factor of the deformation in the j direction on the force in the i direction.
[0110] In this embodiment, the initial assignment of fabric parameters is randomly performed to each of the key points. Specifically, there are six measured warp and weft directions, which are divided according to the angle between the warp of the fabric and the coordinate axis of the world coordinate system, which are 0°, 30°, 60°, 90°, 120° and 150°, respectively, and 96 initial values of fabric parameters are randomly generated. First, the warp direction of the entire target fabric is determined, and then the angle between the warp direction and the coordinate axis of the world coordinate system is calculated. Finally, the angle is used to perform linear interpolation in the fabric parameters of the six initially generated warp and weft directions to obtain the parameters in the stiffness matrix of the target fabric. Since the parameters in the stiffness matrix are the properties of the fabric, all triangular meshes should share a stiffness matrix.
[0111] The strain energy density corresponding to each key point in the deformed image of the target cloth is determined according to the Green strain tensor and Green stress tensor obtained above, and the formula is as follows:
[0112]
[0113] Wherein, ψ is the strain energy density corresponding to the key point, ∈ is the Green strain tensor of the key point, and σ is the Green stress tensor of the key point.
[0114] The strain energy of the target cloth after deformation is determined according to the strain energy density. The Green stress tensor and the Green strain tensor of any point in a triangular mesh are the same, so the calculated strain energy density is also the same, so the integral will be converted into the strain energy density multiplied by the area of the triangular mesh to obtain the strain energy of the triangular mesh. Then, the strain energy of all triangular meshes is added to obtain the strain energy of the target cloth after deformation.
[0115] The Lagrangian mechanics equation is used for force calculation. The complete Lagrangian mechanics equation is as follows:
[0116]
[0117] Where x is the world coordinate system coordinate after the line element is deformed, and u is the material coordinate system coordinate before the line element is deformed.
[0118] ˙
[0119] , x is the velocity of the deformed line element in the world coordinate system, Q is the external force on the line element, and L is the Lagrangian of the target cloth, which is expressed as follows:
[0120] L=TV (20)
[0121] Where T is the kinetic energy of the target cloth, and V is the potential energy of the target cloth. x is obtained by deformation of u, so x is a function of u; by determining the material coordinate system coordinates before the line element is deformed, the external force on the line element can be obtained, so Q is a function of u; and the Lagrangian quantity represents the energy after the cloth is deformed, so L is x and Considering that L is not continuous for the entire cloth space, at least from the intersection of the triangle mesh, it is not continuous, so the weak form is introduced to solve it, the formula is as follows:
[0122]
[0123] The weak form weakens the equality everywhere. In order to make the sum of the integrated areas in the target cloth equal, a test function v is introduced to enhance this formula to indicate that in a small area where the value of the test function v is non-zero, it can be weakened to the sum of the integrated areas being equal:
[0124]
[0125] The role of the test function v is as follows Figure 4 As shown. Write L in the form of TV. Since the derivative of kinetic energy with respect to position is zero, and the derivative of potential energy with respect to velocity is zero, we can get:
[0126]
[0127] The above formula is the derivative of the functional, according to the definition of the functional derivative:
[0128]
[0129] With the expressions for kinetic and potential energy:
[0130]
[0131] V = ∫ w (Ψ+ρg T x)du (26)
[0132] Where ρ is the surface density of the cloth, Ψ is the strain energy output in step 4, and g is the acceleration of gravity. Finally, we can get:
[0133]
[0134] in Represents the partial derivative of the x-component of the world coordinate system coordinate after deformation with respect to the material coordinate system coordinate before deformation, The world coordinate system coordinates after deformation are the partial derivatives of the x and y components of the material coordinate system coordinates before deformation, and so on. Then the finite element method is introduced to discretize the continuous target cloth into a triangular mesh. The coordinates of any point in the cloth space can be expressed by the coordinates of the key points, as follows:
[0135]
[0136] in Represents the world coordinate system coordinates of the I-th key point after deformation, N I Represents the weight of the I-th key point. The reason why the coordinates of the material coordinate system before the key point is deformed is that no matter how the vertex in the cloth space is deformed, the weight of the key point coordinates will not change. In the previous weak form, the test function v was introduced, and it was explained that it is a function that is sometimes zero and sometimes non-zero, which is used to divide the integral into small areas in order to enhance the weak form. The weight here has such a property that when the point is located in the triangular mesh composed of the key point, the weight is non-zero, and the weight is zero in other cases, so v=N K , we can get the following formula:
[0137]
[0138] M KI =∫ w ρN I N K du (30)
[0139] Among them, M KIis the mass matrix. By bringing in the strain energy of the target cloth after deformation obtained above, the acceleration of each key point after deformation can be calculated.
[0140] In this embodiment, the effective area of the key point is determined by the triangle mesh containing it. Since the quality of the key point should not change with the deformation of the triangle mesh, the triangle mesh before deformation is used for calculation. The initial area of each triangle mesh containing the key point is calculated, and each area is divided by three as the effective area of each triangle mesh belonging to the key point. Then, all effective areas are added together to obtain the effective area of the key point, and finally multiplied by the density of the cloth material to obtain the quality of each key point.
[0141] Then, the force on each of the key points is calculated according to the acceleration of the key points and the mass of the key points obtained above.
[0142] In this embodiment, the process of calculating the loss function value and adjusting the fabric parameters according to the loss function value in step 107 and step 108 can be as follows:
[0143] The loss value corresponding to the cloth parameters is calculated as follows:
[0144]
[0145] where k n is the parameter optimized in the nth iteration, I is the number of key points, f i is the resultant force on the i-th key point after deformation. This loss function calculates the average value of the resultant force of all key points. The smaller the loss function, the more quasi-static the cloth is. Then, the Adam adaptive gradient descent method and PSO particle swarm algorithm are used to optimize the loss function iteratively. The specific optimization process is as follows:
[0146] Step S1: First, the Adam adaptive gradient descent method is used for optimization iteration, and the initial step size is selected as 0.01. The compensation is reduced by ten times every 10,000 iterations, and the remaining parameters are set to 0.9, 0.999 and 1e-8 according to the standard. The 96 parameters randomly generated in step 105 are used as initial values, and steps 104-107 are repeated, that is, the strain energy of the deformed cloth, the force of the key points after deformation, and the loss function value are calculated to optimize these parameters to obtain the optimal value of the first cloth parameter.
[0147] Step S2: The optimal value of the first cloth parameter obtained in step S1 is further optimized using the PSO particle swarm algorithm. The specific parameters of the PSO algorithm are 50 particles, and the initial search velocity is a random number between -0.01 and 0.01, and the optimal value of the second cloth parameter will eventually be obtained.
[0148] Figure 5This is the result obtained by using the optimal value of the second cloth parameter, with a loss of 0.0016. For comparison, the mass-spring model is optimized using the same number of parameters. Figure 6 This is the final result obtained by optimizing the mass-spring model, with a loss of 0.0211. Obviously, with the same number of parameters, the Green strain tensor model is more accurate than the mass-spring model for cloth modeling.
[0149] The following test group is used to verify the fabric parameters obtained in step 108:
[0150] Step 1: Use the world coordinates of the key points of the test group for simulation. In the first simulation iteration, there is no internal force, that is, the cloth strain energy obtained in step 106 is 0, because the cloth has not deformed, but due to the external force on the cloth, the acceleration of the key points is non-zero. Use Verlet explicit integration to perform simulation iterations, which is based on Taylor expansion and the formula is as follows:
[0151]
[0152]
[0153] x(t+δt)=2x(t)-x(t-δt)+a(t)δt 2 +O(δt 4 ) (34)
[0154] x(t+δt)=2x(t)-x(t-δt)+a(t)δt 2 (35)
[0155] Ignoring the higher-order terms and after determining the time step, the position of the key point in the next simulation iteration is obtained through the position and acceleration of the key point in the current simulation iteration, and the time step is 0.1 ms.
[0156] Step 2: Set a certain number of simulation iterations, or check whether the displacements of most key points in two adjacent simulation iterations are less than a given threshold to stop the simulation iteration, and finally obtain the simulated positions of all key points.
[0157] Step 3: Calculate the binary norm of the difference between the simulated positions of all key points obtained in step 2 and the world coordinates of the key points in the test group after deformation, and use the calculation result as the standard for measuring the optimal value of the second cloth parameter. Figure 7 As shown in the figure, the simulation effect diagram using the Green strain tensor model with the optimal value of the second cloth parameter is shown. The average deviation displacement of the key points obtained by simulation iteration relative to the groundtruth of the test group is 4.36 mm. Figure 8 To use the mass-spring model Figure 6The effect diagram of the simulation with the optimized parameters. The average deviation displacement of the key points obtained by simulation iteration relative to the groundtruth of the test group is 7.08mm. Therefore, with the same number of parameters, the Green strain tensor model is more accurate than the mass-spring model for cloth modeling.
[0158] Fig. 9 and Fig.10 The cloth is simulated based on the cloth parameters obtained by the present invention. Fig. 9 This is a simulation effect diagram of hanging cloth. Fig.10 This is a simulation of cloth falling on a sphere.
[0159] Example 2
[0160] The present invention also provides a cloth parameter measurement system, see Fig.11 The system comprises:
[0161] The image acquisition module 201 is used to acquire the image of the target cloth before and after deformation.
[0162] The first coordinate acquisition module 202 is used to determine the first coordinates of the key points of the target cloth before deformation according to the image before deformation; the key points are artificial marking points.
[0163] The second coordinate acquisition module 203 is used to determine the second coordinates of the key points of the target cloth after deformation according to the deformed image.
[0164] The deformation gradient determining module 204 is configured to determine the deformation gradient of the key point according to the first coordinate and the second coordinate.
[0165] The initial value assignment module 205 of the cloth parameters is used to randomly assign initial values of the cloth parameters to each of the key points.
[0166] The key point force determination module 206 is used to determine the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model.
[0167] The loss function value determination module 207 is used to determine the loss function value according to the force of each key point.
[0168] The cloth parameter optimal value determination module 208 is used to adjust the cloth parameters according to the loss function value, and jump to the force step of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model, until the loss function value meets the iteration stop condition, stop jumping, and obtain the optimal value of the cloth parameter; the optimal value of the cloth parameter is used for cloth simulation.
[0169] In this embodiment, the force determination module of the key points specifically includes: determining the Green strain tensor of each of the key points in the deformed image of the target cloth according to the deformation gradient of the key points; determining the warp and weft directions of the target cloth; determining the stiffness matrix of the target cloth according to the cloth parameters; determining the Green stress tensor of each of the key points in the deformed image of the target cloth according to the Green strain tensor and the stiffness matrix; determining the strain energy density corresponding to each of the key points in the deformed image of the target cloth according to the Green strain tensor and the Green stress tensor; determining the strain energy of the target cloth after deformation according to the strain energy density; obtaining the acceleration of each of the key points according to the strain energy; determining the mass of each of the key points; and calculating the force of each of the key points according to the acceleration and the mass of the key points.
[0170] In this embodiment, the system uses the Adam adaptive gradient descent method to iteratively optimize the fabric parameters.
[0171] In this embodiment, the target cloth is a mesh cloth, and the key point is a junction point of the mesh; determining the strain energy of the target cloth after deformation according to the strain energy density specifically includes: dividing the mesh of the target cloth image before deformation or the target cloth image after deformation into triangular meshes along a diagonal line; determining the strain energy of the triangular mesh according to the strain energy density and the area of the triangular mesh where the key point is located; and determining the strain energy of the target cloth after deformation according to the strain energy of each triangular mesh.
[0172] In this embodiment, the system uses the least square method to obtain the coordinates of each key point.
[0173] As for the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
[0174] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for measuring cloth parameters, characterized in that: include: Obtain the target cloth image before and after deformation; Determine the first coordinates of the key points of the target cloth before deformation according to the image before deformation; The key points are artificial landmarks; Determine the second coordinates of the deformed key points of the target cloth according to the deformed image; determining a deformation gradient of the key point according to the first coordinate and the second coordinate; Randomly assigning initial values of cloth parameters to each of the key points; Determining the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model, specifically includes: determining the Green strain tensor of each key point in the deformed image of the target cloth according to the deformation gradient of the key point; determining the warp and weft directions of the target cloth; determining the stiffness matrix of the target cloth according to the cloth parameters; determining the Green stress tensor of each key point in the deformed image of the target cloth according to the Green strain tensor and the stiffness matrix; determining the strain energy density corresponding to each key point in the deformed image of the target cloth according to the Green strain tensor and the Green stress tensor; determining the strain energy of the target cloth after deformation according to the strain energy density; obtaining the acceleration of each key point according to the strain energy; determining the mass of each key point; and calculating the force of each key point according to the acceleration and the mass of the key point; Determine the loss function value according to the force at each key point; The cloth parameters are adjusted according to the loss function value, and the step of determining the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model is jumped to the step of determining the force of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model, until the loss function value satisfies the iteration stop condition, the jump is stopped, and the optimal value of the cloth parameter is obtained; the optimal value of the cloth parameter is used for cloth simulation.
2. The method for measuring cloth parameters according to claim 1, characterized in that: The Adam adaptive gradient descent method is used to iteratively optimize the cloth parameters.
3. The method for measuring cloth parameters according to claim 1, characterized in that: The target cloth is a mesh cloth, and the key points are intersection points of the meshes; Determining the strain energy of the target cloth after deformation according to the strain energy density specifically includes: dividing a grid of the target cloth image before deformation or the target cloth image after deformation into triangular grids along a diagonal line; Determine the strain energy of the triangular mesh according to the strain energy density and the area of the triangular mesh where the key point is located; The strain energy of the target cloth after deformation is determined according to the strain energy of each of the triangular meshes.
4. The method for measuring cloth parameters according to claim 1, characterized in that: The coordinates of each key point are obtained by using the least square method.
5. A cloth parameter measurement system, characterized in that: include: An image acquisition module is used to acquire an image of the target cloth before and after deformation; A first coordinate acquisition module, used to determine the first coordinate of the key point of the target cloth before deformation according to the image before deformation; the key point is an artificial mark point; A second coordinate acquisition module, used to determine the second coordinates of the key points of the target cloth after deformation according to the deformed image; A deformation gradient determination module, used to determine the deformation gradient of the key point according to the first coordinate and the second coordinate; An initial value assignment module for cloth parameters, used for randomly assigning initial values of cloth parameters to each of the key points; The force determination module of the key points is used to determine the force of each key point according to the cloth parameters, the deformation gradient of the key points and the Green strain tensor model, specifically including: determining the Green strain tensor of each key point in the deformed image of the target cloth according to the deformation gradient of the key points; determining the warp and weft directions of the target cloth; determining the stiffness matrix of the target cloth according to the cloth parameters; determining the Green stress tensor of each key point in the deformed image of the target cloth according to the Green strain tensor and the stiffness matrix; determining the strain energy density corresponding to each key point in the deformed image of the target cloth according to the Green strain tensor and the Green stress tensor; determining the strain energy of the target cloth after deformation according to the strain energy density; obtaining the acceleration of each key point according to the strain energy; determining the mass of each key point; and calculating the force of each key point according to the acceleration and the mass of the key point; A loss function value determination module is used to determine the loss function value according to the force of each key point; The cloth parameter optimal value determination module is used to adjust the cloth parameters according to the loss function value, and jump to the force step of each key point according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model, until the loss function value meets the iteration stop condition, stop jumping, and obtain the optimal value of the cloth parameter; the optimal value of the cloth parameter is used for cloth simulation.
6. The cloth parameter measurement system according to claim 5, characterized in that: The Adam adaptive gradient descent method is used to iteratively optimize the cloth parameters.
7. The cloth parameter measurement system according to claim 5, characterized in that: The target cloth is a mesh cloth, and the key points are intersection points of the meshes; The determining the strain energy of the target cloth after deformation according to the strain energy density specifically includes: Dividing the target cloth image before deformation or the target cloth image after deformation into triangular grids along a diagonal line; Determine the strain energy of the triangular mesh according to the strain energy density and the area of the triangular mesh where the key point is located; The strain energy of the target cloth after deformation is determined according to the strain energy of each of the triangular meshes.
8. The cloth parameter measurement system according to claim 5, characterized in that: The coordinates of each key point are obtained by using the least square method.
Citation Information
Patent Citations
Digital cloth real-time resolving method based on deep learning
CN112200895A
Virtual fitting method, system and device and storage medium
CN114119905A