-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Implement Farthest Point Sampling for Point Clouds #3715
Comments
I'd be happy to take this on @kunaltyagi |
@kunaltyagi Where should such a feature be implemented? As a method in an existing class? If so which class would be appropriate? I was thinking perhaps it would fit in inside common/io? |
As a class. Have a look at the classes in inside
Definitely in filters. But please present the arguments behind your reasoning. |
I was thinking of common just because of the simplicity of this method, since some of the simpler and basic features like computing the centroid were implemented there, and personally I've always done downsampling right after loading the cloud. But you're right filters makes much more sense. So I would be following the standard format used by filter classes yeah? As far as I can see the number of points is the only required parameter, since this is a very simple method. Please let me know if I'm overlooking soomething. |
On one hand, downsampling sounds simple enough. Set the input cloud, set the desired number of points, go! This can be a standalone function. On the other hand, to make it useful in a wide range of scenarios, we need a more complex interface. What if the user wants random but reproducible downsampling? Then we need a way to specify the seed for random number generator. What if the user wants to get the indices of kept points, not the points themselves? Then we need a way to provide access to sampled indices. And so on. Naturally, we cannot foresee all possibilities, so PCL tries to strike a balance between simplicity and generality.
Not only because it's logically a filter, but also because there is a certain filter API that (experienced) PCL users expect. I had a look into the |
Yes, so there is :) I just had a look.
No worries, Appreciate all the work you guys put into maintaining PCL. Out of personal curiosity, is there a theoretical/practical max number of points that PCL supports? The reason I'm asking is because the filter you mentioned is restricted by RAND_MAX, which is generally 2147483647. So this function won't be "random" for any cloud with over 2 billion points right? Personally I haven't had to deal with anything bigger than a few hundred million, but I figure some people might. |
We currently have some nasty limitations with index support due to the chosen type ( https://github.com/PointCloudLibrary/pcl/wiki/PCL-RFC-0002:-Better-type-for-indices |
BTW: One thing that we definitely need is Farthest Point Sampling. |
that's pretty interesting, I've never had the need to use it myself. If I understand it correctly, the idea is to select points in such a way that creates a sort of 3D voronoi diagram like representation, with the input parameter being the number of points to sample? I'd like to give it a try, one question I have is whether some sort of optimization would be required? As I understand it, a naive algorithm would be O(n^2). |
Exactly, but I believe we need to implement 2 versions of the method. A naive one, which overlooks the implicit surface embedding a point cloud might have and uses euclidean distance between points and a second one which takes that surface into account and considers geodesic distance.
Don't worry about it too much at this point. I rather have you present a naive proposal early on in a draft PR, we first focus on the interface part and unit tests, and then we can discuss and evaluate possible accelerations. NB: the original intent of this issue was completely hijacked and we should probably either rename it or start a new one. |
yes, that certainly makes sense. I'll do some research and see how the implementation should go. thanks for the advice. |
I only implemented euclidean distance based sampling in this draft, It's my first PR here, so I'm sure I've overlooked some obvious stuff. Appreciate it if you could take a look. |
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs. |
EDIT: #3715 (comment)
Random Sample exists
Ignore below
Yes, my apologies, a silly mistake on my part, that method wouldn't work, and random downsampling would indeed be the best way to proceed. @taketwo Just as a side note, I do think it would be useful to have a function implemented for random downsampling, since it's a pretty common use case. I personally have defaulted to using cloudCompare when i want to downsample something on the fly. @zubair1502 glad you managed to fix it.
Originally posted by @haritha-j in #3620 (comment)
The text was updated successfully, but these errors were encountered: