我用kinect v2扫描一个人,并将他/她的身体保存为.ply,.obj,.stl格式。我想从这个3d扫描的身体中计算出腹部,二头肌等的周长。
我愿意接受所有想法。
这是我保存.obj文件时使用的代码。
public static void SaveAsciiObjMesh(Mesh mesh, TextWriter writer, bool flipAxes)
{
if (null == mesh || null == writer)
{
return;
}
var vertices = mesh.GetVertices();
var normals = mesh.GetNormals();
var indices = mesh.GetTriangleIndexes();
// Check mesh arguments
if (0 == vertices.Count || 0 != vertices.Count % 3 || vertices.Count != indices.Count)
{
throw new ArgumentException(Properties.Resources.InvalidMeshArgument);
}
// Write the header lines
writer.WriteLine("#");
writer.WriteLine("# OBJ file created by Microsoft Kinect Fusion");
writer.WriteLine("#");
// Sequentially write the 3 vertices of the triangle, for each triangle
for (int i = 0; i < vertices.Count; i++)
{
var vertex = vertices[i];
string vertexString = "v " + vertex.X.ToString(CultureInfo.InvariantCulture) + " ";
if (flipAxes)
{
vertexString += (-vertex.Y).ToString(CultureInfo.InvariantCulture) + " " + (-vertex.Z).ToString(CultureInfo.InvariantCulture);
}
else
{
vertexString += vertex.Y.ToString(CultureInfo.InvariantCulture) + " " + vertex.Z.ToString(CultureInfo.InvariantCulture);
}
writer.WriteLine(vertexString);
}
// Sequentially write the 3 normals of the triangle, for each triangle
for (int i = 0; i < normals.Count; i++)
{
var normal = normals[i];
string normalString = "vn " + normal.X.ToString(CultureInfo.InvariantCulture) + " ";
if (flipAxes)
{
normalString += (-normal.Y).ToString(CultureInfo.InvariantCulture) + " " + (-normal.Z).ToString(CultureInfo.InvariantCulture);
}
else
{
normalString += normal.Y.ToString(CultureInfo.InvariantCulture) + " " + normal.Z.ToString(CultureInfo.InvariantCulture);
}
writer.WriteLine(normalString);
}
// Sequentially write the 3 vertex indices of the triangle face, for each triangle
// Note this is typically 1-indexed in an OBJ file when using absolute referencing!
for (int i = 0; i < vertices.Count / 3; i++)
{
string baseIndex0 = ((i * 3) + 1).ToString(CultureInfo.InvariantCulture);
string baseIndex1 = ((i * 3) + 2).ToString(CultureInfo.InvariantCulture);
string baseIndex2 = ((i * 3) + 3).ToString(CultureInfo.InvariantCulture);
string faceString = "f " + baseIndex0 + "//" + baseIndex0 + " " + baseIndex1 + "//" + baseIndex1 + " " + baseIndex2 + "//" + baseIndex2;
writer.WriteLine(faceString);
}
}
我真的对图像处理没有经验,这就是我学期作业的一部分。我病了,那天不能上学,他们给我留下了最艰巨的作业。至少对我来说最难。所以我需要一些想法。任何信息都很棒。
答案 0 :(得分:1)
只需将其导入到Autodesk 3D Max,它便具有内置体积,表面积,尺寸测量功能。或者,如果您要编写自己的程序,则可以使用获取表面三角剖分的坐标。从未使用过kinect,因此除非您能告诉我们可以从模型中获得什么样的数据,否则无法告诉您更多信息。