Performs polynomialwarping of images.
coeffx The x coefficients.
coeffy The y coefficients.
interp (optional) If present and nonzero, specifies that the bilinear interpolation method is to be used in the resampling. Otherwise, the nearest neighbor method is used.
dimx (optional) If present, specifies the number of columns in the resulting array. Otherwise, the output has the same number of columns as array.
dimy (optional) If present, specifies the number of rows in the resulting array. Otherwise, the output has the same number of rows as array.
The functions a(x, y) and b(x, y) are polynomials in x and y of degree n, and specify the spatial transformation:
where n is the degree of the polynomials that are being used to produce the warping, and coeffx and coeffy are arrays containing the polynomial coefficient. Each array must contain (n + 1)2 elements.
For example, for a linear transformation, coeffx and coeffy must contain four elements and may be either a 2-by-2 array or a 4-element vector. Cxi,j contains the coefficient used to determine x ¢, and is the weight of the term xjyi.
The nearest neighbor interpolation method is not linear, because new values that are needed are merely set equal to the nearest existing value of image. For more information on bilinear interpolation, see the BILINEAR function.
Bilinear interpolation can be time-consuming. For example, it requires about twice as much time as does the nearest neighbor method, even if you are working with a linear case (in other words, if n equals 1).
TIP: The POLYWARP function may be used to fit (x ¢, y ¢) as a function of (x, y) and return the coefficient arrays Cx and Cy.
P0,0 | P1,0 | P0,1 | P1,1 | Q0,0 | Q1,0 | Q0,1 | Q1,1 | Effect |
---|---|---|---|---|---|---|---|---|
0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | Identity |
0 | 0 | 0.5 | 0 | 0 | 1 | 0 | 0 | Stretch x by a factor of 2 |
0 | 0 | 1 | 0 | 0 | 2.0 | 0 | 0 | Shrink y by a factor of 2 |
z | 0 | 0 | 0 | 0 | 0 | 0 | 0 | Shift left by z pixels |
0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | Transpose |
For details on interpolation methods. see Efficiency and Accuracy of Interpolation in Chapter 6 of the PV-WAVE User's Guide.