1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[ARKit]身体を認識してみる メモ

Posted at

身体を認識する流れ

1 ARBodyTrackingConfigurationをインスタンス化する
2 ARViewのARSessionにセットしてrunする
3 ARSessionDelegateのメソッドで下記のメソッドを呼び出してARBodyAnchorを取得する

func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
 for anchor in anchors {
     guard let bodyAnchor = anchor as? ARBodyAnchor else { return }

}
}

ARBodyAnchorから取れる情報

ARBodyAnchorはARAnchorを継承しているので他のARImageAnchorやARPlaceAnchorと同様,simd_float4x4型のtransformプロパティを持っている。(これはそのアンカーのワールド空間における座標を示している。)

ARBodyAnchorで他によく使いそうなのは下記のプロパティ

var skeleton: ARSkeleton3D { get }

これは3Dで身体の動きを追跡している情報が入っている。
SkeltonにはJointと呼ばれる身体のパーツを表した91個のタイプが存在し、それをそれぞれ下記のSkeltonのプロパティを利用することで情報を取得できる


func localTransform(for: ARSkeleton.JointName) -> simd_float4x4?
指定された名前のジョイントが親ジョイントから見てどれだけ移動や回転したかを表す4✖️4の行列を返す

func modelTransform(for: ARSkeleton.JointName) -> simd_float4x4?
指定された名前のジョイントが Skelotonの中心である腰のジョイントからみてどれだけ移動や回転したかを表す4✖️4の行列を返しす
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?