Page 1 of 1

Extract Connected Components in command line

Posted: Wed Mar 06, 2024 11:38 am
by m_clouds
Hello everyone,

I am currently trying to segment some clouds using the command line to be able to process multiple files in a row.

I have a file containing multiple clouds, each represents the same object at a different time with slight changes due to the time difference.
I tied to use the command Extract_CC to extract the connected components with the autosave feature as follows :

Code: Select all

CloudCompare  -O [path_to_file] -EXTRACT_CC 8 10000
This will save the extracted components with following syntax : [filename]_COMPONENT_[number].bin
The problem I encounter is the following : since the file ([filename]) contains multiple clouds, as soon as the extraction passes to another cloud, the saved components are overwritten, because the syntax for saving them only takes into account the [filename] but not the respective cloud name.

I have tried using the manual saving feature, but since more than 300 clouds will be created, I have not managed to give a list of all the filenames (with its respective path) for every extracted cloud. I suppose this could be due to the command line exceeding a certain limit of characters used?
I have tried this by creating multiple variables (to not exceed the limit of characters per variable) which, one after the other respect the syntax of "Path/file1.bin Path/file2.bin Path/file3.bin ..." with this command:

Code: Select all

CloudCompare -AUTO_SAVE OFF -O [path_to_file] -EXTRACT_CC 8 10000 -SAVE_CLOUDS FILE !File_List_part1!!File_List_part2!!File_List_part3!!File_List_part4!
Has anyone ever encountered a problem like this and / or has an Idea of how i could extract all the connected components (in command line) while keeping the information of which cloud it has been extracted from ?

Thanks in advance for any help or information

Re: Extract Connected Components in command line

Posted: Wed Mar 06, 2024 10:02 pm
by daniel
Hum, I guess it would be better/simpler if we fix the issue by appending the cloud name to the output filename for each component?

Re: Extract Connected Components in command line

Posted: Thu Mar 07, 2024 6:53 am
by m_clouds
Definitely, if it's possible to add the individual cloud name to the naming convention for the output file, that would solve my issue yes :)

Re: Extract Connected Components in command line

Posted: Sat Mar 09, 2024 11:10 am
by daniel
Ok, I modified the -EXTRACT_CC option code to append the cloud name and its index in the file (in case multiple clouds have the same name ;).

It will be available in the 2.13.1 version that should be released soon.

Meanwhile, I believe you can simply use the 'ALL_AT_ONCE' option to save all components in one BIN file (that may be better anyway):

Code: Select all

CloudCompare -AUTO_SAVE OFF -O [path_to_file] -EXTRACT_CC 8 10000 -SAVE_CLOUDS ALL_AT_ONCE