Command line mode

From CloudCompareWiki
Jump to navigation Jump to search

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:

  • -SKIP {number of lines to skip} If set, CC will automatically skip the specified number of lines

For all formats, optional settings are (version 2.5.6 and above):

  • -GLOBAL_SHIFT {AUTO} or {FIRST} or {x y z}
    • AUTO: CC will automatically determine the best Global Shift translation to preserve coordinates accuracy
    • FIRST: CC will use the same parameters that were used for the first entity (i.e. the result of the first usage of the 'AUTO' option, or the first specified Global Shift vector (x,y,z)) - the FIRST option is available since v2.11
  • Warnings:
    • the GLOBAL_SHIFT option will be ignored for BIN files as they already contain their own GLOBAL_SHIFT values!
    • the AUTO option won't reuse the global shift set for previous entities. Use the FIRST option instead.

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:

  • multiple lines allowed
  • multiple arguments in each line allowed
  • quoted arguments are handled
  • whole (or half) line comments with '#' or '//' are supported.
  • partial comments are supported: '/* my comment here */' (must be quoted with either single or double quote if it contains spaces)
  • since version 2.13 only
-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:

  • -FIRST {count}: if set, first count of entities will be selected (optional). Example: xx.....
  • -LAST {count}: if set, last count of entities will be selected (optional). Example: .....xx
  • -ALL: if set, all entities will be selected (optional). It has higher priority than FIRST/LAST/REGEX. Example: xxxxxxx
  • -REGEX {regex_pattern}: if set, all entities with matching names will be selected (optional). It has higher priority than FIRST/LAST. Example: x(merged)..x(merged)...
  • -NOT: if set, all condition will be reversed (optional)
    • -NOT -FIRST {count} -> all but first {count}. Example: ..xxxxx
    • -NOT -LAST {count} -> all but last {count}. Example: xxxxx..
    • -NOT -ALL -> none. Example: .......
    • -NOT -REGEX matched -> regex not matched. Example: .(merged)xx.(merged)xxx
    • special case: -NOT -FIRST c1 -LAST c2 -> all except first 'c1' AND last 'c2' entities. Example: ..xxx..
  • -CLOUD: if set, only clouds will be selected (optional)
  • -MESH: if set, only meshes will be selected (optional)

Notes:

  • sub-options can be set in any order
  • it is possible to use FIRST and LAST at the same time. Example: xx...xx
  • if neither -CLOUD nor -MESH are set then both types of entities will be selected
  • since version 2.13
-MOMENT {radius} Computes the 1st order moment for all loaded clouds with the specified radius.

Notes:

  • result is automatically saved by default (see the AUTO_SAVE command to change this).
  • since version 2.11
-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:

  • SUM_OF_EIGENVALUES
  • OMNIVARIANCE
  • EIGENTROPY
  • ANISOTROPY
  • PLANARITY
  • LINEARITY
  • PCA1
  • PCA2
  • SURFACE_VARIATION
  • SPHERICITY
  • VERTICALITY
  • EIGENVALUE1
  • EIGENVALUE2
  • EIGENVALUE3

Notes:

  • result is automatically saved by default (see the AUTO_SAVE command to change this).
-OCTREE_NORMALS {radius} Computes the normals for all loaded clouds with the specified radius.

Optional settings are:

  • -ORIENT {option} to define an orientation hint
    • PLUS_ZERO or PLUS_ORIGIN (v2.12+): normals will all point outwards the origin (0, 0, 0)
    • MINUS_ZERO or MINUS_ORIGIN (v2.12+): normals will all point towards the origin (0, 0, 0)
    • PLUS_BARYCENTER: normals will all point outwards the cloud barycenter
    • MINUS_BARYCENTER: normals will all point towards the cloud barycenter
    • PLUS_X: normals will all point towards +X (i.e. Nx >= 0)
    • MINUS_X: normals will all point towards -X (i.e. Nx <= 0)
    • PLUS_Y: normals will all point towards +Y (i.e. Ny >= 0)
    • MINUS_Y: normals will all point towards -Y (i.e. Ny <= 0)
    • PLUS_Z: normals will all point towards +Z (i.e. Nz >= 0)
    • MINUS_Z: normals will all point towards -Z (i.e. Nz <= 0)
    • PREVIOUS: normals will have the same orientation as the previous normals (if any)
    • SENSOR_ORIGIN (v2.12+): use the associated sensor origin (if any)
  • -MODEL {local_model_type} to specify a local model:
    • {local_model_type} = LS / TRI / QUADRIC
  • input radius can be replaced by 'auto' to let CC try to guess a possible value (since version 2.11)

Notes:

  • default local model is 'QUADRIC'
  • if you have files containing structured clouds (e.g. PTX, FARO, DP, etc.), it may be more efficient to use the 'COMPUTE_NORMALS' option (see below)
  • result is automatically saved by default (see the AUTO_SAVE command to change this).
  • since version 2.11
-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:

  • since version 2.11 only
-NORMALS_TO_DIP Converts normal vectors to 2 'dip' and 'dip direction' scalar fields.

Notes:

  • since version 2.11 only
-NORMALS_TO_HSV Converts normal vectors to HSV colors.

Notes:

  • since version 2.12 only
-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:

  • RANDOM: number of randomly selected points
  • SPATIAL: minimum distance between two points
  • OCTREE: subdivision level (between 1 and 10 in the standard version)

Optional sub-options are (since version 2.13):

  • -SS OCTREE NUMBER_OF_POINTS {number}: to subsample with the highest octree level for which the resulting point count won't exceed the given number of points
  • -SS OCTREE NUMBER_OF_POINTS PERCENT {number}: to calculate NUMBER_OF_POINTS from PERCENT. PERCENT should be a decimal number between 0 and 100.
  • -SS OCTREE CELL_SIZE {size}: to deduce the octree level from the given cell size.
  • -SS RANDOM PERCENT {number}: to calculate the number of sampled points from PERCENT. PERCENT should be a decimal number between 0 and 100.
  • -SS SPATIAL {fallback_step} USE_ACTIVE_SF {step_at_SF_min} {step_at_SF_max}: to use spatial step interpolation based on the active scalar field (the fallback step will be used if the active SF has only invalid values)

Notes:

  • result is automatically saved by default (see the AUTO_SAVE command to change this).
  • input clouds are now replaced by their subsampled version (since version 2.6.1)
-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:

  • extracted components are automatically saved by default (see the AUTO_SAVE command to change this).
  • input clouds are replaced by the extracted components
-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:

  • POINTS: the corresponding number of points
  • DENSITY: the corresponding surface density

Notes:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • this cloud can be used as input for cloud-to-cloud or cloud-to-mesh distances computation for instance.
-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:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • the source mesh is discarded
  • since version 2.10 only
-C2C_DIST computes cloud-to-cloud distances on the two first loaded/generated clouds (1st = compared / 2nd = reference).

Optional settings are:

  • -SPLIT_XYZ If set, 3 additional scalar fields will be generated (displacement along the 3 dimensions)
  • -MAX_DIST {value} to set a max distance above which CC won't have to search for a nearest neighbor (faster)
  • -OCTREE_LEVEL {value} to manually set the octree subdivision level at which the computation will be performed
  • -MODEL {local_model_type} {neighborhood_type} {neighborhood_size} to specify a local model:
    • {local_model_type} = LS / TRI / HF
    • {neighborhood_type} = KNN / SPHERE
    • {neighborhood_size} = neighbor count (if KNN) or sphere radius (if SPHERE)
  • -MAX_TCOUNT {thread count} to set the maximum number of threads to use
  • -SPLIT_XY_Z to split the distance between the z component and the xy plane component (since version 2.13)

Notes:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • see below for more details
-C2M_DIST computes Cloud-to-Mesh distances between the first loaded/generated cloud (compared) and the first loaded mesh (reference).

Optional settings are:

  • -FLIP_NORMS to consider that normal vectors point inside the matter and not outside
  • -MAX_DIST {value} to set a max distance above which CC won't have to search for a nearest neighbor (faster)
  • -OCTREE_LEVEL {value} to manually set the octree subdivision level at which the computation will be performed
  • -MAX_TCOUNT {thread count} to set the maximum number of threads to use
  • -UNSIGNED to compute unsigned distances (since version 2.13)
  • -SPLIT_XY_Z to split the distance between the z component and the xy plane component (since version 2.13)

Notes:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • see below for more details
-RASTERIZE -GRID_STEP {value} Rasterizes the loaded clouds by projecting them inside a regular grid.

Optional settings are:

  • -VERT_DIR {0/1/2} to specify the projection dimension (0=X / 1=Y / 2=Z) - default is 2 (Z)
  • -PROJ {MIN/AVG/MAX} to specify how the altitude of each cell is computed (minimum, average or maximum altitude of the projected points). Default is AVG (average)
  • -SF_PROJ {MIN/AVG/MAX} to specify how the SF value(s) of each cell are computed (minimum, average or maximum of the projected points SF value(s)). Default is AVG (average)
  • -EMPTY_FILL {MIN_H/MAX_H/CUSTOM_H/INTERP/KRIGING} to specify how empty cells should be filled:
    • MIN_H = min height
    • MAX_H = max height
    • CUSTOM_H = custom value (warning: you must also set the CUSTOM_HEIGHT option - see below)
    • INTERP = interpolate with Delaunay triangulation (warning: you may have to set the MAX_EDGE_LENGTH parameters as well - see below)
    • KRIGING = interpolate with Kriging (since version 2.13)

Default behavior is 'leave cells empty'

  • -MAX_EDGE_LENGTH {value} to specify a maximum triangle edge length for interpolation (to be used with -EMPTY_FILL INTERP - default value is 1.0) (since version 2.12)
  • -CUSTOM_HEIGHT {value} to define the custom height filling value (if the '-EMPTY_FILL CUSTOM_H' strategy is used - see above - if not set, the EMPTY_FILL option will fall back to 'leave cells empty')
  • -KRIGING_KNN {number of neighbors} to define the number of neighbors used for Kriging (if the '-EMPTY_FILL KRIGING' strategy is used - see above - default is 8) (since version 2.13)
  • -OUTPUT_CLOUD to output the result as a cloud (this is the default option if no other output format is defined)
  • -OUTPUT_MESH to output the result as a mesh
  • -OUTPUT_RASTER_Z to output the result as a geotiff raster (only altitudes, no RGB)
  • -OUTPUT_RASTER_Z_AND_SF to output the result as a geotiff raster (altitudes + all SFs by default, no RGB)
  • -OUTPUT_RASTER_RGB to output the result as a geotiff raster (RGB)
  • -RESAMPLE to resample the input cloud (only in combination with OUTPUT_CLOUD and/or OUTPUT_MESH)

Notes:

  • if OUTPUT_CLOUD or OUTPUT_MESH is selected, the resulting entity will replace the original cloud in memory
-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:

  • the volume calculation report (named VolumeCalculationReport.txt and saved next to the first file)
  • the 2.5D grid points with the 'height difference' as a scalar field and also as RGB colors (colors are generated with the default color scale of CC). The file is saved next to the previous one, and it has the same base name as the first file with '_HEIGHT_DIFFERENCE' appended at the end.

Optional settings are:

  • -VERT_DIR {0/1/2} to specify the projection dimension (0=X / 1=Y / 2=Z) - default is 2 (Z)
  • -CONST_HEIGHT {value} to use a constant height instead of the second cloud
  • -GROUND_IS_FIRST to invert the clouds order
  • -OUTPUT_MESH to output a mesh instead of a cloud

Notes:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • see below for more details
-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:

  • GAUSS: the mean value and sigma
  • WEIBULL: a, b and the shift value

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:

  • it is possible to use '-1' as index to designate the default/current scalar field
  • since version 2.13.
-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:

  • result is automatically saved by default (see the AUTO_SAVE command to change this).
  • input clouds are now replaced by their filtered version (since version 2.6.1) and likewise for meshes (since version 2.13)

You can use special words in place of numbers that CC will replace by the actual SF values:

  • 'MIN' = min value
  • 'DISP_MIN' = min displayed value
  • 'SAT_MIN' = min saturation value
  • 'MAX' = max value
  • 'DISP_MAX' = max displayed value
  • 'SAT_MAX' = max saturation value
  • 'N_SIGMA_MIN {N}' = mean - N * standard deviation
  • 'N_SIGMA_MAX {N}' = mean + N * standard deviation
-DENSITY {sphere radius} computes the density (inside a sphere around each point) on the currently opened/generated cloud(s).

Optional setting:

  • -TYPE {density_type}: to specify the type of density to compute. {density_type} can be KNN (nearest neighbors count), SURFACE (surface density) or VOLUME (volume density).

Notes:

  • a new scalar field is created on each cloud
  • result is automatically saved by default (see the AUTO_SAVE command to change this)
-APPROX_DENSITY computes approximate density on the currently opened/generated cloud(s).

Optional setting:

  • -TYPE {density_type}: to specify the type of density to compute. {density_type} can be KNN (nearest neighbors count), SURFACE (surface density) or VOLUME (volume density).

Notes:

  • a new scalar field is created on each cloud.
  • result is automatically saved.
-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 -UP_DIR {x} {y} {z} allows to specify a 'up direction' to sign roughness values.

Notes:

  • a new scalar field is created on each cloud
  • result is automatically saved by default (see the AUTO_SAVE command to change this)
-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:

  • a new scalar field is created on each cloud
  • result is automatically saved by default (see the AUTO_SAVE command to change this)
-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:

  • a new scalar field is created on each cloud
  • result is automatically saved by default (see the AUTO_SAVE command to change this)
-BEST_FIT_PLANE computes the best fitting plane on all loaded clouds.

Optional settings are:

  • -MAKE_HORIZ: will actually transform the loaded cloud(s) so as to make them 'horizontal'
  • -KEEP_LOADED: to keep the resulting plane(s) in memory as mesh(es)

Notes:

  • resulting planes are automatically saved
  • if MAKE_HORIZ is defined, result is automatically saved by default (see the AUTO_SAVE command to change this)
-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:

  • -INVERSE: to invert the transformation before applying it (since version 2.13)
  • -APPLY_TO_GLOBAL {FORCE}: to apply the transformation to the global coordinates instead of the local coordinates (since version 2.13)
    • warning: the Global Shift might be automatically adjusted to preserve accuracy (and small local coordinates)
    • by default, the Global Shift won't be automatically adjusted if the local coordinates are already large.
    • Use 'FORCE' after -APPLY_TO_GLOBAL to force CC to adjust the Global Shift in any case.

Notes:

  • each entity will be replaced in memory by its transformed version
  • resulting entities are automatically saved by default (see the AUTO_SAVE command to change this)
-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:

  • the resulting 'mesh' entity is automatically saved (see the AUTO_SAVE command to change this).
  • the clouds are automatically removed (from the 'loaded clouds' set).
-FLIP_TRI Flips the order of the triangle vertices of all opened meshes (since version 2.13).

Notes:

  • the updated mesh entities are automatically saved (see the AUTO_SAVE command to change this).
  • since version 2.13 only
-ICP Iterative Closest Point registration procedure.

Optional settings are:

  • -REFERENCE_IS_FIRST: by default the ICP registration process will take the first loaded entity as 'data' and the second as 'model' (clouds are always considered first). If you use this option their respective role will be inverted.
  • -MIN_ERROR_DIFF: to specify the min. error difference between two steps (default = 1e-6)
  • -ITER: to specify the number of iterations (in which case the 'MIN_ERROR_DIFF' option will be ignored)
  • -OVERLAP: to specify the percentage of (final) overlap (integer number between 10 and 100 - default = 100)
  • -ADJUST_SCALE: to enable the ICP registration with adaptive scale
  • -RANDOM_SAMPLING_LIMIT: to specify the number of points randomly sampled at each iteration (default = 20 000)
  • -FARTHEST_REMOVAL: to enable the research option that ignores points with the highest distances at each iteration
  • -DATA_SF_AS_WEIGHTS + {SF index or name}: to use a given scalar field as weights on the 'data' entity (index starts from 0 - the 'LAST' keyword can be used)
  • -MODEL_SF_AS_WEIGHTS + {SF index or name}: to use a given scalar field as weights on the 'model' entity (index starts from 0 - the 'LAST' keyword can be used)
  • -ROT + {'XYZ' or 'X' or 'Y' or 'Z' or 'NONE'}: to constrain the rotation around a given axis (or no rotation at all) (since version 2.11)
  • -SKIP_TX, -SKIP_TY and/or -SKIP_TZ to prevent the entities from moving along X, Y and/or Z (since version 2.13)

Notes:

  • the 'data' entity in its final position is automatically saved (see the AUTO_SAVE command to change this).
  • the corresponding transformation matrix is automatically saved in a separate text file (always).
  • the name of the weight scalar fields can be used only since version 2.13 (only the SF index was accepted in previous versions)
  • since version 2.13, it is possible to use '-1' as index to designate the default/current scalar field (to be used with DATA_SF_AS_WEIGHTS or MODEL_SF_AS_WEIGHTS)
-CROP {Xmin:Ymin:Zmin:Xmax:Ymax:Zmax} Crops all loaded clouds inside or outside a given box.

Optional settings are:

  • -OUTSIDE: if defined only the points falling outside the input box will be kept (instead of inside by default).

Notes:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • each cloud will be replaced in memory by its cropped version (since version 2.11, the cloud is removed from memory if it's totally cropped out)
-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:

  • -OUTSIDE: if defined only the points falling outside the input polyline will be kept (instead of inside by default).

Note:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • each cloud will be replaced in memory by its cropped version
-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:

  • output sections for meshes are 'clean' (i.e. triangles on the cutting borders are re-meshed)
  • output sections are automatically saved in sub-folders (they are not kept in memory)
-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:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
-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:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • since version 2.12 only
-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:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • since version 2.13 only
-DEBUG display various pieces of information to help one debug and tweak the command line.

Note:

  • can be placed at different positions
  • since version 2.13 only
-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:

  • since version 2.13 only
-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:

  • sqrt (square root)
  • pow2
  • pow3
  • exp
  • log
  • log10
  • cos
  • sin
  • tan
  • acos
  • asin
  • atan
  • int (integer part)
  • inverse
  • abs (since version 2.13)

Optional settings are:

  • -IN_PLACE to apply the operation in place, without creating a new SF (since version 2.13)

Notes:

  • the updated cloud/mesh is automatically saved (see the AUTO_SAVE command to change this)
  • a new scalar field is created
  • the SF name can only be used since version 2.13
  • since version 2.13, it is possible to use '-1' as index to designate the default/current scalar field
-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:

  • add
  • sub
  • mult
  • div
  • set (since v2.13)

Notes:

  • the updated cloud/mesh is automatically saved (see the AUTO_SAVE command to change this)
  • the modification is done in place (i.e. the scalar field is directly modified)
  • the SF name can be used since version 2.13 only
  • since version 2.13, it is possible to use '-1' as index to designate the default/current scalar field
-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:

  • add
  • sub
  • mult
  • div
  • min
  • max

Notes:

  • the updated cloud/mesh is automatically saved (see the AUTO_SAVE command to change this)
  • the modification is done in place (i.e. the scalar field is directly modified)
  • since version 2.13 only
-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:

  • interpolation method: nearest neighbors
  • interpolation algorithm: normal distribution
  • radius = 1% of the destination cloud bounding-box
  • sigma = 40% of the radius

Notes

  • the updated cloud is not automatically saved! (use the SAVE_CLOUDS command to do it)
  • it is possible to use '-1' as index to designate the default/current scalar field
  • since version 2.13 only
-SF_ADD_CONST {SF name} {value} adds a constant scalar field (with the specified value for all scalar values) to the loaded clouds

Notes

  • updated clouds are automatically saved by default (see the AUTO_SAVE command to change this)
  • since version 2.13 only
-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:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • the SF name can only be used since version 2.13
  • since version 2.13, it is possible to use '-1' as index to designate the default/current scalar field
-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:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
-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:

  • the color bands (can be any mix of 'R', 'G' and 'B' - ex: 'G' or 'RB' or 'RGB')
  • the input range (typically where most of the color information lies, ex: 40 210)
  • the output range (typically: 0 255)

Note:

  • result is automatically saved by default (see the AUTO_SAVE command to change this)
  • since version 2.13
-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:

  • it may be necessary to explicitly set the active scalar field with the SET_ACTIVE_SF command
  • since version 2.10 only
-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:

  • it may be necessary to explicitly set the active scalar field with the SET_ACTIVE_SF command
  • since version 2.10 only
-RGB_CONVERT_TO_SF Converts the RGB colors to 5 scalar fields in the following order: Red, Green, Blue, Alpha and Composite.

Note:

  • since version 2.12 only
-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:

  • since version 2.10 only
-CSF {filename} Runs the Cloth Simulation Filter (CSF) plugin

Options are:

  • '-SCENES [scene]' name of the scene options are:
    • 'SLOPE'
    • 'RELIEF'
    • 'FLAT'
  • '-PROC_SLOPE' (turns on slope post processing for disconnected terrain)
  • '-CLOTH_RESOLUTION [value]' (double value of cloth resolution [ex. 0.5])
  • '-MAX_ITERATION [value]' (integer value of max iterations [ex. 500])
  • '-CLASS_THRESHOLD [value]' (double value of classification threshold [ex. 0.5])
  • '-EXPORT_GROUND' (exports the ground as a .bin file)
  • '-EXPORT_OFFGROUND' (exports the off-ground as a .bin file)

Note:

  • since version 2.12 only
-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:

  • USE_CONFIDENCE {threshold}
    • threshold must be between 0 and 1
    • use the 'SET_ACTIVE_SF' after loading a cloud to set the active scalar field if you want it to be used to refine the classification

Note:

  • since version 2.10 only
-PCV Runs the PCV plugin (also known as ambient occlusion or ShadeVis)

Optional settings are:

  • -N_RAYS [value]: number of rays
  • -IS_CLOSED: Tells PCV that the mesh is watertight. This accelerates processing.
  • -180: Rays only come from the "northern hemisphere" (northern means +Z)
  • -RESOLUTION: OpenGL context resolution

Note:

  • since version 2.10 only
-RANSAC Runs the Ransac Shape Detection plugin

Options are:

  • 'EPSILON_ABSOLUTE' (Max distance to primitive)
  • 'EPSILON_PERCENTAGE_OF_SCALE' (Max distance to primitive as a percentage of cloud scale 0.0-1.0 exclusive)
  • 'BITMAP_EPSILON_PERCENTAGE_OF_SCALE' (Sampling resolution as a percentage of cloud scale 0.0-1.0 exclusive)
  • 'BITMAP_EPSILON_ABSOLUTE' (Sampling resolution)
  • 'SUPPORT_POINTS' (Min Support points per primitive)
  • 'MAX_NORMAL_DEV' (Max normal deviation from the ideal shape normal vector [in Degrees])
  • 'PROBABILITY' (Probability that no better candidate was overlooked during sampling, lower the better!)
  • 'OUT_CLOUD_DIR' (path to save detected shapes clouds to, current dir if unspecified)
  • 'OUT_MESH_DIR' (path to save detected shapes meshes to, current dir if unspecified)
  • 'OUT_PAIR_DIR' (path to save detected shapes clouds & meshes to, current dir if unspecified)
  • 'OUT_GROUP_DIR' (path to save all shapes and primitives to as a single file, current dir if unspecified)
  • 'OUTPUT_INDIVIDUAL_SUBCLOUDS' (specify to output detected shapes clouds)
  • 'OUTPUT_INDIVIDUAL_PRIMITIVES' (specify to output detected shapes meshes)
  • 'OUTPUT_INDIVIDUAL_PAIRED_CLOUD_PRIMITIVE' (specify to output detected shapes clouds & meshes)
  • 'OUTPUT_GROUPED' (specify to output all detected shapes clouds & meshes as single file)
  • 'ENABLE_PRIMITIVE' (each shape listed after this option will be searched for )
    • 'PLANE'
    • 'SPHERE'
    • 'CYLINDER'
    • 'CONE'
    • 'TORUS'

Notes:

  • since version 2.11 only
-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:

  • -PREC [precision]: to specify the numerical output precision (for ASCII files only). precision is a positive integer (default = 12).
  • -SEP [separator]: to specify the separator character (for ASCII files only). separator can be one of the following string: SPACE, SEMICOLON, COMMA or TAB (default = SPACE).
  • -ADD_HEADER: to add a header with each column's name to the saved file (for ASCII files only).
  • -ADD_PTS_COUNT: to add the number of points at the beginning of the saved file (for ASCII files only).
  • -EXT [extension]: to specify the file extension (typically different from the default one for the chosen format)
  • -NO_LABEL: to prevent creating/loading 2D labels from ASCII files in case text columns are present in the file (since version 2.13.2)

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:

  • -EXT [extension]: to specify the file extension (typically different from the default one for the chosen format)
-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:

  • since version 2.11
-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:

  • if the input format is not supported by the current implementation, a list of available formats will be output in the console.
  • the option was "-FBX_EXPORT_FMT" in version 2.10 and earlier
-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:

  • -ALT_KEYPOINTS [filename]: load alternative keypoints from file filename
  • -SCALE_FACTOR [value]: sets image scale factor that has been used during keypoints generation
  • -COLOR_DTM [vertices count]: generates colored vertices of a pseudo-DTM with approximately 'vertices count' elements (in command line mode, vertices are automatically saved to 'colored_dtm_vertices.bin' next to ortho-rectified images)
  • -UNDISTORT: enables images undistortion

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:

  • equivalent to using '-SET_GLOBAL_SHIFT 0 0 0'
-SET_ACTIVE_SF {SF index or 'SF name'} Sets the active scalar field index or name (same for all loaded clouds).

Notes:

  • scalar field indexes start at 0 ('-1' means 'no SF enabled')
  • the SF name must be surrounded by simple quotes (e.g. 'Point Source Id')
  • designing the SF by its name is only possible since version 2.13
-REMOVE_ALL_SFS Removes all scalar fields (from all loaded clouds or meshes).

Note:

  • entities are not automatically saved after this command (you can use -SAVE_CLOUDS or -SAVE_MESHES explicitly)
-REMOVE_SF {index} Removes the scalar field at the specified index (from all loaded clouds or meshes).

Notes:

  • if no SF is found at this index, a simple warning will be issued (no error will be triggered).
  • entities are not automatically saved after this command (you can use -SAVE_CLOUDS or -SAVE_MESHES explicitly)
  • since version 2.12
  • since version 2.13, it is possible to use '-1' as index to designate the default/current scalar field
-REMOVE_RGB Removes colors (from all loaded clouds or meshes).

Notes:

  • entities are not automatically saved after this command (you can use -SAVE_CLOUDS or -SAVE_MESHES explicitly)
  • since version 2.11
-REMOVE_NORMALS Removes normals (from all loaded clouds or meshes, per vertex or per faces).

Notes:

  • entities are not automatically saved after this command (you can use -SAVE_CLOUDS or -SAVE_MESHES explicitly)
  • since version 2.11
-REMOVE_SCAN_GRIDS Removes all scan grids (from all loaded clouds or meshes).

Note:

  • entities are not automatically saved after this command (you can use -SAVE_CLOUDS or -SAVE_MESHES explicitly)
  • available since version 2.10 only
-REMOVE_SENSORS Removes all sensors (both TLS and cameras, directly under clouds, meshes or mesh vertices).

Note:

  • entities are not automatically saved after this command (you can use -SAVE_CLOUDS or -SAVE_MESHES explicitly)
  • available since version 2.13 only
-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:

  • COMPRESSED_BINARY
  • BINARY
  • ASCII

Notes:

  • since version 2.14 only
  • when using the binary and ASCII formats, the output filename may be scrambled if non standard characters are present.
  • this option must be placed before any PCD file is saved
-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:

  • ALL_AT_ONCE: saves all clouds in a single file (the current output format must support it!)
  • FILE "file1.xxx file2.yyy ..." : to specify the output filename(s) of the clouds (use quotes if multiple names or names with space characters) [since version 2.10]
-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:

  • ALL_AT_ONCE: saves all meshes in a single file (the current output format must support it!)
  • FILE "file1.xxx file2.yyy ..." : to specify the output filename(s) of the clouds (use quotes if multiple names or names with space characters) [since version 2.10]
-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]
  • Note: this is deprecated (or at least useless) with version 2.13 as the new LAS I/O plugin now natively handles FWF data on all platforms.
-FWF_SAVE_CLOUDS {filename} saves all clouds in memory a LAS 1.3/1.4 files (waveform support) [Windows version only]
  • Note: this is deprecated (or at least useless) with version 2.13 as the new LAS I/O plugin now natively handles FWF data on all platforms.

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)