forked from kyamagu/mexopencv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRodrigues.m
36 lines (36 loc) · 1.36 KB
/
Rodrigues.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%RODRIGUES Converts a rotation matrix to a rotation vector or vice versa
%
% dst = cv.Rodrigues(src)
% [dst,jacobian] = cv.Rodrigues(src)
%
% ## Input
% * __src__ Input rotation vector (3x1 or 1x3) or rotation matrix (3x3). Both
% single and double-precision floating-point types are supported.
%
% ## Output
% * __dst__ Output rotation matrix (3x3) or rotation vector (3x1 or 1x3),
% respectively. Same data type as `src`.
% * __jacobian__ Optional output Jacobian matrix, 3x9 or 9x3, which is a
% matrix of partial derivatives of the output array components with respect
% to the input array components. Same data type as `src`.
%
% The function transforms a rotation matrix in the following way:
%
% theta <- norm(r)
% r <- r/theta
% R = cos(theta) * I + (1 - cos(theta)) * r * r^T + sin(theta) * A
% A = [0, -rz, ry; rz, 0, -rx; -ry, rx, 0]
%
% Inverse transformation can be also done easily, since
%
% sin(theta) * A = (R - R^T) / 2
%
% A rotation vector is a convenient and most compact representation of a
% rotation matrix (since any rotation matrix has just 3 degrees of
% freedom). The representation is used in the global 3D geometry
% optimization procedures like cv.calibrateCamera, cv.stereoCalibrate, or
% cv.solvePnP.
%
% See also: cv.calibrateCamera, cv.stereoCalibrate, cv.solvePnP,
% rotationMatrixToVector, rotationVectorToMatrix
%