I am looking for a Python image processing package that will allow me to take a source image, and to create a new image by specifying a pixel location to take each pixel in the source image to, on a pixel-by-pixel basis (i.e. more general than an affine transformation). Specifically, if the original image is a 2-d array A, and we have an array of x-coordinates (indices of A) X and an array of y-coordinates (indices of A) Y, then an each element of Z, Z(i,j) goes to a pixel in the new image A' at (X(i,j),Y(i,j)).
Basically I am trying to do (x,y)->(f(x,y), g(x,y)), but quickly.
Currently I am doing this "by hand" in numpy as a nested loop iterating over pixels in the source image, and I feel certain there is something in a package out there that will do this much more quickly, though I've not found it. Something like cartopy clearly has something of this sort going on to do image transformations.