The WARP_TRI function returns an image array with a specified geometric correction applied. Images are warped using control (tie) points such that locations (Xi, Yi) are shifted to (Xo, Yo).

The irregular grid defined by (Xo, Yo) is triangulated using TRIANGULATE. Then the surfaces defined by (Xo, Yo, Xi) and (Xo, Yo, Yi) are interpolated using TRIGRID to get the locations in the input image of each pixel in the output image. Finally, INTERPOLATE is called to obtain the result. Linear interpolation is used by default. Smooth quintic interpolation is used if the QUINTIC keyword is set.

This routine is written in the IDL language. Its source code can be found in the file warp_tri.pro in the lib subdirectory of the IDL distribution.

Examples


This example produces a warped image of the world, where the irregular grid has been created using smooth quintic interpolation.

; Get device parameters and tell IDL to use a color table
DEVICE, GET_DECOMPOSED=old_decomposed
DEVICE, DECOMPOSED=0
; Read data
filename = FILEPATH(SUBDIRECTORY=['examples','data'], $
   'worldelv.dat')
OPENR, lun, filename, /GET_LUN
thermImage = BYTARR(360,360, /NOZERO)
READU, lun, thermImage
FREE_LUN, lun
x1=[1,359,359,1]
y1=[1,1,359,359]
x0=[5,250,480,250]
y0=[250,5,250,480]
warped_image = WARP_TRI(x0, y0, x1, y1, thermImage, $
   OUTPUT_SIZE=[509,509], /QUINTIC)
LOADCT, 3
WINDOW, 2, XSIZE=509, YSIZE=509
TVSCL, warped_image
DEVICE, DECOMPOSED=old_decomposed

Syntax


Result = WARP_TRI( Xo, Yo, Xi, Yi, Image [, OUTPUT_SIZE=vector] [, /QUINTIC] [, /EXTRAPOLATE] [, /TPS] )

Return Value


Returns the warped image array.

Arguments


Xo, Yo

Vectors containing the locations of the control (tie) points in the output image.

Xi, Yi

Vectors containing the location of the control (tie) points in the input image. Xi and Yi must be the same length as Xo and Yo.

Image

The image to be warped. Can be any type of data.

Keywords


OUTPUT_SIZE

Set this keyword equal to a 2-element vector containing the size of the output image. If omitted, the output image is the same size as Image.

QUINTIC

Set this keyword to use smooth quintic interpolation. Quintic interpolation is slower, but the derivatives are continuous across triangles, giving a more pleasing result than the default linear interpolation.

EXTRAPOLATE

Set this keyword to extrapolate outside the convex hull of the tie points. Setting this keyword implies the use of QUINTIC interpolation.

TPS

Set this keyword to use Thin Plate Spline interpolation, which interpolates a set of irregularly sampled data value over a regular two dimensional grid. Thin plate splines are ideal for modeling functions with complex local distortions, such as warping functions, which are too complex to be fit with polynomials.

Version History


Pre-4.0

Introduced

See Also


INTERPOLATE, TRIANGULATE, TRIGRID