The POLYWARP procedure performs polynomial spatial warping.
Using least squares estimation, POLYWARP determines the coefficients Kx ( i,j ) and Ky ( i,j ) of the polynomial functions:
Kx and Ky can be used as inputs P and Q to the built-in function POLY_2D. This coordinate transformation may be then used to map from Xo, Yo coordinates into Xi, Yi coordinates.
This routine is written in the IDL language. Its source code can be found in the file
polywarp.pro
in the
lib
subdirectory of the IDL distribution.
Vectors of X and Y independent coordinates. These vectors must have the same number of elements as Xi and Yi .
The degree of the fit. The number of coordinate pairs must be greater than or equal to ( Degree +1) 2 .
The following example shows how to display an image and warp it using the POLYWARP and POLY_2D routines.
Create and display the original image by entering:
Now set up the Xi's and Yi's. Enter:
Run POLYWARP to obtain a Kx and Ky:
POLYWARP, XI, YI, XO, YO, 1, KX, KY