【问题标题】:How to get 468 face landmarks points using ARCore - IOS如何使用 ARCore 获得 468 个面部标志点 - IOS
【发布时间】:2021-09-27 17:10:51
【问题描述】:

我正在使用 ARCore-IOS 创建 AR IOS 应用程序。 https://github.com/google-ar/arcore-ios-sdk/tree/v1.25.0 我可以从此模块获得鼻子、左前额和右前额区域点以及面部旋转。

但我需要文档中提到的所有 468 个面部标志点。但是没有返回 468 点的特定方法或类。 那么,我们如何在 IOS 原生或 Flutter 中,使用或不使用 ARCore 获得 468 个面部特征点。

【问题讨论】:

    标签: ios flutter tensorflow arcore mediapipe


    【解决方案1】:

    GARAugmentedFace 类包含一个网格,其中包含 3D 顶点位置。例如在 SCNSceneRendererDelegate 方法中:

    if let face = frame.face {
    print(face.mesh.vertices[467])
    }
    

    https://developers.google.com/ar/reference/ios/interface_g_a_r_augmented_face_mesh

    所有顶点位置都在它们的默认位置,即在 canonical_face_mesh 中。如果您想要相机中单个面部的顶点位置,您需要从场景套件几何图形中获取该信息,该几何图形方便地存储在 faceTextureNode 中。提取数据不太方便。

    faceTextureNode.geometry = faceMeshConverter.geometryFromFace(face)
    faceVertices = vertexPositionFromSCNGeometry(geometry: faceTextureNode.geometry!)
    
    private func vertexPositionFromSCNGeometry(geometry: SCNGeometry) -> [SCNVector3] {
      let geometrySources = geometry.sources(for: SCNGeometrySource.Semantic.vertex)
      var geometryVertices = [SCNVector3()]
      if let geometrySource = geometrySource.first{
        let stride = geometrySource.dataStride
        ...
          let vector = SCNVector3Make(buffer[0], buffer[1], buffer[2])
          return vector
          })
      geometryVertices = vertices
      }
    return geometryVertices
    }
    

    函数的其余部分可以从这里的详细答案中填写: https://stackoverflow.com/a/66748865/14437826

    顶点位置相对于面部中心变换。如果您想要原始位置,则必须使用中心变换进行计算。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-20
      • 1970-01-01
      • 2018-03-24
      • 1970-01-01
      • 2019-04-06
      • 2015-08-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多