CloudCompare / CloudComPy

Python wrapper for CloudCompare
Other
292 stars 41 forks source link

Issue instantiating classes #42

Closed tsugg closed 2 years ago

tsugg commented 2 years ago

I'm trying to use the cloudComPy.GeometricalAnalysisTools and the cloudComPy.CloudSamplingTools classes. I'm working in Jupyter and getting an error saying 'This class cannot be instantiated from Python'.

Could someone comment a short demo on how to get this working in Jupyter?

Thanks,

Tommy

prascle commented 2 years ago

Hello, The documentation is not very explicit on this point: all the methods of these classes are static, these two classes are not instantiable and do not need to be. An example of use is provided in the example test019.py Don't hesitate to let me know if this doesn't answer your question. Paul

tsugg commented 2 years ago

Yes, this is perfect. Thanks!

tsugg commented 2 years ago

Hey Paul, want to reopen the issue real quick because I have a question about the noiseFilter parameters. I perform the noise filter in the actual cloud compare application on a cloud with 90 million points using the parameters in the image below. The resulting cloud has 19 million points and performs exactly what I want.

I believe I'm replicating the parameters correctly in CloudComPy, but the resulting cloud is only 6 thousand points.


refCloud = cc.CloudSamplingTools.noiseFilter(cloud, kernelRadius = .02180, nSigma = 1.0, removeIsolatedPoints = True)

if refCloud.class != cc.ReferenceCloud: raise RuntimeError origCloud = refCloud.getAssociatedCloud() (noiseCloud, res) = origCloud.partialClone(refCloud) if res != 0: raise RuntimeError noiseCloud.setName("noiseCloud")

noiseCloud.size()

image

tsugg commented 2 years ago

when I remove the isolated points flags, I get 50 million in the app and 34 million in CloudComPy.

Just hoping to get a better understanding of differences in processes in each.

Thanks!

prascle commented 2 years ago

Hi, I had a quick look at the C++ code of CloudCompare : in the GUI, the useAbsoluteError parameter is forced to false by default, contrary to what I put in Python. I reproduced in Python the default values of the parameters in the declaration of the function in C++, but in the GUI these default values are modified in the initialization of the dialog. In particular, the default GUI configuration leads to useAbsoluteError = False, absoluteError = 1.0

Can you try to set useAbsoluteError = False to see if this solves the problem? Paul

tsugg commented 2 years ago

perfect! thanks!