Page 1 of 2

Error in Apply Transformation

Posted: Wed Jan 27, 2021 4:53 pm
by Snaphu_Cat
Good morning everyone!
I'm new in Cloud Compare and I have a simple doubt regarding the apply transformation tool.
I have a point cloud (axes x,y,z, origin o) that I need to transform according to camera axes orientation (let's say x',y',z', camera center c to be used as origin). To do this I've calculated the 4x4 matrix necessary to apply the rotation and translation of my system, and I've used it in the "apply tansformation tool".
CC.jpg
CC.jpg (69.18 KiB) Viewed 6516 times
The result seems good, but when I retransform it back to the original axes (unflag the "apply inverse transformation", figure b) the outcome doesn't completely match the original point cloud (figure a,b).
Presentazione standard1.jpg
Presentazione standard1.jpg (256.6 KiB) Viewed 6516 times
Why does this happen?
Thank you for your kind help

Cheers
Snaphu C.

Re: Error in Apply Transformation

Posted: Wed Jan 27, 2021 9:55 pm
by daniel
2 options:
- the transformation is not perfectly orthogonal, i.e. each vector (= 3 first columns) norm should be equal to 1, and they should all be orthogonal to each other (X.Y = X.Z = Y.Z = 0)
- the coordinates of the cloud are too big (in case you ignored the "Global Shift" warning - if any). And the loss of accuracy explains the issue

Re: Error in Apply Transformation

Posted: Thu Jan 28, 2021 4:07 pm
by Snaphu_Cat
Thank you Dianel for your quick reply!
Actually, the point cloud coordinates are corrected with the global shift option, so I don't think that "option 2" is the problem.
Instead, option 1 may have sense. So, according to your suggestion the x y z axes of the camera are not perfectly orthogonal. Am I right?

Thank you again
Snaphu C.

Re: Error in Apply Transformation

Posted: Sat Jan 30, 2021 8:45 am
by daniel
Yes that's an option. Or their norm is not 1 exactly?

Re: Error in Apply Transformation

Posted: Mon Feb 01, 2021 8:41 am
by Snaphu_Cat
Thanks for reply, I use the camera angles orientation (omega, phi ,kappa) to calculate the rotation matrix using the equations as :
Cattura.PNG
Cattura.PNG (87.04 KiB) Viewed 6408 times
So i think that each vector (= 3 first columns) mathematically is equal to 1, and they should all be orthogonal to each other (X.Y = X.Z = Y.Z = 0). Am i wrong?

Re: Error in Apply Transformation

Posted: Mon Feb 01, 2021 6:47 pm
by WargodHernandez
So I'm positive that the matrix used was not orthogonal (according to wolfram alpha at least :) )

using the Orthogonalize function on wolfram alpha for your original matrix gives
-0.95582263396 0.061432249030 -0.28745290256 38.516654968262
-0.28723579125 0.012527465527 0.95777798202 81.873214721680
0.062439511834 0.99803263543 0.0056715055617 234.736160278320
0.000000000000 0.000000000000 0.000000000000 1.000000000000

using that matrix instead of the original, the transformation is reversible using the inverse transform. (at least within numerical accuracy of of our transform class) I'm seeing slight z transform differences before and after (-7.6294E-06)

Re: Error in Apply Transformation

Posted: Mon Feb 01, 2021 7:16 pm
by WargodHernandez
@daniel
Maybe it would be useful to add a check function for orthogonality, and a orgonalize function to our matrix class?

Re: Error in Apply Transformation

Posted: Tue Feb 02, 2021 8:03 am
by daniel
Ah good idea!

Re: Error in Apply Transformation

Posted: Wed Feb 03, 2021 4:10 pm
by Snaphu_Cat
thank you for your reply,
using ortoghonalized matrix the transformation works fine. Is The wolphram alpha function avaiable online?

Re: Error in Apply Transformation

Posted: Wed Feb 03, 2021 5:12 pm
by WargodHernandez
Yes both function are accessible here:

Wolfram Alpha Check for Orthogonality

and here:

Wolfram Alpha Othoganalize