将椭球拟合到3D数据点 [英] Fitting an ellipsoid to 3D data points
问题描述
我有一大堆3D数据点,我想将它们适配到椭球上.
I have a large set of 3D data points to which I want to fit to an ellipsoid.
我的数学很差,所以我在没有任何数学库的情况下无法实现最小二乘法.
My maths is pretty poor, so I'm having trouble implementing the least squares method without any math libraries.
有人知道或有一段代码可以将椭圆形适合我可以直接插入到我的项目中的数据吗?用C最好,但是从C ++,Java,C#,python等转换为我应该没问题.
Does anyone know of or have a piece of code that can fit an ellipsoid to data which I can plug straight into my project? In C would be best, but it should be no problem for me to convert from C++, Java, C#, python etc.
能够找到中心也将是巨大的帮助.请注意,这些点之间的分布不均匀,因此取平均值不会导致居中.
Just being able to find the centre would be a huge help too. Note that the points aren't evenly spaced so taking the mean won't result in the centre.
推荐答案
最小二乘数据拟合给出您所描述数据的性质的一种很好的方法论可能是. GNU科学图书馆包含非线性最小二乘数据拟合例程.在您的情况下,您可以将数据转换为线性空间并使用线性最小二乘,但这取决于您的实际用例.否则,您将需要使用非线性方法.
Least Squares data fitting is probably a good methodology give the nature of the data you describe. The GNU Scientific Library contains linear and non-linear least squares data fitting routines. In your case, you may be able to transform your data into a linear space and use linear least-squares, but that would depend on your actual use case. Otherwise, you'll need to use non-linear methods.
这篇关于将椭球拟合到3D数据点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!