双线性插值在四边形上

发布于 01-24 05:10 字数 95 浏览 3 评论 0原文

我正在从四边形的顶点到四边形内的任何随机点进行插值数据。我通过首先进行坐标转换来实现此功能,该转换将四边形重塑到单位正方形,然后使用双线性插值。 Python库是否已经实施了?

I am interpolating data from the vertices of a quadrilateral to any random point inside the quadrilateral. I implement this by first doing a coordinate transformation which reshapes the quadrilateral to a unit square and then using bilinear interpolation.
Does any of the python libraries already have an implementation to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

装迷糊2025-01-31 05:10:01

四边形角落之间的双线性插值使坐标

P = (P00 (1-u) + P10 u) (1-v) + (P01 (1-u) + P11 u) v
  = P00 + (P10-P00) u + (P01-P00) v + (P11-P10-P01+P00) uv.

使该系统形成一个未知的二次方程的系统uv。如果p在四边形内,则u,vε[0,1]

如果我们将点和跨产品与p11-p10-p01+p0一起使用,则该系统采用的表格

A + B u + C v + D uv = 0
a + b u + c v = 0

我们从中消除了v,而v

c (A + B u) - (C + D u) (a + b u) = -b D u² + (B c - b C - a D) u + (A c - a C) = 0

是二次统一的。计算根部并将其保存在域中。从u您获得v

Bilinear interpolation between the corners of a quadrilateral gives the coordinates

P = (P00 (1-u) + P10 u) (1-v) + (P01 (1-u) + P11 u) v
  = P00 + (P10-P00) u + (P01-P00) v + (P11-P10-P01+P00) uv.

This forms a system of two quadratic equations in the unknowns u, v. If P is inside the quadrilateral, u, v ε [0, 1].

If we take the dot and cross products with P11-P10-P01+P0, the system takes the form

A + B u + C v + D uv = 0
a + b u + c v = 0

from which we eliminate v by

c (A + B u) - (C + D u) (a + b u) = -b D u² + (B c - b C - a D) u + (A c - a C) = 0

which is quadratic univariate. Compute the roots and keep the one in the domain. From u you get v.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文