Error in Apply Transformation

Feel free to ask any question here
Snaphu_Cat
Posts: 4
Joined: Wed Jan 27, 2021 4:32 pm

Error in Apply Transformation

Post 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 6601 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 6601 times
Why does this happen?
Thank you for your kind help

Cheers
Snaphu C.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Error in Apply Transformation

Post 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
Daniel, CloudCompare admin
Snaphu_Cat
Posts: 4
Joined: Wed Jan 27, 2021 4:32 pm

Re: Error in Apply Transformation

Post 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.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Error in Apply Transformation

Post by daniel »

Yes that's an option. Or their norm is not 1 exactly?
Daniel, CloudCompare admin
Snaphu_Cat
Posts: 4
Joined: Wed Jan 27, 2021 4:32 pm

Re: Error in Apply Transformation

Post 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 6493 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?
WargodHernandez
Posts: 187
Joined: Tue Mar 05, 2019 3:59 pm

Re: Error in Apply Transformation

Post 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)
WargodHernandez
Posts: 187
Joined: Tue Mar 05, 2019 3:59 pm

Re: Error in Apply Transformation

Post by WargodHernandez »

@daniel
Maybe it would be useful to add a check function for orthogonality, and a orgonalize function to our matrix class?
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Error in Apply Transformation

Post by daniel »

Ah good idea!
Daniel, CloudCompare admin
Snaphu_Cat
Posts: 4
Joined: Wed Jan 27, 2021 4:32 pm

Re: Error in Apply Transformation

Post by Snaphu_Cat »

thank you for your reply,
using ortoghonalized matrix the transformation works fine. Is The wolphram alpha function avaiable online?
WargodHernandez
Posts: 187
Joined: Tue Mar 05, 2019 3:59 pm

Re: Error in Apply Transformation

Post by WargodHernandez »

Yes both function are accessible here:

Wolfram Alpha Check for Orthogonality

and here:

Wolfram Alpha Othoganalize
Post Reply