Applying transformation script unable to read transformation matrix.

Feel free to ask any question here
Post Reply
tccarcat
Posts: 1
Joined: Mon Jan 22, 2024 5:36 pm

Applying transformation script unable to read transformation matrix.

Post by tccarcat »

Hello, I am new to using CloudCompare. I have been running into an error where CloudCompare cannot read my tranformation matrix txt file. I am using python scripts to automatically apply ICP. Any advice is appreciated.

I have a 4x4 transformation which I got from iteratively scaling a point cloud, then performing ICP and comparing each re-scaled variant to the reference, choosing the best fit scale matrix based on lowest RMS value. The best scale matrix is logged in a txt file in the following format:

8.999999999999999112e-01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00
0.000000000000000000e+00 8.999999999999999112e-01 0.000000000000000000e+00 0.000000000000000000e+00
0.000000000000000000e+00 0.000000000000000000e+00 8.999999999999999112e-01 0.000000000000000000e+00
0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+00

When running the following command to apply this transformation matrix:

os.system(f"CloudCompare -O \'{PC_file_og}\' -APPLY_TRANS {best_scale} -SAVE_CLOUDS FILE \'{PC_file}\'")

I get an error which reads:

Failed to read transformation matrix file '[[0.9'!

best_scale is defined as the txt file containing the transformation matrix.

I am unsure if this is related to this particular error, but aligned point clouds generated from the previous step in my process also have extremely high translations applied to them, up to 181k units away from the original point clouds. I am not sure why this is occurring either. I can explain the previous step further if necessary.

I would appreciate any input on this issue I can get. If further explanation or clarification is needed, I would be happy to provide it.

Thank you.
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Applying transformation script unable to read transformation matrix.

Post by daniel »

Isn't the error here with the filename? '[[0.9' doesn't look like a legit name ;)

And regarding the large coordinates/translation values, make sure you properly manage the Global Shift, as with the command line mode, you have to manually set how it should be handled by CloudCompare. Typically you would set '-GLOBAL_SHIFT AUTO' right after -O.
Daniel, CloudCompare admin
Post Reply