新的 iPhone X 前置摄像头深度和面部跟踪网格 API

The new iPhone X front facing camera depth and face tracking mesh API

刚刚看了新的iPhoneX公告,前置摄像头的传感和跟踪技术是否对开发者开放?舞台上演示了 Snapchat 面罩,不确定是否使用 ARKit

这是在 iPhone X 上使用 TrueDepth 相机的示例:https://developer.apple.com/documentation/arkit/creating_face_based_ar_experiences

还有一个全新的session:Face Tracking with ARKit #601

Creating Face-Based AR Experiences

Place and animate 3D content that follows the user’s face and matches facial expressions, using the TrueDepth camera on iPhone X.

This sample app presents a simple interface allowing you to choose between four augmented reality (AR) visualizations on devices with a TrueDepth front-facing camera (see iOS Device Compatibility Reference).

  • The camera view alone, without any AR content.
  • The face mesh provided by ARKit, with automatic estimation of the real-world directional lighting environment.
  • Virtual 3D content that appears to attach to (and be obscured by parts of) the user’s real face.
  • A simple robot character whose facial expression is animated to match that of the user.

==> 检查标题为“在用户面部放置 3D 内容”的部分,了解您的第二个用例。

是的,它对开发人员开放。

如果您现在查看 ARKit docs page,您会发现它分为世界跟踪和面部跟踪部分(加上两者的一些共同点)。 World Tracking 是在 WWDC 上宣布的——使用后置摄像头在您周围世界的 AR 内容中查看 "through" 您的设备。

面部跟踪 AR 特定于 iPhone X 和 TrueDepth 相机。正如您在这些文档中看到的那样,它使用 ARFaceTrackingConfiguration instead of the other configuration classes. And it gives you info about the face in real time through ARFaceAnchor 对象。

在面部锚点文档中,似乎有两种获取面部信息的方法。 geometry gives you a 3D mesh you can display, or use to map textures onto the face — that's presumably what the Snapchat demo used to make wrestling masks in the keynote demo. The blendShapes 给你一堆动画参数,比如下巴张开多远,左眼眯多远(以及大约 50 个其他更微妙的东西)......他们谈论用它来制作木偶动画或化身,所以这可能就是 Animoji 的工作原理。

Apple 也发布了 a sample code project showing how to do all of these,因此您可以查看代码以了解如何自己做。 (即使你不能 运行 没有 iPhone X 的代码。)