I would like to find the Translation matrix, Rotation Matrix as well as the Scale Matrix. Following is my code,
import numpy as np
def get_rotation_from_homogeneous_transform(transform):
s = transform.shape
if s[0] != s[1]:
raise ValueError('Matrix must be a 4x4 homogenous transformation', s)
n = s[0]
rotation = transform[0:n - 1, 0:n - 1]
return rotation
homogeneous_matrix = np.array([[-0.008189, 0.000428, -0.999900, 0.000000],
[0.758580, 0.651582, 0.008000, 0.000000],
[0.651582, 0.758580, -0.011300, 0.000000],
[1.294619, 0.885227, 1.358000, 1.000000]]).astype(np.float32).T
rotM = get_rotation_from_homogeneous_transform(homogeneous_matrix)
Did I extract the Rotation Matrix Properly? How can I extract the translation and Scale Matrix as well?