Question

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

Was it helpful?

Solution

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).

OTHER TIPS

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.

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top