0

你们中有人知道 Python 中用于二维轮廓的高阶插值方法(Catmull-Rom 样条、三次插值等)吗?

Skimage、Matplotlib 和 OpenCV 分别提供函数 measure.find_contours()、contours() 和 findContours(),但都是基于线性插值(也称为行进正方形),我正在研究 Python 中精度更高的东西,最好。任何指针将不胜感激。

https://www.dropbox.com/s/orgr2yqhbbk2xnr/test.PNG

在上图中,我试图从 f(x,y)=x^3+y^3 的标量场中提取等值 25。我正在寻找比线性插值给出的 6 个红点精度更高的 6 个点。

4

1 回答 1

0

对于非结构化二维数据(或三角数据),您可能对以下类感兴趣:

http://matplotlib.org/api/tri_api.html?highlight=cubictriinterpolator#matplotlib.tri.CubicTriInterpolator

Triangulation它提供了来自用户定义和在三角剖分节点处定义的字段的 Clough-Tocher(三次)插值器。它也可以通过辅助类使用UniformTriRefiner

http://matplotlib.org/api/tri_api.html?highlight=refine_field#matplotlib.tri.UniformTriRefiner.refine_field http://matplotlib.org/mpl_examples/pylab_examples/tricontour_smooth_user.png

然而,适应插值的选择当然取决于您的数据集。

于 2014-01-19T11:45:36.960 回答