I am trying to apply a rotation to fix the camera pose in my setup, since one of the axes seems to be off. I suspect this axis to be Z of "world" frame. In other words, I need to rotate "stereo_camera" frame around the Z axis of the "world frame" by 90 degrees. Then all should be OK.
I've tried using several Python libraries and Octave to achieve this but I failed. Somehow either the multiplication or the way I express the quarternion doesn't seem to comply.
# Here is the current quarternion of "stereo_camera"
q = np.array([0.0, 0.70710678, 0.0, 0.70710678])
# Rotation matrix, 90 degrees around Z would be:
I = np.array([[0, -1, 0],[1,0,0],[0,0,1]])
# apply the transformation
q.dot(I)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: shapes (4,) and (3,3) not aligned: 4 (dim 0) != 3 (dim 0)
Is there anyone who could suggest me a nice Python package which can handle such situations, with a minimal example? It shouldn't be hard to apply 1 single rotation to a quarternion.