2016-05-20 10 views
0

kinectを使用して私は人の顔のヨーピッチとロールを取得しようとしています。 これらの値を計算するために、私はFaceRotationQuaternionを取得しようとしています。しかし、それはYとZ値のNaNを返すようです。回転クォータニオン値のKinect v2.0 FaceFrameResult.FaceRotationQuaternion NAN

例:

X: 0 Y: NaN Z: NaN W: 2.80259692864963E-45 

新しい顔フレームが到着したときに使用されるコード。

void FaceReader_FrameArrived(object sender, FaceFrameArrivedEventArgs e) 
    { 
     using (var frame = e.FrameReference.AcquireFrame()) 
     { 
      if (frame != null) 
      { 
       // 4) Get the face frame result 
       FaceFrameResult result = frame.FaceFrameResult; 

       if (result != null) 
       { 
        System.Diagnostics.Debug.WriteLine("Found Face"); 

        faceRotation = result.FaceRotationQuaternion; 
        double x = result.FaceRotationQuaternion.X; 
        double y = result.FaceRotationQuaternion.Y; 
        double z = result.FaceRotationQuaternion.Z; 
        double w = result.FaceRotationQuaternion.W; 

        System.Diagnostics.Debug.WriteLine("X: " + x + " Y: " + y + " Z: " + z + " W: " + w); 

       } 
      } 
     } 
    } 

顔がボディに登録されています。

void BodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e) 
     { 

      //Sent the data over bluetooth. 
      //btc.sendKinectData(kinectData); 

      using (var frame = e.FrameReference.AcquireFrame()) 
      { 
       if (frame != null) 
       { 
        bodies = new Body[frame.BodyFrameSource.BodyCount]; 
        frame.GetAndRefreshBodyData(bodies); 

        Body body = bodies.Where(b => b.IsTracked).FirstOrDefault(); 

        if (!faceFrameSource.IsTrackingIdValid) 
        { 
         if (body != null) 
         { 
          // 4) Assign a tracking ID to the face source 
          faceFrameSource.TrackingId = body.TrackingId; 
         } 
        } 
       } 
      } 
     } 

FaceRotationQuaternionを使用して正しい値を取得するにはどうすればよいですか?

答えて

0

解決策が見つかりました。頭の向きも特徴であるように見えるので、動作する前にロードする必要があります。

faceFrameSource = new FaceFrameSource(kinectSensor,0,FaceFrameFeatures.RotationOrientation);