Command line : apply a scale when importing a cloud

Feel free to ask any question here
Post Reply
Michel
Posts: 6
Joined: Wed Mar 02, 2022 8:42 am
Location: Luxembourg, Luxembourg

Command line : apply a scale when importing a cloud

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

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

Post 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
Daniel, CloudCompare admin
Michel
Posts: 6
Joined: Wed Mar 02, 2022 8:42 am
Location: Luxembourg, Luxembourg

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

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

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

Post 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.
Daniel, CloudCompare admin
Michel
Posts: 6
Joined: Wed Mar 02, 2022 8:42 am
Location: Luxembourg, Luxembourg

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

Post by Michel »

Thank you very much, I was able to use both functions together and it gives me the expected result.
Post Reply