I'm trying to understand the conversion of a 3D rotation vector to a rotation matrix. Say I have a 3D rotation vector [a b g]. From 'Introductory Techniques for 3D computer Vision' by Trucco et al, I believe I can represent this as the product of the rotation matrices for each axis x,y,z.
But more often I see this conversion from rotation vector to matrix using the Rodrigues formula which gives A.17 in the image below
I am testing these both in Matlab (I'm using the built-in rotationVectorToMatrix function in the Matlab image processing toolbox which performs the Rodrigues), and the results I get for small roations are very close to each other, e.g.
alpha = 1 * (pi/180);
beta = 2 * (pi/180);
gamma = 3 * (pi/180);
R = [(cos(beta) * cos(gamma)) (-cos(beta)*sin(gamma)) sin(beta);
sin(alpha) * sin(beta) * cos(gamma) + cos(alpha)*sin(gamma) ...
-sin(alpha) * sin(beta) * sin(gamma) + cos(alpha) * cos(gamma) ...
-sin(alpha) * cos(beta); ...
-cos(alpha)*sin(beta)*cos(gamma) + sin(alpha)*sin(gamma) ...
cos(alpha) * sin(beta) * sin(gamma) + sin(alpha) * cos(gamma) ...
cos(alpha) * cos(gamma)]
Rm = rotationVectorToMatrix([alpha beta gamma])'
I get
R =
0.9980 -0.0523 0.0349
0.0529 0.9984 -0.0174
-0.0339 0.0193 0.9985
Rm =
0.9980 -0.0520 0.0353
0.0526 0.9985 -0.0165
-0.0344 0.0184 0.9992
But as my angles get bigger they diverge a bit, e.g. if I do
alpha = 10 * (pi/180);
beta = 20 * (pi/180);
gamma = 30 * (pi/180);
I get
R =
0.8138 -0.4698 0.3420
0.5438 0.8232 -0.1632
-0.2049 0.3188 0.8529
Rm =
0.8089 -0.4578 0.3689
0.5166 0.8530 -0.0742
-0.2807 0.2506 0.9265
Again I'm really just trying to gain a better understanding here, are these methods of converting from a rotation vector to matrix equivalent? Should I always be using the Rodriguez method? If so why? Thanks for any help.