Command line mode
Since version 2.3, CloudCompare can be used in "command line" mode.
By default, this mode only opens a small console window, applies the requested actions, and eventually saves the result in a file in the same directory(ies) as the input file(s). Commands are applied in the order they are written (like a state machine).
Available options (version 2.14.alpha)
Command | Description |
---|---|
-VERBOSITY [0-4]
|
sets the log verbosity level (0: verbose, 1: standard, 2: important, 3: warnings and errors only, 4: errors only)
notes: - to hide plugin loading logs, it should be set as first argument (even before -SILENT, in which case -SILENT can be the second argument) - since version 2.13 |
-SILENT
|
enables silent mode (no console will appear)
Warning: must be first if required (or after -VERBOSITY). |
-O {filename}
|
opens a file
If the file format is ASCII, optional settings are:
For all formats, optional settings are (version 2.5.6 and above):
Note: file type is automatically guessed from its extension. |
-COMMAND_FILE {base name}
|
loads commands from a file.
Other commands after -COMMAND_FILE will run after all commands in the file have been processed. See more information here: [1] Notes:
|
-SELECT_ENTITIES -{FIRST} {first count} -{LAST} {last count} {-ALL} {-NOT} {-REGEX} {regex pattern}
|
Selects some entities among all those loaded, before applying the subsequent commands.
Sub-options are:
Notes:
|
-MOMENT {radius}
|
Computes the 1st order moment for all loaded clouds with the specified radius.
Notes:
|
-FEATURE {type} {radius}
|
Computes the geometric feature of type {type} for all loaded clouds with the specified radius:
{type} can be one of the following:
Notes:
|
-OCTREE_NORMALS {radius}
|
Computes the normals for all loaded clouds with the specified radius.
Optional settings are:
Notes:
|
-INVERT_NORMALS
|
Inverts the normals of the loaded entities (cloud or mesh, and per-vertex of per-triangle for meshes)
Note: since version 2.12 |
-COMPUTE_NORMALS
|
forces CC to compute normals at loading time (which is generally more robust) when importing files containing structured clouds (i.e. PTX, FARO and DP file for now). Normals are not computed by default.
Note: must be placed before the '-O' option. |
-NORMALS_TO_SFS
|
Converts normal vectors to 3 scalar fields (Nx, Ny and Nz).
Notes:
|
-NORMALS_TO_DIP
|
Converts normal vectors to 2 'dip' and 'dip direction' scalar fields.
Notes:
|
-NORMALS_TO_HSV
|
Converts normal vectors to HSV colors.
Notes:
|
-CLEAR_NORMALS
|
Removes all normals from the loaded entities. |
-ORIENT_NORMS_MST {number of neighbors}
|
(Re)orient the normals of the loaded clouds with a Minimum Spanning Tree.
Note: Clouds without normals are simply ignored. |
-MERGE_CLOUDS
|
merges all loaded/generated clouds as one unique cloud.
Note: result is automatically saved by default (see the AUTO_SAVE command to change this). |
-MERGE_MESHES
|
merges all loaded/generated meshes as one unique mesh.
Note: result is automatically saved by default (see the AUTO_SAVE command to change this). This option is available since version 2.9. |
-SS {algorithm} {parameter}
|
applies a subsampling {algorithm} to the currently opened/generated cloud(s).
{algorithm} can be RANDOM, SPATIAL or OCTREE. Then, the expected {parameter} value depends on the chosen algorithm:
Optional sub-options are (since version 2.13):
Notes:
|
-EXTRACT_CC {octree level} {minimum number of points per component}
|
extracts the connected components from the currently opened/generated cloud(s).
{octree level} should be between 1 and 21. Notes:
|
-SAMPLE_MESH {method} {parameter}
|
samples points on the loaded mesh(es).
For each mesh, a cloud will be generated (and will be added to the current loaded cloud set - i.e. further processing can be applied to this cloud). {method} can be POINTS or DENSITY. Expected parameter is:
Notes:
|
-EXTRACT_VERTICES
|
Extract the vertices of all loaded meshes as standalone point clouds. Note that this option is not yet activated! (sorry about that)
Notes:
|
-C2C_DIST
|
computes cloud-to-cloud distances on the two first loaded/generated clouds (1st = compared / 2nd = reference).
Optional settings are:
Notes:
|
-C2M_DIST
|
computes Cloud-to-Mesh distances between the first loaded/generated cloud (compared) and the first loaded mesh (reference).
Optional settings are:
Notes:
|
-RASTERIZE -GRID_STEP {value}
|
Rasterizes the loaded clouds by projecting them inside a regular grid.
Optional settings are:
Default behavior is 'leave cells empty'
Notes:
|
-VOLUME -GRID_STEP {grid step}
|
2.5D estimation of the volume between two point clouds (the first is the ceiling, the second is the ground by default).
This tool outputs two files:
Optional settings are:
Notes:
|
-STAT_TEST {distrib} {distrib parameters} {p-value} {neighbors count}
|
applies a local statistical test based on their active scalar field to all the of loaded/generated clouds.
{distrib} can be GAUSS or WEIBULL. Expected distribution parameters are:
Note: result is automatically saved by default (see the AUTO_SAVE command to change this). |
-COORD_TO_SF {dimension: X, Y or Z}
|
exports the specified coordinate (dimension) to a scalar field.
Note: creates a new scalar field (or overwrite any existing one with the same name) and sets it active. |
-SF_TO_COORD {sf index or name} {dimension: X, Y or Z}
|
set the specified scalar field values as coordinate (dimension) of the loaded clouds.
Notes:
|
-COLOR_INTERP
|
Interpolates the colors from one cloud to the other cloud.
Note: since version 2.13. |
-FILTER_SF {minVal} {maxVal}
|
filters all the loaded/generated clouds (or meshes, since version 2.13) based on their active scalar field values.
A new cloud (or new mesh) is created each time with only the points falling in the [minVal maxVal] interval. Notes:
You can use special words in place of numbers that CC will replace by the actual SF values:
|
-DENSITY {sphere radius}
|
computes the density (inside a sphere around each point) on the currently opened/generated cloud(s).
Optional setting:
Notes:
|
-APPROX_DENSITY
|
computes approximate density on the currently opened/generated cloud(s).
Optional setting:
Notes:
|
-ROUGH {kernel size} {-UP_DIR {x} {y} {z}}
|
computes the roughness with a given kernel size on the currently opened/generated cloud(s).
Since version 2.13, optional parameter Notes:
|
-CURV {type} {kernel size}
|
computes local curvature with a given kernel size on the currently opened/generated cloud(s).
{type} can be MEAN, GAUSS or NORMAL_CHANGE (this last option stands for 'Normal change rate' and is only available in version 2.10 or later). Notes:
|
-SF_GRAD {euclidian}
|
computes the gradient of the active scalar field (or the first one if none is active) on the currently opened/generated cloud(s).
The {euclidian} option specifies whether the scalar field is 'euclidian' (TRUE) - typically like a distance field - or not (FALSE). Notes:
|
-BEST_FIT_PLANE
|
computes the best fitting plane on all loaded clouds.
Optional settings are:
Notes:
|
-APPLY_TRANS {-APPLY_TO_GLOBAL {FORCE}} {-INVERSE} {filename}
|
applies a 4x4 transformation matrix to the loaded entities (clouds or meshes). The matrix is read from a simple text file with the matrix rows on each line (4 values per lines, 4 lines).
Sub-options are:
Notes:
|
-MATCH_CENTERS
|
makes all the (bounding-box) centers of the loaded entities match. All the entities will move relatively to the first one (clouds are always considered first if clouds and meshes are loaded).
Note: result is automatically saved by default (see the AUTO_SAVE command to change this). |
-DELAUNAY
|
Triangulates the loaded clouds with 2.5D Delaunay triangulation. The triangulation is done in the (XY) plane by default.
Optional settings are:
Notes:
|
-FLIP_TRI
|
Flips the order of the triangle vertices of all opened meshes (since version 2.13).
Notes:
|
-ICP
|
Iterative Closest Point registration procedure.
Optional settings are:
Notes:
|
-CROP {Xmin:Ymin:Zmin:Xmax:Ymax:Zmax}
|
Crops all loaded clouds inside or outside a given box.
Optional settings are:
Notes:
|
-CROP2D {ortho_dim} {n:number of vertices} X1 Y1 X2 Y2 ... Xn Yn
|
Crops all loaded clouds inside or outisde a given 2D polyline. Cropping is done in a plane defined by its orthogonal dimension: X, Y or Z (i.e. coordinates along this dimension will be ignored).
Optional settings are:
Note:
|
-CROSS_SECTION {XML parameters file}
|
Extracts one or multiple sections from the clouds or meshes.
Either the loaded clouds and/or meshes (see the -O option) can be used otherwise CC can load one or several files from a specified folder (use the 'FilePath' key). See [2] for an example of XML parameter file. Note:
|
-SOR {number of neighbors} {sigma multiplier}
|
applies the SOR (Statistical Outlier Removal) filter to the loaded cloud(s).
For each cloud, a new one will be generated (and will replace the origin cloud). Notes:
|
-NOISE KNN/RADIUS {value 1} REL/ABS {value 2} {RIP}
|
applies the Noise filter to the loaded cloud(s).
For each cloud, a new one will be generated (and will replace the origin cloud). Value 1: the caller has to choose between KNN (number of neighbors) or RADIUS (spherical neighborhood) Value 2: the caller has to choose between REL (multiplier of the local error standard deviation) or ABS (absolute error) RIP: Remove Isolated Points (optional) Example: '-NOISE RADIUS 0.5 REL 1.0 RIP' Notes:
|
-RDP {min distance between points}
|
applies the Remove duplicate points tool to the loaded cloud(s).
For each cloud, a new one will be generated (and will replace the origin cloud). The minimum distance between points (to not consider them as duplicate) can be set. Otherwise a very small value is used by default. Notes:
|
-DEBUG
|
display various pieces of information to help one debug and tweak the command line.
Note:
|
-RENAME_ENTITIES {base name}
|
rename all loaded entities (clouds or meshes) with the provided base name.
A numerical suffix is automatically added if multiple entities are loaded. Note:
|
-SF_ARITHMETIC {SF index or name} {operation} {option}
|
applies operations to a given scalar field of the loaded cloud/mesh.
SF2 = operation(SF) The scalar-field index starts from 0. The user can use the keyword 'LAST' to designate the last scalar field. Supported operations are:
Optional settings are:
Notes:
|
-SF_OP {SF index or name} {operation} {value}
|
applies an arithmetic operation to a given scalar field of the loaded cloud/mesh and with a given scalar value.
SF = SF (+,-,*,/) VALUE or SF = 'SET' VALUE (since version 2.13) The scalar-field index starts from 0. The user can use the keyword 'LAST' to designate the last scalar field. Supported operations are:
Notes:
|
-SF_OP_SF {SF1 index or name} {operation} {SF2 index or name}
|
applies an arithmetic operation to two scalar fields of the loaded cloud/mesh.
SF = SF1 (+,-,*,/) SF2 The scalar-field indexes start from 0. The user can use the keyword 'LAST' to designate the last scalar field. Supported operations are:
Notes:
|
-SF_INTERP {SF index} {-DEST-IS_FIRST}
|
applies the SF Interpolate from another entity algorithm to a given scalar field of the 2 first loaded clouds
By default the first cloud will be considered as the source cloud (with the designated scalar field) and the second cloud is the destination cloud. Use the sub-option -DEST-IS_FIRST to invert their roles. The scalar-field index starts from 0. The user can use the keyword 'LAST' to designate the last scalar field. Warning: for now the command line will always use the same options:
Notes
|
-SF_ADD_CONST {SF name} {value}
|
adds a constant scalar field (with the specified value for all scalar values) to the loaded clouds
Notes
|
-RENAME_SF {SF index or name} {new name}
|
renames a given scalar field of the loaded clouds/meshes.
The scalar-field index starts from 0. The user can use the keyword 'LAST' to designate the last scalar field. Notes:
|
-CBANDING {dim} {freq}
|
Applies color banding to all loaded entities (clouds and meshes). The user must specify the dimension (dim = X, Y or Z) and the frequency (in Hz, as an integer).
Note:
|
-CLEVELS {bands} {input range min} {input range max} {output range min} {output range max}
|
Applies color levels to all loaded entities (clouds and meshes).
The caller must specify:
Note:
|
-SF_COLOR_SCALE {filename}
|
Loads a color scale from a XML file (generated with the Color Scales Manager). The loaded color scale is then applied to the active scalar field of all loaded clouds (and all loaded meshes since version 2.13).
Note:
|
-SF_CONVERT_TO_RGB {TRUE/FALSE}
|
Converts the active scalar field to RGB colors. The user must explicitly specify whether the previously existing colors (if any) should be mixed with the new ones (TRUE) or overwritten (FALSE).
Note:
|
-RGB_CONVERT_TO_SF
|
Converts the RGB colors to 5 scalar fields in the following order: Red, Green, Blue, Alpha and Composite.
Note:
|
-M3C2 {parameters_file}
|
Calls the M3C2 plugin (if available) on the two first loaded clouds. If a 3rd cloud is loaded, it will be used a core points. The first time, the parameters file can be created with the GUI tool (use the 'Save parameters to file' button in the bottom-left corner of the M3C2 dialog = the floppy icon). It can then be edited easily.
Note:
|
-CSF {filename}
|
Runs the Cloth Simulation Filter (CSF) plugin
Options are:
Note:
|
-CANUPO_CLASSIFY {classifier.prm}
|
Calls a CANUPO classifier (if the plugin is available) on the loaded clouds. You'll need a trained classifier (.prm file)
Optional settings are:
Note:
|
-PCV
|
Runs the PCV plugin (also known as ambient occlusion or ShadeVis)
Optional settings are:
Note:
|
-RANSAC
|
Runs the Ransac Shape Detection plugin
Options are:
Notes:
|
-C_EXPORT_FMT {format}
|
Specifies the default output format for clouds. Format can be one of the following: ASC, BIN, PLY, LAS, E57, VTK, PCD, SOI, PN, PV.
Optional settings are:
WARNING: the ADD_HEADER and ADD_PTS_COUNT options are broken in the 2.6.2 version. Use a newer version instead. |
-M_EXPORT_FMT {format}
|
Specifies the default output format for meshes. Format can be one of the following: BIN, OBJ, PLY, STL, VTK, MA, FBX.
Optional settings are:
|
-H_EXPORT_FMT {format}
|
Specifies the default output format for groups (hierarchy objects). Mostly the BIN format, but other formats that support a collection of objects might be elligible.
Note:
|
-FBX -EXPORT_FMT {format}
|
Specifies the default output format for FBX meshes. Must be specified in addition to M_EXPORT_FMT if FBX format is chosen. Format can be one of the following: FBX_binary, FBX_ascii, FBX_encrypted, FBX_6.0_binary, FBX_6.0_ascii, FBX_6.0_encrypted.
Notes:
|
-PLY_EXPORT_FMT {format}
|
Specifies the default output format for PLY files. Format can be one of the following: ASCII, BINARY_BE (big endian) or BINARY_LE (little endian).
Note: default output format is binary (LE/BE depending on the current OS) |
-NO_TIMESTAMP
|
to prevent CC from generating an automatic suffix (timestamp) for output file name (warning: this make the name of an output file predictable but if the file already exists it will be overwritten). |
-BUNDLER_IMPORT {filename}
|
imports a Snavely's Bundler file.
Bundler import through the command line is mainly meant to generate ortho-rectified versions of input images directly on disk. Optional settings are:
Note: see below for more details. |
-SET_GLOBAL_SHIFT {x} {y} {z} {-KEEP_ORIG_FIXED}
|
Overrides the Global Shift information for all loaded entities.
Use the sub-option -KEEP_ORIG_FIXED to maintain the global coordinates unchanged. This will in effect translate the points in the local coordinate system (a warning may be issued if the resulting coordinates are too big). Note: since version 2.13 |
-DROP_GLOBAL_SHIFT
|
Removes the Global Shift information from all loaded entities.
Note:
|
-SET_ACTIVE_SF {SF index or 'SF name'}
|
Sets the active scalar field index or name (same for all loaded clouds).
Notes:
|
-REMOVE_ALL_SFS
|
Removes all scalar fields (from all loaded clouds or meshes).
Note:
|
-REMOVE_SF {index}
|
Removes the scalar field at the specified index (from all loaded clouds or meshes).
Notes:
|
-REMOVE_RGB
|
Removes colors (from all loaded clouds or meshes).
Notes:
|
-REMOVE_NORMALS
|
Removes normals (from all loaded clouds or meshes, per vertex or per faces).
Notes:
|
-REMOVE_SCAN_GRIDS
|
Removes all scan grids (from all loaded clouds or meshes).
Note:
|
-REMOVE_SENSORS
|
Removes all sensors (both TLS and cameras, directly under clouds, meshes or mesh vertices).
Note:
|
-COMPRESS_FWF
|
compresses FWF data associated to all clouds in memory (waveform support) |
-AUTO_SAVE {ON/OFF}
|
Enables (ON) or disables (OFF) automatic backup of clouds and meshes at each step (you'll have to manually call -SAVE_CLOUDS or -SAVE_MESHES at the right time/position in your command). |
-PCD_OUTPUT_FORMAT {format}
|
Sets the default PCD file output format.
Format can be:
Notes:
|
-SAVE_CLOUDS
|
Saves all currently loaded clouds (note that this is not necessary by default as all modified or newly generated cloud are automatically saved).
Optional settings are:
|
-SAVE_MESHES
|
Saves all currently loaded meshes (note that this is not necessary by default as all modified or newly generated meshes are automatically saved).
Optional settings are:
|
-CLEAR
|
closes all currently loaded entities. |
-CLEAR_CLOUDS
|
closes all currently loaded clouds. |
-CLEAR_MESHES
|
closes all currently loaded meshes. |
-POP_CLOUDS
|
removes the last loaded or generated cloud. |
-POP_MESHES
|
removes the last loaded or generated mesh. |
-LOG_FILE {filename}
|
logs all command output messages in a given file. |
-FWF_O {filename}
|
opens a LAS 1.3/1.4 file (waveform support) [Windows version only]
|
-FWF_SAVE_CLOUDS {filename}
|
saves all clouds in memory a LAS 1.3/1.4 files (waveform support) [Windows version only]
|
Example 0
CloudCompare -O -GLOBAL_SHIFT AUTO mylargecoordinatescloud.las -C_EXPORT_FMT LAS -SS SPATIAL 0.1
This will open file mylargecoordinatescloud.las with an automatic Global Shift (to avoid issues with large coordinates), then set the export format to be LAS as well (otherwise the CloudCompare BIN format is used by default) and eventually it applies some spatial subsampling with a 0.1 step (= 0.1 meter, assuming the LAS file coordinates are in meters). The output file will be mylargecoordinatescloud_SPATIAL_SUBSAMPLED_YYYY-MM-DD_HHhMM.las.
Example 1
CloudCompare -O myhugecloud.bin -SS SPATIAL 0.1
This will open file myhugecloud.bin then apply spatial subsampling with a 0.1 step (e.g. in meters). The output file will be myhugecloud_SPATIAL_SUBSAMPLED_YYYY-MM-DD_HHhMM.bin.
Example 2
CloudCompare -O myhugecloud1.bin -SS SPATIAL 0.1 -O 'myhugecloud2.bin' -SS RANDOM 1000000 -CLEAR_ALL -O 'myhugecloud3.bin' -SS OCTREE 9
This will open file myhugecloud1.bin then apply spatial subsampling with a 0.1 step (e.g. in meters).
Then it will open file myhugecloud2.bin and apply to both files random subsampling (1 000 000 points each).
Then it will close the two first files.
Eventually it will open file myhugecloud3.bin and apply octree based subsampling (level 9).
The output files will be: myhugecloud1_SPATIAL_SUBSAMPLED_YYYY-MM-DD_HHhMM.bin, myhugecloud1_RANDOM_SUBSAMPLED_YYYY-MM-DD_HHhMM.bin, myhugecloud2_RANDOM_SUBSAMPLED_YYYY-MM-DD_HHhMM.bin and myhugecloud3_OCTREE_level_9_SUBSAMPLED_YYYY-MM-DD_HHhMM.bin
Cloud-to-cloud distance
CloudCompare -o cloud1.bin -o cloud2.asc -c2c_dist -split_xyz -model HF SPHERE 50.0
CC will load cloud1.bin and cloud2.asc, then compute the distance from cloud1 (compared) relatively to cloud2 (reference) with a height function (quadric) computed on all the neighbors falling in a sphere of radius 50.0 around each point of cloud1. On output a file cloud1_C2C_DIST_YYYY-MM-DD_HHhMM.bin will be generated (with the resulting distances as first scalar field and the 3 components of the corresponding displacement vector along X, Y and Z as additional scalar fields).
Note: this cloud stays in memory and can be processed further (with -FILTER_SF for instance).
Cloud-to-mesh distance
CloudCompare -o cloud1.bin -o mesh.obj -c2m_dist
CC will load cloud1.bin and mesh.obj, then compute the distance from cloud1 (compared) relatively to mesh (reference). On output a file cloud1_C2M_DIST_YYYY-MM-DD_HHhMM.bin will be generated (with the resulting distances as scalar field).
Note: this cloud stays in memory and can be processed further (with -FILTER_SF for instance).
Cycling over files in a folder (Windows)
set local EnableDelayedExpansion
set Compared=C:\MY_FIRST_PATH
set Reference=E:\MY_SECOND_PATH
for %%f in ( "%Reference%"\* ) do ("C:\Program Files\CloudCompare\cloudcompare.exe" -SILENT -C_EXPORT_FMT LAS -O %Compared%\%%~nxf -O %Reference%\%%~nxf -c2c_dist -MAX_DIST 1 -FILTER_SF 1 1 -SOR 8 2)
Bundler import
CloudCompare -BUNDLER_IMPORT bundle.out -COLOR_DTM 1000000
This will generate all ortho-rectified versions of the images declared in 'bundle.out', as well as the colored vertices of a pseudo-DTM constructed from the keypoints.
(Mesh) format conversion
CloudCompare -M_EXPORT_FMT FBX -FBX -EXPORT_FMT FBX_binary -O Foot.ply -NO_TIMESTAMP -SAVE_MESHES
This will open the file named 'Foot.ply' then save it in FBX binary format (same base filename, without any decoration: i.e. Foot.fbx)