Skip to content

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.

  • Download source code from CC - Master branch

  • Download CCCoreLib from CC - CoreLib.
  • Copy CCoreLib into CC_master/libs/qCC_db/extern/CCCoreLib/
  • Open Cmake-Gui
  • Click Configure project -> Set builder (tested with VisualStudio2019)
  • 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
  • (optional) Modify CMAKE_INSTALL_PREFIX to a folder not needing admin rights
  • Configure, then generate if no further error
  • Open project and set compilation type to build
  • Compile all, there will be an error after compilation
  • Compile INSTALL
  • 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
  • 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.

:: Get two clouds and align them thanks to ICP
@echo off
:: Remove modified files and get fresh ones from dflt folder
echo Get fresh models
del *.bin
del *.txt
for /R %cd%\dflt %%f in (c*.bin) do copy "%%f" %cd%
:: Command CC to do things
echo Launch CloudCompare
CloudCompare -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
:: 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.

:: Get two clouds, align them, create a heatmap
@echo off
:: Remove modified files and get fresh ones from dflt folder
echo Get fresh models
del *.bin
del *.txt
for /R %cd%\dflt %%f in (tunn*.bin) do copy "%%f" %cd%
:: Command CC to do things
echo Launch CloudCompare
CloudCompare -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
:: 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
echo Done with computation

Heatmap between two clouds
Figure 1: Heatmap between two clouds