Obtaining the eigenvalues of the point cloud

Feel free to ask any question here
Post Reply
juacarri
Posts: 16
Joined: Tue Oct 08, 2019 7:55 am

Obtaining the eigenvalues of the point cloud

Post 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?
Attachments
Test.zip
(326 Bytes) Downloaded 350 times
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Obtaining the eigenvalues of the point cloud

Post 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?)
Daniel, CloudCompare admin
juacarri
Posts: 16
Joined: Tue Oct 08, 2019 7:55 am

Re: Obtaining the eigenvalues of the point cloud

Post 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?
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Obtaining the eigenvalues of the point cloud

Post 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)
Daniel, CloudCompare admin
Post Reply