Page 1 of 1

Saving the vertices of the best fit plane as text file

Posted: Fri May 17, 2024 10:56 am
by Ingsayyad
I need to get the best fitting plane at a number of positions in a clouds.

All I need is to
- crop the cloud at these positions and get the position of center of planes.

I started the task for a cloud

"C:\Program Files\CloudCompare\CloudCompare" ^
-AUTO_SAVE OFF ^
-o "E:\CloudComparetest\TestCloud1.e57" ^
-CROP 1147:1077.00:50:1150:1078:51 ^
-NO_TIMESTAMP ^
-BEST_FIT_PLANE -KEEP_LOADED ^
-EXTRACT_VERTICES ^
-SAVE_MESHES ^
-SAVE_CLOUDS ^

Info file what I get, does not contain vertices of plane.

Filename: TestCloud1_CROPPED_BEST_FIT_PLANE.bin
Fitting RMS: 0.00363043
Normal: (0.000580593536,0.004284270573,0.999990642071)
Dip: 000 deg. - Dip direction: 008 deg.
Orientation matrix:
0.999999821186 -0.000001243716 -0.000580593536 0.030883789063
-0.000001243716 0.999990820885 -0.004284270573 0.227905273438
0.000580593536 0.004284270573 0.999990642071 -5.282684326172
0.000000000000 0.000000000000 0.000000000000 1.000000000000


I do not know how to export vertices of the plane as TXT file. I get it as bin. All is I need is the center of the plane (x,y,z).

sample "vertices.txt" I can do it in cloudcompare but not in commandline.

1146.999 1077.000 50.541
1147.000 1078.004 50.536
1150.001 1078.000 50.535
1150.000 1076.996 50.539

Re: Saving the vertices of the best fit plane as text file

Posted: Mon May 20, 2024 11:21 am
by daniel
To export to ascii, you have to use -C_EXPORT_FMT ASC (or TXT should work). This must be placed before -SAVE_CLOUDS.

And before calling -EXTRACT_VERTICES, I would remove the cloud with -POP_CLOUDS (so that only the plane remains, because it's a mesh).

Re: Saving the vertices of the best fit plane as text file

Posted: Mon May 20, 2024 1:23 pm
by Ingsayyad
Than you. It works. I have two questions extention of the code.
As I mentioned, I need to run this task (segment small cloud from whole and fit plane) min. 400 times for the 9GB point cloud. How can I run it effectively in a loop. Loading CC and the point cloud each time does not seem to be very helpful. Any ideas?

Currently I get C2M_Dist cloud with deviation as scalar field in bin format. Is there any way to export it in e57 as well? (command line)

Re: Saving the vertices of the best fit plane as text file

Posted: Mon May 20, 2024 8:57 pm
by daniel
Hum, not sure how to manage this with the command line. Maybe Python would be a better option (with CloudCompy).

And sadly, the only scalar field that can be saved with the E57 format is 'intensity'. So the only option would be to rename the distances SF 'Intensity', and I'm not sure what would happen with the fact that distances are floating point values, while intensities are supposed to be integer values!