Page 1 of 1

Command line and RANSAC

Posted: Sat Mar 14, 2020 9:35 pm
by kuchar
Hi,
I am testing new option in command line (v2.11) - the one that runs the Ransac Shape Detection plugin.
I would like to save detected shapes cloudes in seperate files (I assumed OUTPUT_INDIVIDUAL_SUBCLOUDS should do it).
That's the command I used:

Code: Select all

CloudCompare -O [path-to-my-PCD-file] -RANSAC EPSILON_ABSOLUTE 0.1 BITMAP_EPSILON_ABSOLUTE 0.155 SUPPORT_POINTS 50 MAX_NORMAL_DEV 25 PROBABILITY 0.01 OUT_CLOUD_DIR [path-to-output-folder] OUTPUT_INDIVIDUAL_SUBCLOUDS ENABLE_PRIMITIVE PLANE
However, as an output I ended with right number of files (in comparison to algorithm from main program), which containing all points from opened cloud, not segments for detected shapes. Moreover, they were saved in current folder instead of pointed one. What's interesting, I succeeded in running a command with OUTPUT_GROUPED, and the file saved in proper folder. Trying the same with OUTPUT_INDIVIDUAL_PRIMITIVES or OUTPUT_INDIVIDUAL_PAIRED_CLOUD_PRIMITIVE ended with writing error (disk full/no access right).

Am I missing something obvious? Will I be able to save detected shapes clouds in particular format (using -AUTO_SAVE OFF -NO_TIMESTAMP -C_EXPORT_FMT [format] before opening the file and -SAVE_CLOUDS at the end)? Or maybe there is other way to separate detected segments from group?

Re: Command line and RANSAC

Posted: Fri Mar 20, 2020 10:48 pm
by WargodHernandez

Code: Select all

CloudCompare -O [path-to-my-PCD-file] -RANSAC EPSILON_ABSOLUTE 0.1 BITMAP_EPSILON_ABSOLUTE 0.155 SUPPORT_POINTS 50 MAX_NORMAL_DEV 25 PROBABILITY 0.01 OUT_CLOUD_DIR [path-to-output-folder] OUTPUT_INDIVIDUAL_SUBCLOUDS ENABLE_PRIMITIVE PLANE
Based on the below comment
which containing all points from opened cloud, not segments for detected shapes
I believe you are actually interested in using the following

Code: Select all

CloudCompare -O [path-to-my-PCD-file] -RANSAC EPSILON_ABSOLUTE 0.1 BITMAP_EPSILON_ABSOLUTE 0.155 SUPPORT_POINTS 50 MAX_NORMAL_DEV 25 PROBABILITY 0.01 OUT_PAIR_DIR [path-to-output-folder] ENABLE_PRIMITIVE PLANE
OUT_PAIR_DIR will output a .bin (by default) per shape with both the support points and the primitive within. Specifying an output directory will cause the output to be set to true without requiring the additional OUTPUT_INDIVIDUAL_PAIRED_CLOUD_PRIMITIVE being required.

"Trying the same with OUTPUT_INDIVIDUAL_PRIMITIVES or OUTPUT_INDIVIDUAL_PAIRED_CLOUD_PRIMITIVE ended with writing error (disk full/no access right)."
I'll add a check for successful path creation to deal with this properly.


Am I missing something obvious? Will I be able to save detected shapes clouds in particular format (using -AUTO_SAVE OFF -NO_TIMESTAMP -C_EXPORT_FMT [format] before opening the file and -SAVE_CLOUDS at the end)? Or maybe there is other way to separate detected segments from group?
I just didn't try out this use case, I made sure it only saved based on -AUTO_SAVE ON otherwise it just adds the clouds and primitives to their respective groups and moves on. Looking at it now I think I need to have it save anytime an output directory is specified or if either the grouped or paired output is specified (those outputs need to maintain the hierarchy but unless saved in the command itself I cant maintain the hierarchy if -AUTO_SAVE OFF is specified because if I don't break the relationship Cloud Compare will fail when it tries to delete each cloud/mesh at the end of command line mode because of the parent/child relationship that the system doesn't expect)

I'll try to have an update made this weekend to correct the issues.
Thanks for the feedback!

Re: Command line and RANSAC

Posted: Mon Mar 23, 2020 10:17 am
by kuchar
Thanks for your reply!

Actually, I was interesting in getting just support points (I called them "segment" which might be misleading) - that's why I used OUT_CLOUD_DIR and OUTPUT_INDIVIDUAL_SUBCLOUDS. But I as an output I didn't get just support points (subclouds) for each primitive, instead I got a few files which contains all points from the input.
Maybe I just don't get how option OUTPUT_INDIVIDUAL_SUBCLOUDS should work - documentation on page: http://www.cloudcompare.org/doc/wiki/in ... _line_mode
tells that it "specify to output detected shapes clouds" so I thought I will get a few files, each of which will contain separate support points for each primitive. Can you correct me if I get it wrong?

The saving option you're writing about seems to have a hierarchy as in main Cloud Compare program, which I expect is not easy to implement. I think the problem might be in determining the right moment to save the output. Maybe it is somehow possible to split parent and child and save just a child - when you run the RANSAC SD in the main Cloud Compare program, you can save just a child (on hierarchy tree the right primitive must be select, and then it can be saved to file - it's even possible to save just points when you select point cloud format). But I belive trying to save it automatically might not be the same.

Re: Command line and RANSAC

Posted: Mon Mar 23, 2020 10:04 pm
by WargodHernandez
So after looking into the problem more, the writing error (disk full/no access right) was caused by filenames that included invalid characters
example for planes : (Dip: %1 deg. - Dip direction: %2 deg.) would become part of the filename which obviously failed.

I simplified the names to be the shape type name and number instead of the primitive name.

the full naming convention is as follows

[OriginalBaseFilename]_[OriginalCloudName]_[ShapeTypeName]_[4 digit item count padded with zeros](_[cloud | pair ]_[date_time])*

* If applicable

so for example
with the following command

Code: Select all

CloudCompare.exe -SILENT -O "C:\Users\myAccount\test\maquette_with_planes.bin" -RANSAC OUT_CLOUD_DIR "C:\Users\myAccount\test\outcloud"
original filename: maquette_with_planes
original cloudname: house
Shape type: Plane
_cloud because of OUT_CLOUD_DIR
results in the following:
C:\Users\myAccount\test\outcloud\maquette_with_planes_house_PLANE_0001_cloud_2020-03-23_14h36_11_927.bin
C:\Users\myAccount\test\outcloud\maquette_with_planes_house_PLANE_0002_cloud_2020-03-23_14h36_12_448.bin
etc...

I just submitted this as pull request https://github.com/CloudCompare/CloudCompare/pull/1071
I'll respond again when the changes are integrated into the main branch.
Are you compiling CC or using another distribution method?

Re: Command line and RANSAC

Posted: Tue Mar 24, 2020 9:51 pm
by kuchar
Yes, that was exactly the part of error messages which occured.

I used installer version, downloaded from main page. Right now it would be possible to install CC just from github, am I right?

Re: Command line and RANSAC

Posted: Wed Mar 25, 2020 5:49 pm
by WargodHernandez
If you want to compile from source, than yes GitHub would take care of the issue. I have one more pull request in the works to fix another issue that this post brought to my attention (dealing with being able to specify the output format for clouds, mesh, and groups or hierarchies individually), without this PR if you set the mesh output type to something other than .Bin you would probably run into issues.
I am just waiting on one more persons input before merging https://github.com/CloudCompare/CloudCompare/pull/1076

Otherwise I would expect there to be a new version posted to the main page fairly soon, Daniel is really good at keeping that version current.

Re: Command line and RANSAC

Posted: Fri Mar 27, 2020 12:01 pm
by kuchar
Ok, thanks for taking care of a problem!

Re: Command line and RANSAC

Posted: Fri Mar 27, 2020 1:12 pm
by daniel
For information, I just updated the online 2.11.beta version yesterday night.