CN114647969A - Cloth parameter measuring method and system - Google Patents
Cloth parameter measuring method and system Download PDFInfo
- Publication number
- CN114647969A CN114647969A CN202210399244.6A CN202210399244A CN114647969A CN 114647969 A CN114647969 A CN 114647969A CN 202210399244 A CN202210399244 A CN 202210399244A CN 114647969 A CN114647969 A CN 114647969A
- Authority
- CN
- China
- Prior art keywords
- cloth
- deformation
- key point
- target
- key points
- 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.)
- Pending
Links
- 239000004744 fabric Substances 0.000 title claims abstract description 259
- 238000000034 method Methods 0.000 title claims description 31
- 238000004088 simulation Methods 0.000 claims abstract description 26
- 239000011159 matrix material Substances 0.000 claims description 35
- 230000001133 acceleration Effects 0.000 claims description 15
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 claims description 7
- 230000003044 adaptive effect Effects 0.000 claims description 7
- 238000011478 gradient descent method Methods 0.000 claims description 7
- 238000005259 measurement Methods 0.000 claims description 5
- 239000003550 marker Substances 0.000 claims description 2
- 238000000691 measurement method Methods 0.000 abstract description 4
- 239000000463 material Substances 0.000 description 18
- 238000012360 testing method Methods 0.000 description 13
- 238000010586 diagram Methods 0.000 description 12
- 230000000694 effects Effects 0.000 description 12
- 238000005457 optimization Methods 0.000 description 6
- 238000004364 calculation method Methods 0.000 description 5
- 238000005452 bending Methods 0.000 description 4
- 238000004422 calculation algorithm Methods 0.000 description 3
- 238000006073 displacement reaction Methods 0.000 description 3
- 239000002245 particle Substances 0.000 description 3
- 238000005381 potential energy Methods 0.000 description 3
- 238000012549 training Methods 0.000 description 3
- 230000014509 gene expression Effects 0.000 description 2
- 230000005484 gravity Effects 0.000 description 2
- 239000013598 vector Substances 0.000 description 2
- 229930091051 Arenine Natural products 0.000 description 1
- 241000282414 Homo sapiens Species 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
- G06F30/23—Design optimisation, verification or simulation using finite element methods [FEM] or finite difference methods [FDM]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
- G06F30/27—Design optimisation, verification or simulation using machine learning, e.g. artificial intelligence, neural networks, support vector machines [SVM] or training a model
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
- G06T17/20—Finite element generation, e.g. wire-frame surface description, tesselation
-
- G—PHYSICS
- G16—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
- G16C—COMPUTATIONAL CHEMISTRY; CHEMOINFORMATICS; COMPUTATIONAL MATERIALS SCIENCE
- G16C10/00—Computational theoretical chemistry, i.e. ICT specially adapted for theoretical aspects of quantum chemistry, molecular mechanics, molecular dynamics or the like
-
- G—PHYSICS
- G16—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
- G16C—COMPUTATIONAL CHEMISTRY; CHEMOINFORMATICS; COMPUTATIONAL MATERIALS SCIENCE
- G16C60/00—Computational materials science, i.e. ICT specially adapted for investigating the physical or chemical properties of materials or phenomena associated with their design, synthesis, processing, characterisation or utilisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2113/00—Details relating to the application field
- G06F2113/12—Cloth
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2119/00—Details relating to the type or aim of the analysis or the optimisation
- G06F2119/14—Force analysis or force optimisation, e.g. static or dynamic forces
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Hardware Design (AREA)
- Spectroscopy & Molecular Physics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Graphics (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Medical Informatics (AREA)
- Treatment Of Fiber Materials (AREA)
Abstract
本发明公开了一种布料参数测量方法及系统,包括:获取目标布料形变前图像和形变后图像;根据形变前图像确定目标布料形变前关键点的第一坐标;关键点为人工标志点;根据形变后图像确定目标布料形变后关键点的第二坐标;根据第一坐标和第二坐标确定关键点的形变梯度;根据布料参数、关键点的形变梯度以及格林应变张量模型确定各关键点的受力;随机向各关键点进行布料参数的初始赋值;采用格林应变张量模型对布料参数进行迭代优化,得到布料参数最优值;所述布料参数最优值用于布料仿真。本发明的布料参数测量方法采用格林应变张量模型对布料进行建模,得到的布料参数准确性高,从而提高了其建模的真实性。
The invention discloses a cloth parameter measurement method and system, comprising: acquiring a pre-deformation image and a post-deformation image of a target cloth; determining a first coordinate of a key point of the target cloth before deformation according to the pre-deformation image; the key point is an artificial mark point; The deformed image determines the second coordinate of the key point after the target cloth is deformed; the deformation gradient of the key point is determined according to the first coordinate and the second coordinate; the deformation gradient of each key point is determined according to the cloth parameters, the deformation gradient of the key point and the Green strain tensor model. The initial assignment of the cloth parameters to each key point is randomly performed; the Green strain tensor model is used to iteratively optimize the cloth parameters to obtain the optimal values of the cloth parameters; the optimal values of the cloth parameters are used for cloth simulation. The cloth parameter measurement method of the present invention uses the Green strain tensor model to model the cloth, and the obtained cloth parameters have high accuracy, thereby improving the authenticity of the modeling.
Description
技术领域technical field
本发明涉及虚拟试衣技术领域,特别是涉及一种布料参数测量方法及系统。The invention relates to the technical field of virtual fitting, in particular to a method and system for measuring cloth parameters.
背景技术Background technique
随着近些年VR技术的高速发展,人类对虚拟技术产生了浓厚的兴趣,再加上各大网络购物平台的兴起,虚拟试衣应运而生,它能够让用户不用前往实体店就能够体验衣物穿在身上的效果,并且与目前大部分时尚工业生产的衣物不同,它能够根据个人喜好对衣物进行个性化的修改,真正做到了足不出户便能个性化定制衣物。虚拟试衣涉及到布料参数测量,布料参数测量需要进行布料参数化建模,目前,研究常用质点弹簧模型来建模布料的运动,但是其建模的真实性还有所欠缺。With the rapid development of VR technology in recent years, human beings have a strong interest in virtual technology. Coupled with the rise of major online shopping platforms, virtual fitting has emerged as the times require. It allows users to experience the experience without going to a physical store. The effect of clothing on the body, and unlike most of the clothing produced in the current fashion industry, it can be personalized to modify clothing according to personal preferences, and truly achieve personalized clothing without leaving home. The virtual fitting involves the measurement of fabric parameters, which requires parametric modeling of the fabric. At present, the mass-spring model is commonly used to model the movement of the fabric, but the authenticity of its modeling is still lacking.
发明内容SUMMARY OF THE INVENTION
本发明的目的是提供一种布料参数测量方法及系统。The purpose of the present invention is to provide a method and system for measuring cloth parameters.
为实现上述目的,本发明提供了如下方案:For achieving the above object, the present invention provides the following scheme:
一种布料参数测量方法,包括:A method for measuring cloth parameters, comprising:
获取目标布料形变前图像和形变后图像;Obtain the pre-deformation image and the post-deformation image of the target cloth;
根据所述形变前图像确定目标布料形变前关键点的第一坐标;所述关键点为人工标志点;Determine the first coordinates of the key point before the deformation of the target cloth according to the image before deformation; the key point is an artificial mark point;
根据所述形变后图像确定目标布料形变后关键点的第二坐标;Determine the second coordinate of the deformed key point of the target cloth according to the deformed image;
根据所述第一坐标和所述第二坐标确定所述关键点的形变梯度;Determine the deformation gradient of the key point according to the first coordinate and the second coordinate;
随机向各所述关键点进行布料参数的初始赋值;Randomly perform initial assignment of cloth parameters to each of the key points;
根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各所述关键点的受力;Determine the force of each key point according to the cloth parameter, the deformation gradient of the key point and the Green strain tensor model;
根据各关键点的受力确定损失函数值;Determine the loss function value according to the force of each key point;
根据所述损失函数值调整所述布料参数,并跳转至根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各关键点的受力步骤,直至所述损失函数值满足迭代停止条件时,停止跳转,得到布料参数最优值;所述布料参数最优值用于布料仿真。Adjust the cloth parameters according to the loss function value, and jump to the step of determining the force of each key point according to the cloth parameters, the deformation gradient of the key points and the Green strain tensor model, until the loss function value When the iteration stop condition is met, 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.
可选地,所述根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各所述关键点的受力,具体包括:Optionally, determining the force of each key point according to the cloth parameter, the deformation gradient of the key point and the Green strain tensor model, specifically includes:
根据所述关键点的形变梯度确定所述目标布料形变后图像中各所述关键点的格林应变张量;Determine 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 point;
确定所述目标布料的经纬纱方向;Determine the warp and weft direction of the target fabric;
根据所述布料参数确定所述目标布料的刚度矩阵;determining the stiffness matrix of the target cloth according to the cloth parameters;
根据所述格林应变张量和所述刚度矩阵确定所述目标布料形变后图像中各所述关键点的格林应力张量;Determine the Green's stress tensor of each of the key points in the deformed image of the target cloth according to the Green's strain tensor and the stiffness matrix;
根据所述格林应变张量和所述格林应力张量确定所述目标布料形变后图像中各所述关键点对应的应变能密度;Determine 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;
根据所述应变能密度确定所述目标布料形变后的应变能;Determine the strain energy of the target cloth after deformation according to the strain energy density;
根据所述应变能得到各所述关键点的加速度;Obtain the acceleration of each of the key points according to the strain energy;
确定各所述关键点的质量;determine the quality of each of said key points;
根据所述加速度和所述关键点的质量计算各所述关键点的受力。The force of each key point is calculated according to the acceleration and the mass of the key point.
可选地,采用Adam自适应梯度下降法对所述布料参数进行迭代优化。Optionally, using Adam adaptive gradient descent method to iteratively optimize the cloth parameters.
可选地,所述目标布料为网格布料,所述关键点为网格的交界点;所述根据所述应变能密度确定所述目标布料形变后的应变能,具体包括:将所述目标布料形变前图像或所述目标布料形变后图像网格沿对角线划分为三角形网格;Optionally, the target cloth is a mesh cloth, and the key point is a junction point of the grid; the determining the deformed strain energy of the target cloth according to the strain energy density specifically includes: placing the target The image grid before the cloth is deformed or the image grid after the target cloth is deformed is divided into triangular grids along the diagonal;
根据所述应变能密度和所述关键点所在三角形网格面积确定所述三角形网格的应变能;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 deformed strain energy of the target cloth is determined according to the strain energy of each of the triangular meshes.
可选地,采用最小二乘法得到各所述关键点的坐标。Optionally, a least square method is used to obtain the coordinates of each of the key points.
一种布料参数测量系统,该系统包括:A cloth parameter measurement system, the system includes:
图像获取模块,用于获取目标布料形变前图像和形变后图像;The image acquisition module is used to acquire the pre-deformation image and the post-deformation image of the target cloth;
第一坐标获取模块,用于根据所述形变前图像确定目标布料形变前关键点的第一坐标;所述关键点为人工标志点;a first coordinate acquisition module, configured to determine the first coordinate of the key point before the deformation of the target cloth according to the image before deformation; the key point is an artificial mark point;
第二坐标获取模块,用于根据所述形变后图像确定目标布料形变后关键点的第二坐标;A second coordinate acquisition module, configured to determine the second coordinates of the deformed key points of the target cloth according to the deformed image;
形变梯度确定模块,用于根据所述第一坐标和所述第二坐标确定所述关键点的形变梯度;a deformation gradient determination module, configured to determine the deformation gradient of the key point according to the first coordinate and the second coordinate;
布料参数的初始赋值模块,用于随机向各所述关键点进行布料参数的初始赋值;The initial assignment module of the cloth parameters is used to randomly assign the initial assignment of the cloth parameters to each of the key points;
关键点的受力确定模块,用于根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各所述关键点的受力;The force determination module of the key points is used to 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;
损失函数值确定模块,用于根据各关键点的受力确定损失函数值;The loss function value determination module is used to determine the loss function value according to the force of each key point;
布料参数最优值确定模块,用于根据所述损失函数值调整所述布料参数,并跳转至根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各关键点的受力步骤,直至所述损失函数值满足迭代停止条件时,停止跳转,得到布料参数最优值;所述布料参数最优值用于布料仿真。The module for determining the optimal value of the cloth parameter is used to adjust the cloth parameter according to the loss function value, and jump to the method of determining each key point according to the cloth parameter, the deformation gradient of the key point and the Green strain tensor model. In the stressing step, when the loss function value satisfies the iterative 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 the cloth simulation.
可选地,所述关键点的受力确定模块具体包括:根据所述关键点的形变梯度确定所述目标布料形变后图像中各所述关键点的格林应变张量;确定所述目标布料的经纬纱方向;根据所述布料参数确定所述目标布料的刚度矩阵;根据所述格林应变张量和所述刚度矩阵确定所述目标布料形变后图像中各所述关键点的格林应力张量;根据所述格林应变张量和所述格林应力张量确定所述目标布料形变后图像中各所述关键点对应的应变能密度;根据所述应变能密度确定所述目标布料形变后的应变能;根据所述应变能得到各所述关键点的加速度;确定各所述关键点的质量;根据所述加速度和所述关键点的质量计算各所述关键点的受力。Optionally, the force determination module of the key point 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; Warp and weft direction; determine the stiffness matrix of the target fabric according to the fabric parameters; determine the Green stress tensor of each of the key points in the deformed image of the target fabric according to the Green strain tensor and the stiffness matrix; Determine 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; determine the strain energy of the target cloth after deformation according to the strain energy density ; obtain the acceleration of each key point according to the strain energy; determine the mass of each key point; calculate the force of each key point according to the acceleration and the mass of the key point.
可选地,采用Adam自适应梯度下降法对所述布料参数进行迭代优化。Optionally, using Adam adaptive gradient descent method to iteratively optimize the cloth parameters.
可选地,所述目标布料为网格布料,所述关键点为网格的交界点;所述根据所述应变能密度确定所述目标布料形变后的应变能,具体包括:将所述目标布料形变前图像或所述目标布料形变后图像网格沿对角线划分为三角形网格;Optionally, the target cloth is a mesh cloth, and the key point is a junction point of the grid; the determining the deformed strain energy of the target cloth according to the strain energy density specifically includes: placing the target The image grid before the cloth is deformed or the image grid after the target cloth is deformed is divided into triangular grids along the diagonal;
根据所述应变能密度和所述关键点所在三角形网格面积确定所述三角形网格的应变能;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 deformed strain energy of the target cloth is determined according to the strain energy of each of the triangular meshes.
可选地,采用最小二乘法得到各所述关键点的坐标。Optionally, a least square method is used to obtain the coordinates of each of the key points.
根据本发明提供的具体实施例,公开了以下技术效果:获取目标布料形变前图像和形变后图像;根据所述形变前图像确定目标布料形变前关键点的第一坐标;所述关键点为人工标志点;根据所述形变后图像确定目标布料形变后关键点的第二坐标;根据所述第一坐标和所述第二坐标确定所述关键点的形变梯度;随机向各所述关键点进行布料参数的初始赋值;根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各所述关键点的受力;根据各关键点的受力确定损失函数值;根据所述损失函数值调整所述布料参数,并跳转至根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各关键点的受力步骤,直至所述损失函数值满足迭代停止条件时,停止跳转,得到布料参数最优值;所述布料参数最优值用于布料仿真。本发明的布料参数测量方法采用格林应变张量模型对布料进行建模,得到的布料参数准确性高,从而提高了其建模的真实性。According to the specific embodiments provided by the present invention, the following technical effects are disclosed: obtaining the pre-deformation image and the post-deformation image of the target cloth; determining the first coordinates of the pre-deformation key points of the target cloth according to the pre-deformation images; the key points are artificial mark point; determine the second coordinate of the deformed key point of the target cloth according to the deformed image; determine the deformation gradient of the key point according to the first coordinate and the second coordinate; initial assignment of the cloth parameters; determine the force of each key point according to the cloth parameter, the deformation gradient of the key point and the Green strain tensor model; determine the loss function value according to the force of each key point; according to the The loss function value adjusts the cloth parameter, and jumps to the step of determining the force of each key point according to the cloth parameter, the deformation gradient of the key point and the Green strain tensor model, until the loss function value satisfies the iteration stop When conditions are met, 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. The cloth parameter measurement method of the present invention uses the Green strain tensor model to model the cloth, and the obtained cloth parameters have high accuracy, thereby improving the authenticity of the modeling.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings required in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some of the present invention. In the embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without creative labor.
图1为本发明实施例1提供的布料参数测量方法流程示意图;1 is a schematic flowchart of a method for measuring a cloth parameter provided in Embodiment 1 of the present invention;
图2为本发明实施例1提供的目标布料受到砝码施加的外力发生形变后图片;2 is a picture after the target cloth provided in Embodiment 1 of the present invention is deformed by an external force exerted by a weight;
图3为本发明实施例1提供的三角网格划分示意图;3 is a schematic diagram of triangular mesh division provided in Embodiment 1 of the present invention;
图4为本发明实施例1提供的测试函数v的作用图;Fig. 4 is the action diagram of the test function v provided in Embodiment 1 of the present invention;
图5为本发明实施例1提供的采用格林应变张量模型优化得到的效果图;5 is an effect diagram obtained by using the Green strain tensor model optimization provided in Embodiment 1 of the present invention;
图6为本发明实施例1提供的采用质点弹簧模型优化得到的效果图;Fig. 6 is the effect diagram obtained by adopting the mass spring model optimization provided by Embodiment 1 of the present invention;
图7为本发明实施例1提供的采用格林应变张量模型以及第二布料参数最优值进行仿真的效果图;7 is an effect diagram of simulation using the Green strain tensor model and the optimal value of the second cloth parameter provided in Embodiment 1 of the present invention;
图8为本发明实施例1提供的采用质点弹簧模型以及图6优化得到的布料参数进行仿真的效果图;FIG. 8 is an effect diagram of simulation provided by the embodiment 1 of the present invention using the mass spring model and the cloth parameters obtained by optimization in FIG. 6;
图9为采用本发明的格林应变张量模型优化得到的布料参数进行悬挂布料仿真效果图;9 is a simulation effect diagram of hanging cloth by using cloth parameters optimized by the Green strain tensor model of the present invention;
图10为采用本发明的格林应变张量模型优化得到的布料参数进行布料掉落在球体上仿真效果图;10 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;
图11为本发明实施例2提供的布料参数测量系统结构图。FIG. 11 is a structural diagram of a cloth parameter measurement system provided in Embodiment 2 of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
本发明的目的是提供一种布料参数测量方法及系统,该方法采用格林应变张量模型对布料进行建模,得到的布料参数准确性高,从而提高了其建模的真实性。The purpose of the present invention is to provide a cloth parameter measurement method and system. The method adopts the Green strain tensor model to model the cloth, and the obtained cloth parameters have high accuracy, thereby improving the authenticity of the modeling.
为使本发明的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本发明作进一步详细的说明。In order to make the above objects, features and advantages of the present invention more clearly understood, the present invention will be described in further detail below with reference to the accompanying drawings and specific embodiments.
实施例1Example 1
本发明提供了一种布料参数测量方法,参见图1,该方法包括以下步骤:The present invention provides a method for measuring cloth parameters, referring to FIG. 1 , the method includes the following steps:
步骤101:获取目标布料形变前图像和形变后图像。Step 101: Acquire a pre-deformation image and a post-deformation image of the target cloth.
在本实施例中,将目标布料沿着某一个经纬纱方向裁剪为方形,利用鱼线和砝码对布料施加外力以使布料发生形变,并用双目相机拍摄获取目标布料形变前图像和目标布料形变后图像,形变后的图像如图2所示,所述目标布料可为任何材质的布料。In this embodiment, the target cloth is cut into a square along a certain warp and weft direction, and the cloth is deformed by applying external force to the cloth by using fishing line and weight, and the image of the target cloth before the deformation and the target cloth are obtained by shooting with a binocular camera. The deformed image, the deformed image is shown in Figure 2, and the target cloth can be cloth of any material.
步骤102:根据所述形变前图像确定目标布料形变前关键点的第一坐标;所述关键点为人工标志点。Step 102: Determine the first coordinates of the key point before the deformation of the target cloth according to the image before deformation; the key point is an artificial mark point.
步骤103:根据所述形变后图像确定目标布料形变后关键点的第二坐标。Step 103: Determine the second coordinates of the deformed key points of the target cloth according to the deformed image.
在本实施例中,采用Matlab进行角点检测,以得到两张照片中布料网格交界点的像素坐标,这些交界点又被称为关键点,通过这些关键点,可以重建出这块布料。为了将交界点的像素坐标转换为世界坐标,这需要用到相机的内外参,如下式所示:In this embodiment, Matlab is used for corner detection to obtain the pixel coordinates of the intersection points of the cloth grids in the two photos. These intersection points are also called key points, and through these key points, the piece of cloth can be reconstructed. In order to convert the pixel coordinates of the junction point to world coordinates, this requires the use of internal and external parameters of the camera, as shown in the following formula:
其中,等号右边的两个矩阵分别为相机的内参矩阵和外参矩阵,内参矩阵中的fx与fy为相机的焦距,x0与y0为主点坐标,而s为坐标轴倾斜参数,外参矩阵中3x3的R元素为相机的旋转矩阵,而外参矩阵中3x1的列向量为相机的平移矩阵,相机的内外参矩阵可以通过相机标定的方式得到,u、v为关键点的像素坐标,而X、Y、Z为得到的关键点的世界坐标。若令内外参矩阵的乘积为m矩阵,如下式所示:Among them, the two matrices on the right side of the equal sign are the internal parameter matrix and the external parameter matrix of the camera, respectively, f x and f y in the internal parameter matrix are the focal length of the camera, x 0 and y 0 are the main point coordinates, and s is the coordinate axis tilt Parameters, the R element of 3x3 in the external parameter matrix is the rotation matrix of the camera, and the column vector of 3x1 in the external parameter matrix is the translation matrix of the camera. The internal and external parameter matrix of the camera can be obtained by the way of camera calibration, u, v are the key points The pixel coordinates of , and X, Y, and Z are the world coordinates of the obtained key points. If the product of the internal and external parameter matrices is the m matrix, the following formula is shown:
其中,m矩阵中的元素为相机的内外参矩阵对应行列元素相乘。则式(1)可以写作: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 matrix. The formula (1) can be written as:
将(3)中矩阵展开后可以得到:After expanding the matrix in (3), we can get:
(um31-m11)X+(um32-m12)Y+(um33-m13)Z=m14-um34 (4)(um 31 -m 11 )X+(um 32 -m 12 )Y+(um 33 -m 13 )Z=m 14 -um 34 (4)
(vm31-m21)X+(vm32-m22)Y+(vm33-m23)Z=m24-vm34 (5)(vm 31 -m 21 )X+(vm 32 -m 22 )Y+(vm 33 -m 23 )Z=m 24 -vm 34 (5)
对于该关键点,目前有两个方程,但是有三个未知数需要求解。由于采用两个相机,所以会得到两个上述方程组,即四个方程,这就变成了超定方程组的求解。采用最小二乘法即可得到该关键点的世界坐标。For this keypoint, there are currently two equations, but three unknowns to solve. Since two cameras are used, two of the above equations, four equations are obtained, which becomes the solution of the overdetermined equations. The world coordinates of the key point can be obtained by using the least squares method.
将布料沿着不同的经纬纱方向进行裁剪,得到多个方块布料,通过双目相机得到多组目标布料形变前图像和形变后图像,重复步骤101-103,则可以得到若干组关键点的坐标。将这些组随机划分为训练组和测试组,训练组用于优化布料参数,测试组用于测试优化得到的布料参数的好坏。Cut the fabric along different warp and weft directions to obtain multiple square fabrics, obtain multiple sets of pre-deformed and post-deformed images of the target fabric through the binocular camera, and repeat steps 101-103 to obtain the coordinates of several sets of key points . These groups are randomly divided into training group and test group, the training group is used to optimize the cloth parameters, and the test group is used to test the quality of the optimized cloth parameters.
步骤104:根据所述第一坐标和所述第二坐标确定所述关键点的形变梯度。Step 104: Determine the deformation gradient of the key point according to the first coordinate and the second coordinate.
步骤105:随机向各所述关键点进行布料参数的初始赋值。Step 105: Randomly perform initial assignment of cloth parameters to each of the key points.
步骤106:根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各所述关键点的受力。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.
步骤107:根据各关键点的受力确定损失函数值。Step 107: Determine the loss function value according to the force of each key point.
步骤108:根据所述损失函数值调整所述布料参数,并跳转至根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各关键点的受力步骤,直至所述损失函数值满足迭代停止条件时,停止跳转,得到布料参数最优值;所述布料参数最优值用于布料仿真。Step 108: Adjust the cloth parameters according to the loss function value, and jump to the step of determining the force of each key point according to the cloth parameters, the deformation gradient of the key points, and the Green strain tensor model, until the When the loss function value satisfies the iterative 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.
在本实施例中,步骤104-步骤108为确定布料参数最优值的过程,具体如下:In this embodiment, steps 104 to 108 are the process of determining the optimal value of the cloth parameters, and the details are as follows:
将步骤103得到的训练组的关键点形变前和形变后的世界坐标作为输入,为布料进行建模,建模方式如下:Use the world coordinates of the key points of the training group obtained in
将输入的关键点连接成正方形网格,之后按照图3的方式连接正方形网格的对角线就可以将布料划分为诸多三角网格,例如△ABC和△BCD,它们维持着布料的基本形态,控制着布料的拉伸,虽然这些三角网格的存在可以抵御布料垂直于BC边的弯曲,但是它们无法抵御布料沿着BC边的弯曲,为此需要引入另一类三角网格。连接正方形网格的另一条对角线得到不同方向的另一组三角网格,例如△ABD和△ACD,它们可以抵御布料沿着BC边的弯曲,当然它们也控制着布料的拉伸。这两类三角网格的配合可以控制布料的拉伸与弯曲,会使得形变后的布料有一种朝着形变前形态变化的趋势。分别为形变前的关键点和形变后的关键点生成三角网格,一共两组。对于形变前的每个三角网格,以该三角网格的重心作为原点,以该三角网格平面作为XOY平面建立二维材料坐标系,从而计算出该三角网格三个关键点的材料坐标系坐标,由于材料坐标系是二维的,所以计算出的材料坐标系坐标也是二维的。而对于形变后的每个三角网格,使用步骤103得到的关键点的三维世界坐标系坐标。Connect the input key points into a square grid, and then connect the diagonal lines of the square grid as shown in Figure 3 to divide the cloth into many triangular grids, such as △ABC and △BCD, which maintain the basic shape of the cloth , controls the stretching of the cloth. Although the existence of these triangular meshes can resist the bending of the cloth perpendicular to the BC edge, they cannot resist the bending of the cloth along the BC edge, so another type of triangular mesh needs to be introduced. Connect another diagonal of the square mesh to get another set of triangle meshes in different directions, such as △ABD and △ACD, which can resist the bending of the cloth along the BC edge, and of course they also control the stretching of the cloth. The cooperation of these two types of triangular meshes can control the stretching and bending of the cloth, which will make the deformed cloth tend to change towards the shape before the deformation. Triangular meshes are generated for the key points before deformation and the key points after deformation, a total of two groups. For each triangular mesh before deformation, take the center of gravity of the triangular mesh as the origin, and use the triangular mesh plane as the XOY plane to establish a two-dimensional material coordinate system, so as to calculate the material 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 deformed triangular mesh, the three-dimensional world coordinate system coordinates of the key points obtained in
利用格林应变张量对关键点进行受力计算,其公式如下:Using Green's strain tensor to calculate the force on key points, the formula is as follows:
(dL)2-(dl)2=dxdx-dudu=Fdu*Fdu-dudu=duT(FTF-I)du=2duT*∈*du (6)(dL) 2 -(dl) 2 =dxdx-dudu=Fdu*Fdu-dudu=du T (F T FI)du=2du T *∈*du (6)
其中dL和dl分别为形变后与形变前线元的长度,而dx和du分别为形变后与形变前的线元,它们是一对矢量,而F为形变梯度,I为单位矩阵,∈为关键点的格林应变张量。进一步地,形变梯度等于线元形变后的世界坐标系坐标对形变前的材料坐标系坐标的导数,可以得到如下式子:where dL and dl are the lengths of the line elements after deformation and before deformation, respectively, while dx and du are the line elements after deformation and before deformation, respectively, they are a pair of vectors, and F is the deformation gradient, I is the unit matrix, and ∈ is the key Green's strain tensor of points. Further, the deformation gradient is equal to the derivative of the coordinates of the world coordinate system after the deformation of the line element to the coordinates of the material coordinate system before the deformation, and the following formula can be obtained:
其中x为线元形变后的世界坐标系坐标,u为线元形变前的材料坐标系坐标,δ为克罗内克符号。在格林应变张量模型中,使用上述得到的三角网格三个关键点形变前的材料坐标系坐标,通过三角网格的重心坐标可以表示该三角网格中任意点形变前的材料坐标系坐标,公式如下:where x is the coordinate of the world coordinate system after the line element is deformed, u is the coordinate of the material coordinate system before the line element is deformed, and δ is the Kronecker symbol. In the Green strain tensor model, the material coordinate system coordinates before the deformation of the three key points of the triangular grid obtained above are used, and the barycentric coordinates of the triangular grid can represent the material coordinate system coordinates of any point in the triangular grid before the deformation. , the formula is as follows:
其中u为该任意点形变前的材料坐标系坐标,m为该三角网格三个关键点形变前的材料坐标系坐标,b为重心坐标。该任意点形变后的世界坐标系坐标也可以用同样的方式表示如下:Among them, u is the material coordinate system coordinate before the deformation of the arbitrary point, m is the material coordinate system coordinate before the deformation of the three key points of the triangular mesh, and b is the barycentric coordinate. The coordinates of the world coordinate system after the deformation of the arbitrary point can also be expressed as follows in the same way:
其中x为该任意点形变后的世界坐标系坐标,p为该三角网格三个关键点形变后的世界坐标系坐标,即步骤103中的第二坐标。联立式(8)和(9)得到:Wherein x is the coordinates of the world coordinate system after the deformation of the arbitrary point, and p is the coordinates of the world coordinate system after the deformation of the three key points of the triangular mesh, that is, the second coordinates in
其中:in:
该任意点的形变梯度就可以表示如下:The deformation gradient of this arbitrary point can be expressed as follows:
其中:δi=[δi1δi20] (14)Where: δ i =[δ i1 δ i2 0] (14)
当δ下标相同时,δ值为1,否则δ值为0。When the δ subscripts are the same, the value of δ is 1, otherwise the value of δ is 0.
由上式可见:任意点的形变梯度与所述任意点的位置无关,即同一三角网格内任意点的形变梯度与所述关键点的形变梯度相同。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.
根据上述得到的所述关键点的格林应变张量以及刚度矩阵确定所述目标布料形变后图像中各所述关键点的格林应力张量,其计算过程如下:According to the Green's strain tensor and stiffness matrix of the key points obtained above, determine the Green's stress tensor of each of the key points in the deformed image of the target cloth, and the calculation process is as follows:
其中∈11和∈22为线应变,而∈12为剪应变,都是上述计算得到的,而σ11、σ22和σ12为对应的三个格林应力。刚度矩阵中的参数就是需要测量得到的布料参数,一共有九个。布料具有各向异性的特征,而各向异性的材料对应的刚度矩阵一般而言是非对称矩阵,但是考虑到这将增加整个布料模型的复杂性,所以从工程实用角度的上来讲,往往忽略这种不对称性,而将其处理为对称矩阵,对称的刚度矩阵如下所示:Among them, ∈ 11 and ∈ 22 are line strains, and ∈ 12 are shear strains, which are obtained from the above calculations, 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, and there are nine in total. Cloth has the characteristics of anisotropy, and the stiffness matrix corresponding to anisotropic materials is generally an asymmetric matrix, but considering that this will increase the complexity of the entire cloth model, from the perspective of engineering practicality, this is often ignored. asymmetry, and treat it as a symmetric matrix, the symmetric stiffness matrix is as follows:
将刚度矩阵进一步简化,简化后的刚度矩阵如下:The stiffness matrix is further simplified, and the simplified stiffness matrix is as follows:
其中,cij为j方向的形变对i方向产生的力的影响因子。Among them, c ij is the influence factor of the deformation in the j direction on the force generated in the i direction.
在本实施例,随机向各所述关键点进行布料参数的初始赋值,具体的:测量的经纬纱方向为六个,按照布料的经纱与世界坐标系坐标轴的夹角来划分,依次为0°、30°、60°、90°、120°和150°,随机生成96个布料参数初值。首先确定整块目标布料的经纱方向,然后计算该经纱方向与世界坐标系坐标轴的夹角,最后利用该夹角在初始生成的六个经纬纱方向的布料参数中进行线性插值得到所述目标布料刚度矩阵中的参数。由于刚度矩阵中的参数是布料的属性,所以所有三角网格都应该共用一个刚度矩阵。In this embodiment, the initial assignment of the cloth parameters is randomly performed to each of the key points, specifically: the measured warp and weft directions are six, which are divided according to the angle between the warp of the cloth and the coordinate axis of the world coordinate system, and the order is 0 °, 30°, 60°, 90°, 120° and 150°, 96 initial values of cloth parameters are randomly generated. First determine the warp direction of the entire target cloth, then calculate the angle between the warp direction and the coordinate axis of the world coordinate system, and finally use the angle to perform linear interpolation in the cloth parameters of the six initially generated warp and weft directions to obtain the target Parameters in the cloth stiffness matrix. Since the parameters in the stiffness matrix are properties of the cloth, all triangle meshes should share a stiffness matrix.
根据上述得到的格林应变张量和格林应力张量确定所述目标布料形变后图像中各所述关键点对应的应变能密度,其公式如下:According to the Green strain tensor and Green stress tensor obtained above, determine the strain energy density corresponding to each of the key points in the deformed image of the target cloth, and the formula is as follows:
其中,ψ为所述关键点对应的应变能密度,∈为关键点的格林应变张量,σ为关键点的格林应力张量。Among them, ψ is the strain energy density corresponding to the key point, ∈ is the Green's strain tensor of the key point, and σ is the Green's stress tensor of the key point.
根据所述应变能密度确定所述目标布料形变后的应变能,一个三角网格中任意点的格林应力张量和格林应变张量都相同,所以计算得到的应变能密度也相同,从而积分将变为应变能密度乘以该三角网格面积的方式来获取该三角网格的应变能。之后将所有三角网格的应变能相加就可以得到所述目标布料形变后的应变能。Determine the strain energy of the target cloth after deformation according to the strain energy density. The Green's stress tensor and Green's strain tensor at any point in a triangular mesh are the same, so the calculated strain energy density is also the same, so the integral will be The strain energy of the triangular grid is obtained by multiplying the strain energy density by the area of the triangular grid. Then, the strain energies of all triangular meshes can be added to obtain the strain energy of the target cloth after deformation.
使用拉格朗日力学方程进行受力计算,完整的拉格朗日力学方程如下:The force calculation is performed using the Lagrangian mechanics equation. The complete Lagrangian mechanics equation is as follows:
其中x为线元形变后的世界坐标系坐标,u为线元形变前的材料坐标系坐标,where x is the coordinate of the world coordinate system after the deformation of the line element, u is the coordinate of the material coordinate system before the deformation of the line element,
为形变后的线元在世界坐标系中的速度,Q为线元受到的外力,L为所述目标布料的拉格朗日量,其表达式如下: is the velocity of the deformed line element in the world coordinate system, Q is the external force received by the line element, L is the Lagrangian of the target cloth, and its expression is as follows:
L=T-V (20)L=T-V (20)
其中,T为所述目标布料的动能,V为所述目标布料的势能。x由u经过形变得到,所以x是u的函数;确定了线元形变前的材料坐标系坐标,就可以得到该线元所受的外力,所以Q是u的函数;而拉格朗日量表征布料形变后的能量,所以L为x和的函数。考虑到L对于整块布料空间而言并非是连续的,至少从三角网格交界处来看,它并不是连续的,所以引入弱形式来对它进行求解,式子如下:Wherein, T is the kinetic energy of the target cloth, and V is the potential energy of the target cloth. x is transformed by u, so x is a function of u; if the coordinates of the material coordinate system before the deformation of the line element are determined, the external force on the line element can be obtained, so Q is a function of u; and the Lagrangian quantity represents the energy of the cloth after deformation, so L is x and The function. Considering that L is not continuous for the entire cloth space, at least from the point of view of the triangular mesh junction, it is not continuous, so a weak form is introduced to solve it, the formula is as follows:
弱形式将处处相等弱化为了在所述目标布料中积分的面积总和相等,引入一个测试函数v来增强这个式子,以表示在测试函数v的值非零的狭小区域中可以弱化为积分的面积总和相等:The weak form weakens equality everywhere. In order to equalize the sum of the integrated areas in the target cloth, a test function v is introduced to enhance this formula to express the area that can be weakened to the integral in a narrow region where the value of the test function v is non-zero. The sum is equal:
测试函数v的作用如图4所示。将L写成T-V的形式,由于动能对位置的导数为零,而势能对速度的导数为零,所以代入可以得到:The role of the test function v is shown in Figure 4. Write L in the form of T-V, since the derivative of kinetic energy to position is zero, and the derivative of potential energy to velocity is zero, so substitution can be obtained:
上式为泛函的导数,由泛函导数的定义式:The above formula is the derivative of the functional, which is defined by the formula of the derivative of the functional:
与动能和势能的表达式:Expressions with kinetic and potential energies:
V=∫w(Ψ+ρgTx)du (26)V=∫ w (Ψ+ρg T x)du (26)
其中ρ为布料的面密度,Ψ为步骤四输出的应变能,g为重力加速度,最终可以得到:where ρ is the areal density of the cloth, Ψ is the strain energy output in step 4, and g is the acceleration of gravity. Finally, we can get:
其中表示形变后的世界坐标系坐标对形变前的材料坐标系坐标x分量的偏导数,表示形变后的世界坐标系坐标依次对形变前的材料坐标系坐标x和y分量的偏导数,以此类推。然后引入有限元法来将连续的目标布料离散为三角网格。对于布料空间中任意点的坐标,可用关键点的坐标来表示,如下:in Represents the partial derivative of the coordinates of the world coordinate system after deformation to the x component of the coordinates of the material coordinate system before deformation, Indicates the partial derivatives of the coordinates of the world coordinate system after deformation to the x and y components of the coordinates of the material coordinate system before deformation, and so on. Then the finite element method is introduced to discretize the continuous target cloth into triangular meshes. The coordinates of any point in cloth space can be represented by the coordinates of key points, as follows:
其中表示第I个关键点形变后的世界坐标系坐标,NI表示第I个关键点的权重,之所以用关键点形变前的材料坐标系坐标作为自变量,是因为不管布料空间中的顶点如何发生形变,该关键点坐标的权重不会改变。在之前的弱形式中,引入了测试函数v,并说明它是一个时而为零时而非零的函数,用于将积分分为一个个狭小的区域,以便增强弱形式。这里的权重就具有这样的性质,当点位于该关键点组成的三角网格中时,权重非零,其余情况权重均为零,所以另v=NK,可以得到如下式子:in Represents the world coordinate system coordinates of the I-th key point after deformation, and N I represents the weight of the I-th key point. The reason why the material coordinate system coordinates before the key point deformation is used as an independent variable is because regardless of the vertices in the cloth space. Deformation occurs, and the weight of the key point coordinates does not change. In the previous weak form, the test function v was introduced and stated to be a function that is sometimes zero but not zero to divide the integral into small regions in order to strengthen the weak form. The weight here has such a property. When the point is located in the triangular mesh composed of the key point, the weight is non-zero, and in other cases, the weight is zero, so the other v=N K , the following formula can be obtained:
MKI=∫wρNINKdu (30)M KI =∫ w ρN I N K du (30)
其中MKI为质量矩阵。将上述得到的所述目标布料形变后的应变能带入,可以计算得到形变后每个关键点的加速度。where MKI is the quality matrix. Bringing in the strain energy of the target cloth obtained above after deformation, the acceleration of each key point after deformation can be calculated.
在本实施例中,关键点的有效面积由包含它的三角网格决定。由于关键点的质量不应该随着三角网格的形变而发生改变,所以用形变前的三角网格来做计算。计算包含所述关键点的每个三角网格的初始面积,将每个面积除以三来作为每一三角网格属于该关键点的有效面积,之后将所有有效面积相加即为所述关键点的有效面积,最后乘以布料材质的密度即可得到各所述关键点的质量。In this embodiment, the effective area of a key point is determined by the triangular mesh that contains it. Since the quality of the key points should not change with the deformation of the triangular mesh, the triangular mesh before deformation is used for the calculation. Calculate the initial area of each triangular mesh containing the key point, divide each area by three to obtain the effective area of each triangular mesh belonging to the key point, and then add all the effective areas to be the key The effective area of the point is finally multiplied by the density of the cloth material to obtain the quality of each of the key points.
然后根据上述得到的所述关键点的加速度和所述关键点的质量计算各所述关键点的受力。Then, the force of each key point is calculated according to the acceleration of the key point and the mass of the key point obtained above.
在本实施例中,步骤107和步骤108中计算损失函数值以及根据损失函数值布料参数调整的过程,可以如下:In this embodiment, the process of calculating the loss function value in
所述布料参数对应的损失值计算如下:The loss value corresponding to the cloth parameter is calculated as follows:
其中kn为第n次迭代优化得到的参数,I为关键点数量,fi为形变后第i个关键点受到的合力。该损失函数计算所有关键点合力的平均值,损失函数越小说明布料越处于准静态。之后采用Adam自适应梯度下降法和PSO粒子群算法对损失函数进行优化迭代,具体优化过程如下:Where k n is the parameter obtained by the nth iteration optimization, I is the number of key points, and f i is the resultant force received by the i-th key point after deformation. The 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. After that, the Adam adaptive gradient descent method and the PSO particle swarm algorithm are used to optimize the loss function. The specific optimization process is as follows:
步骤S1:首先采用Adam自适应梯度下降法进行优化迭代,选取初始步长为0.01,每迭代一万次补偿就缩小十倍,其余参数按照标准设置为0.9、0.999以及1e-8。将步骤105随机生成的96个参数作为初值,重复步骤104-107,即计算形变后布料的应变能、形变后关键点的受力以及损失函数值来优化这些参数,以得到第一布料参数最优值。Step S1: First, the Adam adaptive gradient descent method is used for optimization iteration. The initial step size is selected as 0.01, and the compensation is reduced by ten times every 10,000 iterations. The remaining parameters are set to 0.9, 0.999 and 1e-8 according to the standard. Take the 96 parameters randomly generated in
步骤S2:对步骤S1得到的第一布料参数最优值,利用PSO粒子群算法进行进一步地优化。具体的PSO算法的参数为50个粒子,搜索的初速度为在-0.01到0.01之间的随机数,最终会得到第二布料参数最优值。Step S2: The optimal value of the first cloth parameter obtained in step S1 is further optimized by using the PSO particle swarm algorithm. The specific parameters of the PSO algorithm are 50 particles, and the initial speed of the search is a random number between -0.01 and 0.01, and finally the optimal value of the second cloth parameter will be obtained.
图5为采用第二布料参数最优值得到的结果,loss为0.0016。为了做比较,使用同样数量的参数对质点弹簧模型做优化,图6为采用质点弹簧模型优化得到的最终结果,loss为0.0211。显然,在同样数量的参数的情况下,对于布料建模,格林应变张量模型相比于质点弹簧模型而言更为精确。Figure 5 shows the result obtained by using the optimal value of the second cloth parameter, and the loss is 0.0016. For comparison, the mass-spring model is optimized with the same number of parameters. Figure 6 shows the final result obtained by optimizing the mass-spring model, with a loss of 0.0211. Obviously, the Green strain tensor model is more accurate than the mass spring model for cloth modeling with the same number of parameters.
下面采用测试组对步骤108得到的布料参数进行验证:The following uses the test group to verify the cloth parameters obtained in step 108:
步骤1:采用测试组的关键点的世界坐标进行仿真,第一次仿真迭代不存在内力,即步骤106得到的布料应变能为0,因为布料并没有发生形变,但是由于布料受到外力的作用,得到非零的关键点的加速度。使用Verlet显式积分来进行仿真迭代,其基于泰勒展开,公式如下:Step 1: Use the world coordinates of the key points of the test group for simulation. There is no internal force in the first simulation iteration, that is, the strain energy of the cloth obtained in
x(t+δt)=2x(t)-x(t-δt)+a(t)δt2+O(δt4) (34)x(t+δt)=2x(t)-x(t-δt)+a(t)δt 2 +O(δt 4 ) (34)
x(t+δt)=2x(t)-x(t-δt)+a(t)δt2 (35)x(t+δt)=2x(t)-x(t-δt)+a(t)δt 2 (35)
忽略掉高次项,确定时间步长后,通过关键点当前仿真迭代的位置与加速度得到关键点下一次仿真迭代的位置,所述时间步长取0.1ms。Ignoring high-order terms, after determining the time step, the position of the next simulation iteration of the key point is obtained through the position and acceleration of the current simulation iteration of the key point, and the time step is 0.1ms.
步骤2:设定一定的仿真迭代次数,或者查看是否大部分关键点相邻两次仿真迭代的位移都小于给定的阈值来停止仿真迭代,最终得到所有关键点仿真后的位置。Step 2: Set a certain number of simulation iterations, or check whether the displacement of most key points in two adjacent simulation iterations is less than a given threshold to stop the simulation iteration, and finally get the simulated positions of all key points.
步骤3:将步骤2得到的所有关键点仿真后的位置与测试组中形变后关键点的世界坐标的差值做二范数计算,将计算结果作为衡量采用第二布料参数最优值的标准。如图7所示,采用格林应变张量模型配合第二布料参数最优值进行仿真的效果图,仿真迭代得到的关键点相对于测试组groundtruth的平均偏差位移为4.36mm。图8为采用质点弹簧模型配合图6优化得到的参数进行仿真的效果图,仿真迭代得到的关键点相对于测试组groundtruth的平均偏差位移为7.08mm,因此,在同样数量参数的情况下,对于布料建模,格林应变张量模型比质点弹簧模型更为精确。Step 3: Calculate the difference between the simulated positions of all the key points obtained in step 2 and the world coordinates of the deformed key points in the test group as a second norm, and use the calculation result as the standard to measure the optimal value of the second cloth parameter. . As shown in Figure 7, the effect of the simulation using the Green strain tensor model and the optimal value of the second cloth parameter, the average deviation displacement of the key points obtained by the simulation iteration relative to the test group groundtruth is 4.36mm. Figure 8 is the effect diagram of the simulation using the mass-spring model and the parameters optimized in Figure 6. The average deviation displacement of the key points obtained by the simulation iteration relative to the test group groundtruth is 7.08mm. Therefore, with the same number of parameters, for For cloth modeling, the Green strain tensor model is more accurate than the mass-spring model.
图9和图10基于本发明得到的布料参数对布料进行了仿真,图9为悬挂布料仿真效果图,图10为布料掉落在球体上仿真效果图。Fig. 9 and Fig. 10 simulate the cloth based on the cloth parameters obtained by the present invention, Fig. 9 is the simulation effect diagram of the hanging cloth, and Fig. 10 is the simulation effect diagram of the cloth falling on the sphere.
实施例2Example 2
本发明还提供了一种布料参数测量系统,参见图11,该系统包括:The present invention also provides a cloth parameter measurement system, see FIG. 11 , the system includes:
图像获取模块201,用于获取目标布料形变前图像和形变后图像。The
第一坐标获取模块202,用于根据所述形变前图像确定目标布料形变前关键点的第一坐标;所述关键点为人工标志点。The first coordinate
第二坐标获取模块203,用于根据所述形变后图像确定目标布料形变后关键点的第二坐标。The second coordinate
形变梯度确定模块204,用于根据所述第一坐标和所述第二坐标确定所述关键点的形变梯度。A deformation
布料参数的初始赋值模块205,用于随机向各所述关键点进行布料参数的初始赋值。The
关键点的受力确定模块206,用于根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各所述关键点的受力。The
损失函数值确定模块207,用于根据各关键点的受力确定损失函数值。The loss function
布料参数最优值确定模块208,用于根据所述损失函数值调整所述布料参数,并跳转至根据所述布料参数、所述关键点的形变梯度以及格林应变张量模型确定各关键点的受力步骤,直至所述损失函数值满足迭代停止条件时,停止跳转,得到布料参数最优值;所述布料参数最优值用于布料仿真。A cloth parameter optimal
在本实施例中,所述关键点的受力确定模块具体包括:根据所述关键点的形变梯度确定所述目标布料形变后图像中各所述关键点的格林应变张量;确定所述目标布料的经纬纱方向;根据所述布料参数确定所述目标布料的刚度矩阵;根据所述格林应变张量和所述刚度矩阵确定所述目标布料形变后图像中各所述关键点的格林应力张量;根据所述格林应变张量和所述格林应力张量确定所述目标布料形变后图像中各所述关键点对应的应变能密度;根据所述应变能密度确定所述目标布料形变后的应变能;根据所述应变能得到各所述关键点的加速度;确定各所述关键点的质量;根据所述加速度和所述关键点的质量计算各所述关键点的受力。In this embodiment, the force determination module of the key point 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 target The warp and weft direction of the cloth; the stiffness matrix of the target cloth is determined according to the cloth parameters; the Green stress tension of each key point in the deformed image of the target cloth is determined according to the Green strain tensor and the stiffness matrix determine 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; determine the deformed target cloth according to the strain energy density strain energy; obtain the acceleration of each key point according to the strain energy; determine the mass of each key point; calculate the force of each key point according to the acceleration and the mass of the key point.
在本实施例中,所述系统采用Adam自适应梯度下降法对所述布料参数进行迭代优化。In this embodiment, the system uses the Adam adaptive gradient descent method to iteratively optimize the cloth parameters.
在本实施例中,所述目标布料为网格布料,所述关键点为网格的交界点;根据所述应变能密度确定所述目标布料形变后的应变能,具体包括:将所述目标布料形变前图像或所述目标布料形变后图像网格沿对角线划分为三角形网格;根据所述应变能密度和所述关键点所在三角形网格面积确定所述三角形网格的应变能;根据各所述三角形网格的应变能确定所述目标布料形变后的应变能。In this embodiment, the target cloth is a mesh cloth, and the key points are the junction points of the grid; determining the strain energy of the target cloth after deformation according to the strain energy density, specifically including: placing the target cloth The image mesh before the cloth deformation or the image mesh after the target cloth deformation is diagonally divided into triangle meshes; the strain energy of the triangle mesh is determined according to the strain energy density and the area of the triangle mesh where the key points are located; The deformed strain energy of the target cloth is determined according to the strain energy of each of the triangular meshes.
在本实施例中,所述系统采用最小二乘法得到各所述关键点的坐标。In this embodiment, the system uses the least squares method to obtain the coordinates of each of the key points.
对于实施例公开的系统而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。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 part can be referred to the description of the method.
本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处。综上所述,本说明书内容不应理解为对本发明的限制。The principles and implementations of the present invention are described herein using specific examples. The descriptions of the above embodiments are only used to help understand the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the present invention There will be changes in the specific implementation and application scope. In conclusion, the contents of this specification should not be construed as limiting the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210399244.6A CN114647969A (en) | 2022-04-15 | 2022-04-15 | Cloth parameter measuring method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210399244.6A CN114647969A (en) | 2022-04-15 | 2022-04-15 | Cloth parameter measuring method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114647969A true CN114647969A (en) | 2022-06-21 |
Family
ID=81997785
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210399244.6A Pending CN114647969A (en) | 2022-04-15 | 2022-04-15 | Cloth parameter measuring method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114647969A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4969106A (en) * | 1989-02-27 | 1990-11-06 | Camsys, Inc. | Computerized method of determining surface strain distributions in a deformed body |
CN112200895A (en) * | 2020-12-07 | 2021-01-08 | 江苏原力数字科技股份有限公司 | Digital human cloth real-time resolving method based on deep learning |
CN114119905A (en) * | 2020-08-27 | 2022-03-01 | 北京陌陌信息技术有限公司 | Virtual fitting method, system, equipment and storage medium |
-
2022
- 2022-04-15 CN CN202210399244.6A patent/CN114647969A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4969106A (en) * | 1989-02-27 | 1990-11-06 | Camsys, Inc. | Computerized method of determining surface strain distributions in a deformed body |
CN114119905A (en) * | 2020-08-27 | 2022-03-01 | 北京陌陌信息技术有限公司 | Virtual fitting method, system, equipment and storage medium |
CN112200895A (en) * | 2020-12-07 | 2021-01-08 | 江苏原力数字科技股份有限公司 | Digital human cloth real-time resolving method based on deep learning |
Non-Patent Citations (1)
Title |
---|
叶南;张丽艳;: "基于立体视觉的板料成形极限应变测量关键技术及其系统", 航空学报, no. 10, 25 October 2010 (2010-10-25) * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Müller et al. | Position based dynamics | |
Iben et al. | Generating surface crack patterns | |
CN106407605B (en) | A kind of particlized computer dynamic stimulating method of three-dimensional garment | |
Liu et al. | Fast simulation of mass-spring systems | |
US9378593B2 (en) | Garment simulation using thread and data level parallelism | |
WO2017031718A1 (en) | Modeling method of deformation motions of elastic object | |
CN101944144B (en) | Meshless cloth-based simulation method | |
CN105069826B (en) | The modeling method of elastomeric objects amoeboid movement | |
CN110992456B (en) | An avalanche simulation method based on position dynamics | |
CN105354879A (en) | Particle spring structure based universal garment three-dimensional model simulation method and system | |
CN107330972B (en) | Real-time soft tissue deformation method and system for simulating biomechanical properties | |
Lu et al. | Dynamic cloth simulation by isogeometric analysis | |
CN109002630B (en) | Rapid simulation method for super-elastic material | |
Wang et al. | Pattern computation for compression garment by a physical/geometric approach | |
Bender et al. | Adaptive cloth simulation using corotational finite elements | |
Kelager et al. | A Triangle Bending Constraint Model for Position-Based Dynamics. | |
CN116416407A (en) | Method, system, equipment and medium for processing collision and self-collision in clothes simulation | |
CN114647969A (en) | Cloth parameter measuring method and system | |
Zhou et al. | Plausible cloth animation using dynamic bending model | |
Bender et al. | Efficient Cloth Simulation Using an Adaptive Finite Element Method. | |
Stotko et al. | Physics-guided shape-from-template: monocular video perception through neural surrogate models | |
CN107752228A (en) | Matching process based on the dynamic (dynamical) three-dimension foot model in position and shoe last model | |
CN109118561B (en) | A Location-Based Hierarchical Dynamic Simulation Method | |
US11069116B2 (en) | Hybrid structural-geometric technique for performing draping simulation of woven fabric composites | |
Manolas et al. | A Computational Tool for the Analysis of 3D Bending-active Structures Based on the Dynamic Relaxation Method. |
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 |