I have a set of points [x,y]=meshgrid(1:N,1:M)
defined on a regular 2D, N x M
grid. I have another set of points [u,v]
that are some defor
It seems that you can use tformfwd
and tforminv
with a small twist to get f
.
tformfwd
transforms points from input space to output space. For example, to apply an affine transform to the point (u,v) = (5,3), you can do this:
uv = [5 3];
xy = tformfwd(tform, uv)
This will out put the (x,y) coordinates given tform
Similarly, tforminv
transforms points from output space to input space. If we apply the inverse transformation to the point xy computed above, we should get back the original point.
uvp = tforminv(tform, xy)
uvp =
5 3
So, you can use this machinery to map points by the forward and inverse geometric transformation.
If you are using R2013a and later, you can use the transformPointsForward
and transformPointsInverse
methods of the geometric transformation classes (e.g. affine2d, projective2d), and also consider imwarp.