Page 1 of 1

Command line : apply a scale when importing a cloud

Posted: Wed Mar 02, 2022 9:03 am
by Michel
Hello everyone,

I am currently working on a point cloud of archaeological ruins and I would like, for future processing in CloudCompare, to change the scale of the cloud via the command line (I use the command line from a python script). I could see on the dedicated wiki page that the -GLOBAL_SHIFT option exists, but I have the impression that it only allows to apply a three-dimensional translation to the cloud and not a scale as one could do in the GUI.

The idea here is to apply a temporary scale for the time of processing and then return to the original system when exporting, which is what CloudCompare does natively.

Does anyone have an idea how to apply this scale?

Thanks in advance,
--
Michel

Re: Command line : apply a scale when importing a cloud

Posted: Wed Mar 02, 2022 8:48 pm
by daniel
If the scaling ratio is not too extreme, you could use the -APPLY_TRANS method.

Simply use a diagonal matrix with the scale value on the 3 first diagonal elements:
S 0 0 0
0 S 0 0
0 S 0 0
0 0 0 1

Re: Command line : apply a scale when importing a cloud

Posted: Thu Mar 03, 2022 8:50 am
by Michel
This solution is very interesting, however, I have two more questions:

- Can we combine the functions -GLOBAL_SHIFT and -APPLY_TRANS? Indeed, I am in a local coordinate system where the average coordinates are (89700,95200). It is therefore better for the calculations to let CC translate the cloud automatically before applying a scale.

- Does the -APPLY_TRANS function apply a temporary transformation, like -GLOBAL_SHIFT, or a definitive transformation? Because if it is permanent, I need to remember to disable autosave and apply the reverse transformation before exporting using the -C_EXPORT_FMT function.

Re: Command line : apply a scale when importing a cloud

Posted: Sat Mar 05, 2022 11:05 am
by daniel
So yes, you can (and should) use both when working with large coordinate.

-GLOBAL_SHIFT is temporary, but -APPLY_TRANS is not. So you apply a (temporary) global shift so as to reduce the amplitude of your coordinates, then you can apply a scale, and at saving time, only the Global Shift will be restored.

Re: Command line : apply a scale when importing a cloud

Posted: Sat Mar 05, 2022 9:42 pm
by Michel
Thank you very much, I was able to use both functions together and it gives me the expected result.