约束 3D 曲面的 RBF 插值以保持曲率 [英] Constraining RBF interpolation of 3D surface to keep curvature

查看:51
本文介绍了约束 3D 曲面的 RBF 插值以保持曲率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是开发一种算法,在给定一组表示现有表面测量值的稀疏点的情况下,该算法将允许我们计算表面上任何点的 z 坐标.面临的挑战是找到一种合适的插值方法,该方法可以重新创建 3D 表面,仅给定几个点,并在包含初始测量值的范围之外外推值(许多插值方法的臭名昭著的问题).

I've been tasked to develop an algorithm that, given a set of sparse points representing measurements of an existing surface, would allow us to compute the z coordinate of any point on the surface. The challenge is to find a suitable interpolation method that can recreate the 3D surface given only a few points and extrapolate values also outside of the range containing the initial measurements (a notorious problem for many interpolation methods).

在尝试将许多分析曲线拟合到点后,我决定使用 RBF 插值,因为我认为这会更好地再现表面,因为点都应该位于表面上(我假设测量的误差可以忽略不计).

After trying to fit many analytic curves to the points I've decided to use RBF interpolation as I thought this will better reproduce the surface given that the points should all lie on it (I'm assuming the measurements have a negligible error).

考虑到我使用的几个点,第一个结果令人印象深刻.

The first results are quite impressive considering the few points that I'm using.

插值结果

在我展示的图片中,蓝点是用于 RBF 插值的那些,它产生以灰度表示的形状.红点是我试图用我的插值算法重现的相同形状的额外测量值.

In the picture that I'm showing the blue points are the ones used for the RBF interpolation which produces the shape represented in gray scale. The red points are instead additional measurements of the same shape that I'm trying to reproduce with my interpolation algorithm.

不幸的是,存在一些异常值,尤其是当我试图外推初始测量区域之外的点时(您可以在图片的右上角和下中心插图中看到这一点).这是意料之中的,尤其是在 RBF 方法中,因为我试图从最初没有任何信息的区域中提取信息.

Unfortunately there are some outliers, especially when I'm trying to extrapolate points outside of the area where the initial measurements were taken (you can see this in the upper right and lower center insets in the picture). This is to be expected, especially in RBF methods, as I'm trying to extract information from an area that initially does not have any.

显然,RBF 插值试图使表面变平,而我只需要继续形状的曲率.当然,鉴于它是如何定义的,该方法对此一无所知.但是,这会导致与我尝试拟合的测量值存在很大差异.

Apparently the RBF interpolation is trying to flatten out the surface while I would just need to continue with the curvature of the shape. Of course the method does not know anything about that given how it is defined. However this causes a large discrepancy from the measurements that I'm trying to fit.

这就是为什么我要问是否有任何方法可以约束插值方法以保持曲率或使用不同的径向基函数,该函数不会仅在插值范围的边界上如此快速地平滑.我尝试了 epsilon 参数和距离函数的不同组合,但没有运气.这就是我现在正在使用的:

That's why I'm asking if there is any way to constrain the interpolation method to keep the curvature or use a different radial basis function that doesn't smooth out so quickly only on the border of the interpolation range. I've tried different combination of the epsilon parameters and distance functions without luck. This is what I'm using right now:

from scipy import interpolate
import numpy as np

spline = interpolate.Rbf(df.X.values, df.Y.values, df.Z.values,
                            function='thin_plate')
X,Y = np.meshgrid(np.linspace(xmin.round(), xmax.round(), precision),
                      np.linspace(ymin.round(), ymax.round(), precision))
Z = spline(X, Y)

我还考虑在插值范围之外创建一些额外的虚拟点以进一步限制模型,但这会非常复杂.

I was also thinking of creating some additional dummy points outside of the interpolation range to constrain the model even more, but that would be quite complicated.

我还附上了一个动画,以便更好地了解表面.

I'm also attaching an animation to give a better idea of the surface.

动画

推荐答案

只是想发布我的解决方案,以防有人遇到同样的问题.问题确实在于 RBF 插值的 scipy 实现.我尝试采用更灵活的库,https://rbf.readthedocs.io/en/latest/index.html#.结果很酷!使用以下选项

Just wanted to post my solution in case someone has the same problem. The issue was indeed with scipy implementation of the RBF interpolation. I tried instead to adopt a more flexible library, https://rbf.readthedocs.io/en/latest/index.html#. The results are pretty cool! Using the following options

from rbf.interpolate import RBFInterpolant
spline = RBFInterpolant(X_obs, U_obs, phi='phs5', order=1, sigma=0.0, eps=1.)

即使在边缘,我也能获得正确的形状.

I was able to get the right shape even at the edge.

表面插值

我玩过不同的 phi 函数,这里是插值表面和我测试插值的点(图片中的红点)之间的传播的箱线图).

I've played around with the different phi functions and here is the boxplot of the spread between the interpolated surface and the points that I'm testing the interpolation against (the red points in the picture).

箱线图

使用 phs5 我得到了最好的结果,上表面的平均散布约为 0.5 毫米,下表面的平均散布约为 0.8 毫米.在我得到类似的平均值但有许多异常值 > 15 毫米之前.绝对成功:)

With phs5 I get the best result with an average spread of about 0.5 mm on the upper surface and 0.8 on the lower surface. Before I was getting a similar average but with many outliers > 15 mm. Definitely a success :)

这篇关于约束 3D 曲面的 RBF 插值以保持曲率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆