Thank you for your sharing! It works! However, I found that if the input is a stable video, the output will be a unstable video.

Is there a problem here? Thanks again! ]]>

I have been using this code and it works wonders, however, I am using it to plot change in Euler angles and I am obtaining an odd creep in my data. I am wondering if my matlab function for obtaining the rotation matrix or my function for decomposing the rotation matrix are slightly wrong.

function [R,t] = rigid_transform_3D(A, B)

if nargin ~= 2 %input check

error(‘Missing parameters’);

end

centroid_A = mean(A);

centroid_B = mean(B);

N = size(A,1);

H = (A – repmat(centroid_A, N, 1))’ * (B – repmat(centroid_B, N, 1));

[U,S,V] = svd(H);

R = V*U’;

if det(R) < 0

disp('Reflection detected');

V(:,3) = -1*V(:,3);

R = V*U';

end

t = -R*centroid_A' + centroid_B'

end

%%%%%%%%%%%%%%%%%

function result = DecomposeR(cloud)

if cloud(2,1) -1

thetaZ = asin(cloud(2,1));

thetaY = atan2(-cloud(3,1), cloud(1,1));

thetaX = atan2(-cloud(2,3), cloud(2,2));

else

thetaZ = -pi/2;

thetaY = -atan2(cloud(3,2), cloud(3,3));

thetaX = 0;

end

else

thetaZ = pi/2;

thetaY = atan2(cloud(3,2), cloud(3,3));

thetaX = 0;

end

thetaZ = rad2deg(thetaZ);

thetaY = rad2deg(thetaY);

thetaX = rad2deg(thetaX);

result = [thetaY, thetaZ, thetaX];

end

I know its hard to debug without seeing the entirety of my code but I was wondering if you noticed any errors in how I am calculating R?

Thank you in advance

]]>from math import atan2, pow, sqrt

orientation = gameObject.worldOrientation

xyzRotations = [

atan2(orientation[2][1], orientation[2][2]),

atan2(orientation[2][0] * -1.0

, sqrt(pow(orientation[2][1], 2)

+ pow(orientation[2][2], 2))),

atan2(orientation[1][0], orientation[0][0])

]

Cheers, Jim

]]>Your blog is very useful.

It helps me to solve ICP problem while using PCL library.

We need to apply translation after using PCL library.

Thank you so much. ]]>