Page 1 of 1

Obtaining the eigenvalues of the point cloud

Posted: Fri Oct 01, 2021 10:55 am
by juacarri
Hi! I'm trying to calculate some of the variables of the "Compute geometric features" tool using python, but I'm getting slightly different values for the eigenvalues compared with CC with a distance neighbourhood of 10cm. I attached the very simple point cloud I'm testing.

This is being my procedure:

Code: Select all

import numpy as np
A = np.array([[728049.836,  4395284.986,  201.337],
[728049.849,  4395284.988  ,201.338],
[728049.852 , 4395284.982 , 201.337],
[728049.840  ,4395284.977,  201.335]])

covariance_matrix=np.cov(A.T)
[[5.62499999e-05 5.58333418e-06 4.41666670e-06]
[5.58333418e-06 2.35833325e-05 5.74999993e-06]
[4.41666670e-06 5.74999993e-06 1.58333333e-06]]

Code: Select all

eigenvalues = np.linalg.eig(covariance_matrix)
[5.76848763e-05 2.37209627e-05 1.08268506e-08]

Using CloudCompare I'm finding the following values:

[0.000043 0.000018 0.000000]

Someone has any idea where is my error?

Re: Obtaining the eigenvalues of the point cloud

Posted: Tue Oct 05, 2021 6:28 pm
by daniel
Maybe it's due to the large coordinates? Are you applying the Global Shift when you load the cloud in CloudCompare?

And is numpy properly handling these big numbers? (I would say yes by default, but who knows?)

Re: Obtaining the eigenvalues of the point cloud

Posted: Wed Oct 06, 2021 6:33 am
by juacarri
Hi Daniel! Yes, I applied the global shift in CC. I tried again the same code but using the shifted coordinates and the result is the same. Could be possible to obtain an intermediate result from CC as the covariance matrix?

Re: Obtaining the eigenvalues of the point cloud

Posted: Sun Oct 10, 2021 12:01 pm
by daniel
You would have to hack the code to do that (and log the information you are looking for around here: https://github.com/CloudCompare/CCCoreL ... d.cpp#L222)