Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by kumarsmurthy · Aug 24, 2015 at 02:23 PM · cameratransformmovekinectworld coordinates

Can you help me understand this Camera calibration between Kinect and PS Move?

I recently found a piece of code that magically combines PS Move and Kinect coordinates and fixes a displacement issue that I had. It's nice that my problem is solved, but I have no clue how this calibration happened! I had thought that Calibration needs to happen using one of these algorithms But I am not sure how the whole problem was broken down to AX=B problem :/ Can someone point me to what algorithm is this solution based on? Btw, the code works like charm and transforms PS Move on to the right hand of Kinect!

     private void CalculateTransformation()
     {
     Matrix moveMatrix;
         Matrix kinectMatrix;
         //Move Matrix of 50x4 and Kinect Matrix of 50x3 
         moveMatrix = Matrix.Zeros (samples_PSMove.Count, 4);
         kinectMatrix = Matrix.Zeros (samples_Kinect.Count, 3);
         
         for (int i = 1; i <= samples_PSMove.Count; i++) {
             moveMatrix [i, 1] = new Complex (samples_PSMove [i - 1].x);
             moveMatrix [i, 2] = new Complex (samples_PSMove [i - 1].y);
             moveMatrix [i, 3] = new Complex (samples_PSMove [i - 1].z);
             moveMatrix [i, 4] = new Complex (1.0f);
         }
         for (int i = 1; i <= samples_Kinect.Count; i++) {
             kinectMatrix [i, 1] = new Complex (samples_Kinect [i - 1].x);
             kinectMatrix [i, 2] = new Complex (samples_Kinect [i - 1].y);
             kinectMatrix [i, 3] = new Complex (samples_Kinect [i - 1].z);
         }
         //perform a matrix solve Ax = B. We have to get transposes and inverses because moveMatrix isn't square(x,y,z,w)
         //the solution is the same with (A^T)Ax = (A^T)B -> x = ((A^T)A)'(A^T)B
         Matrix transformMatrixSolution = (moveMatrix.Transpose() * moveMatrix).Inverse() * moveMatrix.Transpose() * kinectMatrix;
         
 //        Matrix error = moveMatrix * transformMatrixSolution - kinectMatrix;
         
         transformMatrixSolution = transformMatrixSolution.Transpose();
         
         List<Vector3> orthogonalVectors =     MathUtil.Orthonormalize(MathUtil.ExtractRotationVectors(MathUtil.MatrixToMatrix4x4(transformMatrixSolution)));
         
         rotationMatrix = CreateRotationMatrix(orthogonalVectors);
         //Debug.Log(rotationMatrix);
         
         transformMatrix = MathUtil.MatrixToMatrix4x4(transformMatrixSolution);
 
         UpdateFloorNormalAndDistance();
         
         coordinateSystem.SetDeviceToRootTransforms(transformMatrix);
         coordinateSystem.SaveTransformDataToXML(xmlFilename, RUISDevice.PS_Move, RUISDevice.Kinect_1);
         
         coordinateSystem.SaveFloorData(xmlFilename, RUISDevice.Kinect_1, kinect1FloorNormal, kinect1DistanceFromFloor);
         
         Quaternion rotationQuaternion = MathUtil.QuaternionFromMatrix(rotationMatrix);
         Vector3 translate = new Vector3(transformMatrix[0, 3], transformMatrix[1, 3], transformMatrix[2, 3]);
         updateDictionaries(coordinateSystem.RUISCalibrationResultsInVector3, 
                            coordinateSystem.RUISCalibrationResultsInQuaternion,
                            coordinateSystem.RUISCalibrationResultsIn4x4Matrix,
                            translate, rotationQuaternion, transformMatrix,
                            RUISDevice.PS_Move, RUISDevice.Kinect_1);
         
         coordinateSystem.RUISCalibrationResultsDistanceFromFloor[RUISDevice.Kinect_1] = kinect1DistanceFromFloor;
         coordinateSystem.RUISCalibrationResultsFloorPitchRotation[RUISDevice.Kinect_1] = kinect1PitchRotation;   
         
         kinect1ModelObject.transform.rotation = kinect1PitchRotation;
         kinect1ModelObject.transform.localPosition = new Vector3(0, kinect1DistanceFromFloor, 0);
         
         psEyeModelObject.transform.position = coordinateSystem.ConvertLocation(Vector3.zero, RUISDevice.PS_Move);
         psEyeModelObject.transform.rotation = coordinateSystem.ConvertRotation(Quaternion.identity, RUISDevice.PS_Move);
         
         if(this.floorPlane)
             this.floorPlane.transform.position = new Vector3(0, 0, 0);
     }


Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by kumarsmurthy · Aug 25, 2015 at 10:54 AM

I guess my question could be more simpler. I know that this is solving AX = B type of problem. Why has the author added one more row for PS move and not for Kinect? Is he using homogeneous coordinates? Can we do Ax=B when A is in homogeneous coordinates and B is in Cartesian?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by masterchop · Aug 12, 2016 at 12:02 PM

OMG!!!!! i have been looking for this for a while, i cant believe i am looking at the code but i am in a similar situation, this code seemed to be for some sort of SDK, not the microsoft SDK right? or you think this will work with Kinectv2 with MS SDK?

i really need this to happen do you have more information?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to move the camera depending on the score? 1 Answer

How to make your character move? 7 Answers

Setting a cube to be exactly size of intersecting camera view plane 1 Answer

GUI.Button child of the camera . 0 Answers

How do I set a child object to not rotate if the parent WILL be rotating? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges