1

Given a set of 3d Points(it contains the cartesian coordinate of each points as a list) with known number of sphere, How to detect and construct the sphere from this set?

I would like to find the basic information of the sphere, for example the location of center, radius and degree of fitting of the points to the constructed sphere.

Any there any function that I am applied from Opencv?

Or what kind of algorithm should I use?

Carl
  • 105
  • 3
  • 12
  • 2
    if you really do know the number of spheres I would try (and implement) a simple ransac based method. – Micka Jan 20 '16 at 17:21
  • " with known number of sphere": what does this mean ? –  Jan 21 '16 at 10:32
  • @Micka: if there are several spheres, how do you adapt RANSAC ? Taking quadruples of points, you don't know if they belong to the same sphere and most attempts will be unfruitful. –  Jan 21 '16 at 10:37
  • How noisy are the points ? Are there outliers ? How many points, how many spheres ? –  Jan 21 '16 at 10:40
  • @YvesDaoust just repeat until you find one or the "best sphere" and resume on the rest of the data. Since the number of spheres is known, it might be ok. Sure, if there are many spheres compared to the number of points of each sphere, ransac might need too many iterations. But without additional knowledge and the possibility of pre-selection this would be the best approach that comes in my mind. If there is known more about the data I might give different suggestions :) – Micka Jan 21 '16 at 10:44
  • Not sure how it works in detail, but http://stackoverflow.com/questions/33629842/grouping-points-that-represent-lines used Sequential-RANSAC to detect multiple lines. Maybe this "sequential-" part can be used to level RANSAC sphere detection to RANSAC multiple-sphere detection, too. But as I said, I didn't read if yet, so I might be wrong. – Micka Jan 21 '16 at 10:53
  • @Micka: if there are, say 10 spheres, the probability of picking 4 points from the same sphere will be like 1/1000, which means that you need to try 1000 times more than for a single sphere. (In the case of lines, you would only need to try 10 times more.) –  Jan 21 '16 at 11:30
  • @YvesDaoust is there any better general applicable soluton in your mind? – Micka Jan 21 '16 at 11:39
  • @Micka: I won't answer until the OP has clarified the question –  Jan 21 '16 at 11:46
  • @YvesDaoust suppose we know there are N number of spheres – Carl Jan 21 '16 at 16:10
  • @Micka Actually, I have no idea how noise those points are, But I know roughtly the range of radius of the sphere. I checked my list of points, there are actually a two-ball bar used in camera calibration. – Carl Jan 21 '16 at 16:18
  • @Carl can you provide sample data? – Micka Jan 21 '16 at 16:19
  • I do find a web which I think can solve the problem. But I have not totally comprehened.[link](http://www.mathworks.com/matlabcentral/fileexchange/48219-spherical-hough-transform-for-3d-images) – Carl Jan 21 '16 at 16:19
  • Do you mean that N=2 ??? Are there outliers ? How many points ? Please provide complete answers. –  Jan 21 '16 at 16:20
  • Yea, there are two spheres. Yes, there are outlier. There are other features so I think they can be consider as outlier. The total number of points is about 2 millions. – Carl Jan 21 '16 at 16:49
  • For two spheres, RANSAC remains acceptable. Alternatively, if the fraction of outliers is small and the two balls have the same radius, the KL Tansform (PCA) can give you a direct solution (the main component gives you the direction of the bar, and you can derive the radius and spacing of the balls from the ellipsoid size). –  Jan 21 '16 at 17:08

0 Answers0