Commandline use#

Introduction#

Following information are given to quickly begin with CloudCompare in command line mode.
Command line mode is an easy and quick way to apply algorithms to given point clouds.
It only permits to use predefinded algorithms in the call order, without giving a lot of control over them.

Installation and preparation#

To be able to use CloudCompare and its command line mode, you first need to install it. It can be done directly from precompiled sources or build from source.

Precompiled sources#

Installers can be found under CC - Installers.

Compilation from source#

Sources of CloudCompare can be found under CC - Sources.
A compilation helper can be found under CC - Build from source.
As some information may be missing, a quick resume is given here (tested under Windows). It requires Qt5 installed.
  1. Download source code from CC - Master branch

  2. Download CCCoreLib from CC - CoreLib.

  3. Copy CCoreLib into CC_master/libs/qCC_db/extern/CCCoreLib/

  4. Open Cmake-Gui

  5. Click Configure project -> Set builder (tested with VisualStudio2019)

  6. Configuration may fail with Qt5 not found -> add entry CMAKE_PREFIX_PATH and make it point to Qt/5.*/builder (builder can be msvc2019 for example or set Qt5_Dir variable to Qt/5.*/builder/lib/cmake/Qt5

  7. (optional) Modify CMAKE_INSTALL_PREFIX to a folder not needing admin rights

  8. Configure, then generate if no further error

  9. Open project and set compilation type to build

  10. Compile all, there will be an error after compilation

  11. Compile INSTALL

  12. After compilation is successfull, go to compilation properties (need to be done for each build type) -> debug -> command -> point to CMAKE_INSTALL_PREFIX/CloudCompare(_debug)/CloudCompare.exe

  13. You can then launch the program through VisualStudio

Commandline usage#

Prepare for use (Windows)#

To be able to access CloudCompare without needing to point to install folder for each command, you need to add it as a path variable.
Just add a new PATH variable named CloudCompare and point to CMAKE_INSTALL_PREFIX/CloudCompare(_debug)/CloudCompare.exe, then restart your computer.
It is ready to use.

Explanations#

Command line information are found under CC - Command Line Doc..
If you added CloudCompare to path, you can now call it from anywhere thanks to a simple terminal. See Cmder for a great terminal.
By default, a console will appear with info. on what is currently done. It can be disabled as the first argument given to the command thanks to -SILENT
To keep the log of what is done (even without console), you can add -LOG_FILE filename.
By default, after each applied process, clouds are saved with an explicit name. You can begin your command with CloudCompare -AUTO_SAVE OFF to disable auto-save. Then, to save when you want, use -SAVE_CLOUDS or -SAVE_MESHES following what has been loaded.

Examples#

First example load two clouds, then apply ICP till a difference of 1e-10 between both clouds. It then save a merge into a new file.

 1:: Get two clouds and align them thanks to ICP
 2@echo off
 3:: Remove modified files and get fresh ones from dflt folder
 4echo Get fresh models
 5del *.bin
 6del *.txt
 7for /R %cd%\dflt %%f in (c*.bin) do copy "%%f" %cd%
 8:: Command CC to do things
 9echo Launch CloudCompare
10CloudCompare -SILENT -LOG_FILE log.txt -O c1.bin -O c2.bin -AUTO_SAVE OFF -REMOVE_RGB -NO_TIMESTAMP -ICP -MIN_ERROR_DIFF 1e-10 -ADJUST_SCALE -MERGE_CLOUDS -SAVE_CLOUDS
11:: CC / no console / log in log.txt / open c1 / open c2 / no auto save btw steps / remove unused texture data / no timestamp on save / align clouds with ICP/ merge c1-c2 / save

Second example show the alignment followed by the creation of a heatmap representing the differences between two clouds (absolute values only). It can then be opened in CloudCompare.

 1:: Get two clouds, align them, create a heatmap
 2@echo off
 3:: Remove modified files and get fresh ones from dflt folder
 4echo Get fresh models
 5del *.bin
 6del *.txt
 7for /R %cd%\dflt %%f in (tunn*.bin) do copy "%%f" %cd%
 8:: Command CC to do things
 9echo Launch CloudCompare
10CloudCompare -SILENT -LOG_FILE log.txt -AUTO_SAVE OFF -O tunn2.bin -O tunn1.bin -SS SPATIAL 0.4 -REMOVE_RGB -NO_TIMESTAMP -SAVE_CLOUDS -ICP -MIN_ERROR_DIFF 1e-8 -C2C_DIST -SAVE_CLOUDS
11:: CC / no console / log in log.txt / no auto save btw steps / open scans / subsample / no timestamp on save / align clouds/ dist o1-o2 (heatmap) / save
12echo Done with computation
Heatmap between two clouds

Heatmap of two slightly different clouds#

Algorithm CloudCompare 3D Algorithm