Skip to content

Instantly share code, notes, and snippets.

@catid
Last active November 4, 2019 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save catid/a8db10a6f41bbda14670dd2559139e53 to your computer and use it in GitHub Desktop.
Save catid/a8db10a6f41bbda14670dd2559139e53 to your computer and use it in GitHub Desktop.
How to correct tilt of Azure Kinect DK based on IMU samples
// Accelerometer frame: (x, y, z) = (+forward, +right, +up)
// Pointcloud frame: (x, y, z) = (+right, +up, +forward)
Eigen::Quaternionf q;
q.setFromTwoVectors(
Eigen::Vector3f(accel[1], accel[2], accel[0]),
Eigen::Vector3f(0.f, -1.f, 0.f));
Eigen::Matrix3f TiltR = q.toRotationMatrix();
// Then just multiply the pointcloud by this rotation matrix to get the corrected positions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment