www.gusucode.com > 基于matlab的三维重建代码,提取两幅图片的匹配点源码程序 > 基于matlab的三维重建代码,提取两幅图片的匹配点源码程序/code/code/rot_matrix.m

    % computes rotation matrix using Rodriguez formula 

function [rot_matrix] = rot_matrix(omega,theta)

omega_hat = [0 -omega(3) omega(2);
             omega(3) 0  -omega(1);
             -omega(2) omega(1) 0 ];

norm_omega = norm(omega);

if (norm(omega) ~= 0)
rot_matrix = diag([1,1,1])+(omega_hat./norm_omega).* sin(norm_omega*theta) ...
            + ((omega_hat^2)./norm_omega^2) .* (1 - cos(norm_omega*theta));
else
rot_matrix = diag([1 1 1]);
end;