MCPcopy Create free account
hub / github.com/ComputationalRobotics/XM-code / quat2rot

Function quat2rot

utils/cameramath.py:3–9  ·  view source on GitHub ↗
(qw, qx, qy, qz)

Source from the content-addressed store, hash-verified

1import numpy as np
2
3def quat2rot(qw, qx, qy, qz):
4 R = np.array([
5 [1 - 2 * (qy**2 + qz**2), 2 * (qx * qy - qz * qw), 2 * (qx * qz + qy * qw)],
6 [2 * (qx * qy + qz * qw), 1 - 2 * (qx**2 + qz**2), 2 * (qy * qz - qx * qw)],
7 [2 * (qx * qz - qy * qw), 2 * (qy * qz + qx * qw), 1 - 2 * (qx**2 + qy**2)]
8 ])
9 return R

Callers 3

4_test_unidepth.pyFile · 0.90
5_test_ceres.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected