. I'm using the sample chair-11/0.
Eye-balling this, you can see the user rotated around the
yaw axis for 30'. In Objectron, the Yaw axis is aligned with Gravity and it is the Y vector in rotation.
from scipy.spatial.transform import Rotation as R
with open(annotation_file, 'rb') as pb:
sequence = annotation_protocol.Sequence()
sequence.ParseFromString(pb.read())
frame = grab_frame(video_filename, [frame_id])
src_frame = sequence.frame_annotations[0]
src_transformation = np.array(src_frame.camera.transform).reshape(4, 4)
dst_frame = sequence.frame_annotations[100]
dst_transformation = np.array(dst_frame.camera.transform).reshape(4, 4)
relative_transformation = dst_transformation @ np.linalg.inv(src_transformation)
relative_rotation = R.from_matrix(relative_transformation[:3, :3])
print(np.degrees(relative_rotation.as_rotvec()))
Which will print [ 4.68138936 -28.10604787 0.40092367]as the result. So the Y value is 28', as expected.
Adel