Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got 'Nan' when computing normals. #3

Open
SkyeFromKindergarten opened this issue Oct 21, 2020 · 6 comments
Open

Got 'Nan' when computing normals. #3

SkyeFromKindergarten opened this issue Oct 21, 2020 · 6 comments

Comments

@SkyeFromKindergarten
Copy link

SkyeFromKindergarten commented Oct 21, 2020

when I run
pc_normals = compute_features(pc.astype(np.float64), search_radius=0.1, feature_names=["nx","ny","nz"])

I got many ‘nan’
How can this happen?

pc_normals = compute_features(pc.astype(np.float64), search_radius=0.1, feature_names=["nx","ny","nz"])
(Pdb) print np.isnan(pc).sum()
0
(Pdb) n
/home/gy/PVCNet1014/Utils.py(95)Compute_Normals()
-> pc_normals = np.expand_dims(pc_normals, axis = 0)
(Pdb) print np.isnan(pc_normals).sum()
318

there are 318 nans

@SkyeFromKindergarten
Copy link
Author

And there's no nan in input pc

@Tofull
Copy link
Member

Tofull commented Oct 21, 2020

Could you please share with us the problematic pointcloud?

This can happen if some points are alone in your search_radius of 0.1. In this case, the query_ball_point function will return a single point and no eigenvalue is extracted. Since the normals come with the eigenvectors, the process returns NaN for these points.
The default value when features cannot be calculated is NaN.

@SkyeFromKindergarten
Copy link
Author

the input pointcloud is actually an output of a neural network, that's maybe why some points are single in the radius of 0.1

So maybe I should set the radius larger?

@Tofull
Copy link
Member

Tofull commented Oct 22, 2020

Let's try with a larger radius and give us your feedback. I am curious about your work.

@davidcaron
Copy link
Collaborator

davidcaron commented Oct 22, 2020

When I added the neighbor search, I had point clouds that represent geometric objects in mind... so a search radius made more sense to me than a k neighbors search (so say a flat surface means no sharp angle within 0.1 meters). While a k neighbors search could yield unbalanced properties depending on the variation of the point density.

Maybe in your case it would make more sense to use a k neighbors search instead. It's not implemented, but it could be added.

@SkyeFromKindergarten
Copy link
Author

SkyeFromKindergarten commented Oct 26, 2020

I set a lager radius of 0.3 and I got less 'nan's

I find one points cloud output that makes 'nan' when computing normals, but I don't know how to upload files in github. The problematic point seems to be far away from others, so I think @davidcaron 's thought is a good way to solve this problem.

The k neighbors search is not available now, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants