MCPcopy Create free account
hub / github.com/MetaSLAM/SphereVLAD / getRotMatrix

Function getRotMatrix

utils/equirectRotate/utils.py:3–21  ·  view source on GitHub ↗

:param rotation: (yaw, pitch, roll) in degree :return: general rotational matrix refer this: https://en.wikipedia.org/wiki/Rotation_matrix#General_rotations

(rotation)

Source from the content-addressed store, hash-verified

1import numpy as np
2
3def getRotMatrix(rotation):
4 """
5 :param rotation: (yaw, pitch, roll) in degree
6 :return: general rotational matrix
7 refer this: https://en.wikipedia.org/wiki/Rotation_matrix#General_rotations
8 """
9 yaw, pitch, roll = (rotation / 180) * np.pi
10
11 Rz = np.array([[np.cos(yaw), -np.sin(yaw), 0],
12 [np.sin(yaw), np.cos(yaw), 0],
13 [0, 0, 1]])
14 Ry = np.array([[np.cos(pitch), 0, np.sin(pitch)],
15 [0, 1, 0],
16 [-np.sin(pitch), 0, np.cos(pitch)]])
17 Rx = np.array([[1, 0, 0],
18 [0, np.cos(roll), -np.sin(roll)],
19 [0, np.sin(roll), np.cos(roll)]])
20
21 return Rz @ Ry @ Rx
22
23
24def Pixel2LatLon(equirect):

Callers 2

__init__Method · 0.85
pointRotateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected