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

Function quat2rot

utils/readgt_colmap.py:7–13  ·  view source on GitHub ↗
(qw, qx, qy, qz)

Source from the content-addressed store, hash-verified

5
6# The reconstructed pose of an image is specified as the projection from world to the camera coordinate
7def quat2rot(qw, qx, qy, qz):
8 R = np.array([
9 [1 - 2 * (qy**2 + qz**2), 2 * (qx * qy - qz * qw), 2 * (qx * qz + qy * qw)],
10 [2 * (qx * qy + qz * qw), 1 - 2 * (qx**2 + qz**2), 2 * (qy * qz - qx * qw)],
11 [2 * (qx * qz - qy * qw), 2 * (qy * qz + qx * qw), 1 - 2 * (qx**2 + qy**2)]
12 ])
13 return R
14
15def load_camera_data(file_path):
16 with open(file_path, 'r') as file:

Callers 1

load_colmap_gtFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected