如何从ARbodyAnchor获取人体高度?
我正在尝试从 ARBodyAnchor
获取真实世界的人体高度。我知道我可以获得身体关节之间的真实距离。例如,臀部到脚关节,如下面的代码所示。但是如何获得从头顶到脚底的距离呢?
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
if anchor is ARBodyAnchor {
let footIndex = ARSkeletonDefinition.defaultBody3D.index(for: .leftFoot)
let footTransform = ARSkeletonDefinition.defaultBody3D.neutralBodySkeleton3D!.jointModelTransforms[footIndex]
let distanceFromHipOnY = abs(footTransform.columns.3.y)
print(distanceFromHipOnY)
}
}
I am trying to get real-world human body height from ARBodyAnchor
. I understand that I can get real-world distance between body joints. For example hip to foot-joint as in code below. But how do I get distance from top of head to bottom of foot?
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
if anchor is ARBodyAnchor {
let footIndex = ARSkeletonDefinition.defaultBody3D.index(for: .leftFoot)
let footTransform = ARSkeletonDefinition.defaultBody3D.neutralBodySkeleton3D!.jointModelTransforms[footIndex]
let distanceFromHipOnY = abs(footTransform.columns.3.y)
print(distanceFromHipOnY)
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要设置自定义模型,请阅读这篇文章 MoCap 模型。
ARSkeleton3D
的默认高度来自right_toes_joint
(或者如果您愿意)left_toes_joint
)到 head_joint 的距离为 1.71 米。由于 Apple 骨骼系统定义中的head_joint
是最上面的骨骼点,因此您可以使用常见头骨的高度 - 从眼线到头顶。换句话说,虚拟模型骨架中从
neck_3_joint
到head_joint
的距离与从head_joint
到crown
的距离大致相同>。ARSkeleton3D
中有 91 个关节:代码:
但是,我们有一个补偿器:
estimatedScaleFactor 的默认值为 1.0。
如果您设置:
ARKit 会将此属性设置为 0.0 到 1.0 之间的值。
Read this post if you need to setup a custom model for MoCap.
The default height of
ARSkeleton3D
fromright_toes_joint
(or if you wishleft_toes_joint
) to head_joint is 1.71 meters. And sincehead_joint
in Apple's skeletal system's definition is the upmost skeleton's point, you can use the common skull's height – from eye line to crown.In other words, the distance from
neck_3_joint
tohead_joint
in virtual model's skeleton is approximately the same as fromhead_joint
tocrown
.There are 91 joint in
ARSkeleton3D
:Code:
However, we have a compensator:
The default value of
estimatedScaleFactor
is 1.0.If you set:
ARKit sets this property to a value between 0.0 and 1.0.