Answered by:
Kinect Fusion Camera position and XNA Camera
Question

Hi, I want to integrate kinect fusion and XNA.
How to get the current camera position of kinect fusion and use it to control XNA camera?
thanks.
 Edited by Wahyu Setyo B Wednesday, April 9, 2014 7:02 AM
Tuesday, April 8, 2014 12:41 PM
Answers

Hi finally I solve this problem. Thanks to Carmine Sirignano for helping to solve this problem.
In case anyone face the same problem, here is the solution.
1. You need to use this code "Reconstruction.GetCurrentWorldToCameraTransform" and you'll get 4x4 Matrix.
2. The matrix should looks like this (in my case):
RRR0
RRR0
RRR0
TTT1
3. To get the camera position (C) and the camera lookAt (orientation), you can use these equation:
C = Transpose(R) * T
For the camera lookAt (orientation), you can calculate it like this:
Transpose(R) * A
Where A =
0
0
1
 Marked as answer by Carmine Si  MSFTMicrosoft employee Friday, May 2, 2014 5:31 PM
Friday, May 2, 2014 3:43 AM
All replies

The world coordinate value provides the camera orientation. How that would relate to an XNA camera space would be independent and you would have to do some math to ensure the camera spaces align. The Fusion SDK would have no knowledge of how to transforms it world coordinates to something in your XNA application.
Carmine Sirignano  MSFT
 Proposed as answer by Carmine Si  MSFTMicrosoft employee Tuesday, April 22, 2014 11:21 PM
Tuesday, April 22, 2014 11:20 PM 
To get the world coordinate, what function can I use?
Can I use "Reconstruction.GetCurrentWorldToCameraTransform" to do it?
Thanks.
Wednesday, April 23, 2014 1:31 PM 
Yes, that will give you the reconstruction world to camera transformation matrix.
Carmine Sirignano  MSFT
Wednesday, April 23, 2014 6:02 PM 
Hi finally I solve this problem. Thanks to Carmine Sirignano for helping to solve this problem.
In case anyone face the same problem, here is the solution.
1. You need to use this code "Reconstruction.GetCurrentWorldToCameraTransform" and you'll get 4x4 Matrix.
2. The matrix should looks like this (in my case):
RRR0
RRR0
RRR0
TTT1
3. To get the camera position (C) and the camera lookAt (orientation), you can use these equation:
C = Transpose(R) * T
For the camera lookAt (orientation), you can calculate it like this:
Transpose(R) * A
Where A =
0
0
1
 Marked as answer by Carmine Si  MSFTMicrosoft employee Friday, May 2, 2014 5:31 PM
Friday, May 2, 2014 3:43 AM