Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smallest Bounding Sphere containing x% of points

Given a 3D point cloud, how can I find the smallest bounding sphere that contains a given percentage of points?

I.e. if I have a point cloud with some noise, and I want to ignore 5% of outliers, how can I get the smallest sphere that contains the 95% remaining points, if I do not know which points are the outliers?

Example: I want to find the green sphere, not the red sphere:

enter image description here

I am looking for a reasonably fast and simple algorithm. It does not have to find the optimal solution, a reasonable approximation is fine as well.

I know how to calculate the approximate bounding sphere for 100% of points, e.g. with Ritter's algorithm.

How can I generalize this to an algorithm that finds the smallest sphere containing x% of points?

like image 508
HugoRune Avatar asked Sep 26 '16 14:09

HugoRune


Video Answer


1 Answers

Just an idea: binary search.

First, use one of the bounding sphere algorithms to find the 100% bounding sphere first.

Fix the centerpoint of the 95% sphere to be the same as the centerpoint of the 100% sphere. (There is no guarantee it is, but you say you're ok with approximate answer.) Then use binary search on the radius of the sphere until you get 95% +- epsilon points inside.

Assuming the points are sorted by their distance (or squared distance, to be slightly faster) from the centerpoint, for a fixed radius r it takes O(log n) operations to find the number of points inside the sphere with radius r, e.g. by using another binary search. The binary search for the right r itself requires logarithmic number of such evaluation. Therefore The whole search should take just O(log2n) steps after you have found the 100% sphere.

Edit: if you think the center of the reduced sphere could be too far away from the full sphere, you can recalculate the bounding sphere, or just the center of the mass of the point set, each time after throwing away some points. Each recaculation should take no more than O(n). After recalculation, resort the points by their distance from the new centerpoint. Since you expect them to be already nearly sorted, you can rely on bubble sort, which for nearly-sorte data works in O(n + epsilon). Remember that there will be just a logarithmic number of these tests needed, so you should be able to get away with close to O(n log2 n) for the whole thing.

It depends on what exactly performance you're looking for and what you're willing to sacrifice for that. (I would be happy to learn that I'm wrong and there's a good exact algortihm for this.)

like image 149
kfx Avatar answered Sep 22 '22 09:09

kfx