CloudCompare / CloudComPy

Python wrapper for CloudCompare
Other
265 stars 38 forks source link

Inquiry Regarding Retrieving Classification Results from LabelConnectedComponents #156

Closed Pepe-oss closed 4 months ago

Pepe-oss commented 4 months ago

Hi, I have been experimenting with the LabelConnectedComponents function in the cloudComPy package, and I successfully ran the function, obtaining an integer value as the return result. However, I couldn't find any documentation on how to view the classification results. Can anyone help me? Thank you very much. My code as follow:

import cloudComPy as cc
cc.initCC()  

cloud = cc.loadPointCloud("example\A2.ply")                               # read a point cloud from a file
print("cloud name: %s"%cloud.getName())
type = cc.LabelConnectedComponents(clouds=[cloud], octreeLevel=10)

print('succeed!')

My goal is to try to achieve the differentiation I realized in cloudcompare as follows: image

prascle commented 4 months ago

Hello, There are two functions available in CloudComPy that deal with connected components: LabelConnectedComponents and ExtractConnectedComponents.

The former creates a scalar field in each cloud examined, assigning an integer value to each node. Nodes sharing the same value are connected and form a component. The function returns the number of components.

The second function divides the examined clouds into smaller clouds corresponding to the connected components. An example can be found in the documentation here. With the smaller clouds separated, it's easier to calculate the properties of each component (bounding box, center of gravity...).

Let me know if you need any further explanation. I will improve the documentation on this point.

Regards, Paul

Pepe-oss commented 4 months ago

Hello, There are two functions available in CloudComPy that deal with connected components: LabelConnectedComponents and ExtractConnectedComponents.

The former creates a scalar field in each cloud examined, assigning an integer value to each node. Nodes sharing the same value are connected and form a component. The function returns the number of components.

The second function divides the examined clouds into smaller clouds corresponding to the connected components. An example can be found in the documentation here. With the smaller clouds separated, it's easier to calculate the properties of each component (bounding box, center of gravity...).

Let me know if you need any further explanation. I will improve the documentation on this point.

Regards, Paul

Thank you for your help, I have understood the difference, thanks!