如何将点映射到扭曲的网格上

发布于 2024-08-09 07:04:48 字数 571 浏览 3 评论 0原文

假设您有一个在笛卡尔坐标系上具有坐标的点的集合。

an unwarped grid

您想要绘制另一个点,并且您知道它在同一笛卡尔坐标系中的坐标。

然而,您所绘制的情节与原始情节有所不同。想象一下,将原始平面打印在橡胶板上,并以不对称的方式(没有重叠或任何复杂的方式)在某些地方拉伸它并在其他地方挤压它。

扭曲的网格 (source)

您知道每个点集的拉伸和未拉伸坐标,但不知道底层的拉伸函数。您知道新点的未拉伸坐标。

如何根据附近点的拉伸位置来估计在拉伸坐标中绘制新点的位置?它不需要精确,因为除非您有更多信息,否则您无法从一组重新映射的点确定实际的拉伸函数。

其他可能的关键字: 扭曲 扭曲网格 网格平面坐标 反扭曲

Say you have a collection of points with coordinates on a Cartesian coordinate system.

an unwarped grid

You want to plot another point, and you know its coordinates in the same Cartesian coordinate system.

However, the plot you're drawing on is distorted from the original. Imagine taking the original plane, printing it on a rubber sheet, and stretching it in some places and pinching it in others, in an asymmetrical way (no overlapping or anything complex).

a warped grid (source)

You know the stretched and unstretched coordinates of each of your set of points, but not the underlying stretch function. You know the unstretched coordinates of a new point.

How can you estimate where to plot the new point in the stretched coordinates based on the stretched positions of nearby points? It doesn't need to be exact, since you can't determine the actual stretch function from a set of remapped points unless you have more information.

other possible keywords: warped distorted grid mesh plane coordinate unwarp

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

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

发布评论

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

评论(4

只是一片海 2024-08-16 07:04:48

好吧,这听起来像是图像变形。这是您应该做的:

  1. 创建未扭曲网格的Delaunay 三角剖分并使用您了解扭曲网格和未扭曲网格之间的对应关系,以创建扭曲网格的三角测量。现在您知道每个图像中对应的三角形,并且由于没有重叠,您应该能够毫无困难地执行下一步。

  2. 现在,在扭曲的图像中找到对应的点A

    1. 找到 A 所在的三角形,并利用未扭曲网格和扭曲网格中的三角形之间的变换来找出新位置。

此处详细解释了这一点。

另一种(更复杂)方法是薄板样条(幻灯片中也对此进行了解释)多于)。

Ok, so this sounds like image warping. This is what you should do:

  1. Create a Delaunay triangulation of your unwarped grid and use your knowledge of the correspondences between the warped and unwarped grid to create the triangulation for the warped grid. Now you know the corresponding triangles in each image and since there is no overlapping, you should be able to perform the next step without much difficulty.

  2. Now, to find the corresponding point A, in the warped image:

    1. Find the triangle A lies in and use the transformation between the triangle in the unwarped grid and the warped grid to figure out the new position.

This is explained explicitly in detail here.

Another (much more complicated) method is the Thin Plate Spline (which is also explained in the slides above).

束缚m 2024-08-16 07:04:48

据我了解,包裹和未包裹的网格点之间具有一一对应的关系。我假设变形并没有那么极端,以至于您可能会出现交叉的网格线(如您显示的图像)。

该策略正是 Jacob 建议的:对两个网格进行三角测量,使三角形之间存在一一对应,在三角测量中找到要映射的点,然后使用相应三角形中的重心坐标来计算新的点位置。

预处理

  1. 生成包裹网格点的Delaunay 三角剖分,我们称之为WT
  2. 对于 WT 中的每个三角形,在展开网格中的相应顶点之间添加一个三角形。这给出了展开点的三角测量UWT

将点 p 映射到包裹网格中

  1. UWT< 中查找三角形 T(p1,p2,p3) /code> 包含 p
  2. 计算重心坐标 (b1,b2,b3)T(p1,p2,p3) 中的 p 的 >
  3. Tw(q1,q2,q3)WT 中的三角形对应于T(p1,p2,p3)。新位置为
    b1 * q1 + b2 * q2 + b3 * q3

备注
这给出了作为线性样条的变形函数。为了更平滑的行为,可以使用相同的三角测量,但进行更高阶的近似,这将导致计算更复杂,而不是重心坐标。

I understood that you have one-to-one correspondence between the wrapped and unwrapped grid points. And I assume that the deformation is not so extreme that you might have intersecting grid lines (like the image you show).

The strategy is exactly what Jacob suggests: Triangulate the two grids such that there is a one-to-one correspondence between triangles, locate the point to be mapped in the triangulation and then use barycentric coordinates in the corresponding triangle to compute the new point location.

Preprocess

  1. Generate the Delaunay triangulation of the points of the wrapped grid, let's call it WT.
  2. For every triangle in WT add a triangle between the corresponding vertices in the unwrapped grid. This gives a triangulation UWT of the unwrapped points.

Map a point p into the wrapped grid

  1. Find the triangle T(p1,p2,p3) in the UWT which contains p.
  2. Compute the barycentric coordinates (b1,b2,b3) of p in T(p1,p2,p3)
  3. Let Tw(q1,q2,q3) be the triangle in WT corresponding to T(p1,p2,p3). The new position is
    b1 * q1 + b2 * q2 + b3 * q3.

Remarks
This gives a deformation function as a linear spline. For smoother behavior one could use the same triangulation but do higher order approximation which would lead to a bit more complicated computation instead of the barycentric coordinates.

策马西风 2024-08-16 07:04:48

其他答案都很棒。我唯一要补充的是,您可能想看看 自由形式变形作为描述变形的一种方式。

如果这有用,那么很可能将变形网格/晶格适合您的已知对,然后您就有了一种非常快速的方法来使未来点变形。

The other answers are great. The only thing I'd add is that you might want to take a look at Free form deformation as a way of describing the deformations.

If that's useful, then it's quite possible to fit a deformation grid/lattice to your known pairs, and then you have a very fast method of deforming future points.

绅刃 2024-08-16 07:04:48

很大程度上取决于您拥有多少现有积分。如果只有一个点,那么您实际上无能为力 - 您可以在同一方向上将第二个点偏移相同的量,但您没有足够的数据来真正做得更好。

如果您有相当数量的现有点,则可以通过这些点进行曲面拟合,并使用它来近似新点的正确位置。给定 N 个点,您始终可以使用 N 阶多项式获得完美拟合,但您很少愿意这样做 - 相反,您通常猜测拉伸函数是相当低阶的函数(例如二次函数或三次函数)并拟合在此基础上由面到点。然后,您可以根据拟合曲面的函数放置新点。

A lot depends on how many existing points you have. If you have only one, there's not really much you can do with it -- you can offset the second point by the same amount in the same direction, but you don't have enough data to really do any better than that.

If you have a fair number of existing points, you can do a surface fit through those points, and use that to approximate the proper position of the new point. Given N points, you can always get a perfect fit using an order N polynomial, but you rarely want to do that -- instead, you usually guess that the stretch function is a fairly low-order function (e.g. quadratic or cubic) and fit a surface to the points on that basis. You then place your new point based on the function for your fitted surface.

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