I am trying to make a tform transformation matric, but I am getting below error once , can you please assit me to fix it?

25 views (last 30 days)
I'm gonna project a point cloud on an image which I have transformation elements such as rotation and translation matrices as below:
Rotation =
0.0499 0.999 -0.0213
-0.0283 0.0228 0.999
0.998 -0.0493 0.0294
Translation =
2.489e+06 7.4404e+06 9.58
tform = rigidtform3d(Rotation,Translation)
Error using images.geotrans.internal.rigidtform3dImpl
Invalid rotation matrix.
Error in rigidtform3d (line 8)
self = self@images.geotrans.internal.rigidtform3dImpl(varargin{:});

Answers (1)

Sakshay
Sakshay on 1 Dec 2022
Hello Abbas,
As per my understanding you are trying to create the "rigidtform3d" object using the Rotation Matrix and Translation Vector. But, you are getting an error indicating an incorrect Rotation Matrix.
A valid rotation matrix should satisfy the following constraints:
MATLAB does these internal checks before assigning the Rotation Matrix. For your case, the rotation matrix does not seem to satisfy the constraints (accuracy upto ), as in the following code:
% Assign Rotation Matrix
R = [0.0499, 0.9990, -0.0213; -0.0283, 0.0228, 0.9990; 0.9980, -0.0493, 0.0294];
% Test 1
R' * R
ans = 3×3
0.9993 0.0000 0.0000 0.0000 1.0010 0.0000 0.0000 0.0000 0.9993
R * R'
ans = 3×3
1.0009 0.0001 -0.0001 0.0001 0.9993 0.0000 -0.0001 0.0000 0.9993
% Test 2
det(R)
ans = 0.9998
You can try to generate a rotation matrix from euler angles, using the "eul2rotm" function. Please refer to the following documentation for more information on the same:

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!