Scripting CloudCompare - Choose which parts of the cloud to load

Feel free to ask any question here
Post Reply
sguinard
Posts: 16
Joined: Wed May 27, 2015 11:21 am

Scripting CloudCompare - Choose which parts of the cloud to load

Post by sguinard »

Hello CloudCompare community,

I have a few hundreds of point clouds (ASCII ply) that I want to convert to .xyz files.
These clouds contain a lot of informations (points, colors, normals etc), and I want to keep only the points and normals while converting them.

A simple and nice way I found to do it, is, while loading the point cloud on CC, to keep only the points and normals, and then export it as an ASCII .xyz file. However, I'm not going to do that for hundreds of clouds.

So, as I know that CC is scriptable (http://www.cloudcompare.org/doc/wiki/in ... _line_mode), my question is:
How, in command line, can I choose to load only the points and normals, and not the whole cloud?

Thanks in advance!
daniel
Site Admin
Posts: 7388
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Post by daniel »

Hum, that's not possible directly via the command line. Maybe one trick would be to use the 'PN' format as intermediate format (as it only contains points + normals). Save your cloud to PN, reload it from PN, and save it to xyz? (use the -C_EXPORT_FMT option).
Daniel, CloudCompare admin
sguinard
Posts: 16
Joined: Wed May 27, 2015 11:21 am

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Post by sguinard »

Thank you very much for the trick!

However, I have a problem while storing files via command line,
I want to specify the name of the stored file, but when I use the "FILE" option of the "SAVE_CLOUDS" command, I have the following error:
"Command expected (commands start with '-'). Found 'FILE'"

The command I used are:
CloudCompare -O myFile.ply
CloudCompare -C_EXPORT_FMT pn
CloudCompare -SAVE_CLOUDS FILE "/my/path/to/file.pn" <--- error is here

The command seemed ok from the documentation pov, but maybe I misunderstood something,
Do you have any idea why this occurs?

PS: I forgot to precise that I'm working with CC 2.9 beta
daniel
Site Admin
Posts: 7388
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Post by daniel »

Oh, this version is too old indeed. Why not moving to 2.10 or even 2.11.alpha?
Daniel, CloudCompare admin
sguinard
Posts: 16
Joined: Wed May 27, 2015 11:21 am

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Post by sguinard »

Thanks daniel, I upgraded to v2.11.alpha, but now I keep getting "[ERROR] Unhandled format specifier (PN)" errors,
Is it that pn is not supported anymore?
daniel
Site Admin
Posts: 7388
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Post by daniel »

Hum should be... Do you have the "Additional IO" plugin? (Help > About plugins)
Daniel, CloudCompare admin
Post Reply