IDL Reference Guide: Procedures and Functions |

The ROT function rotates an image by an arbitrary amount. At the same time, it can magnify, demagnify, and/or translate an image.

NoteIf you want to rotate an array by a multiple of 90 degrees, you should use the ROTATE function for faster results. |

This routine is written in the IDL language. Its source code can be found in the file `rot.pro`

in the `lib`

subdirectory of the IDL distribution.

*Result* = ROT( *A*, *Angle*, [*Mag*, *X*_{0}, *Y*_{0}] [, /INTERP] [, CUBIC=*value*{-1 to 0}] [, MISSING=*value*] [, /PIVOT] )

Returns the rotated and optionally transformed image.

The image array to be rotated. This array can be of any type, but must have two dimensions. The output image has the same dimensions and data type of the input image.

Angle of rotation in degrees *clockwise*.

An optional magnification factor. A value of 1.0 results in no change. A value greater than one performs magnification. A value less than one but greater than zero performs demagnification.

X subscript for the center of rotation. If omitted, *X*_{0} equals the number of columns in the image divided by 2.

Y subscript for the center of rotation. If omitted, *Y*_{0} equals the number of rows in the image divided by 2.

Set this keyword to use bilinear interpolation. The default is to use nearest neighbor sampling.

Set this keyword to a value between -1 and 0 to use the cubic convolution interpolation method with the specified value as the interpolation parameter. Setting this keyword equal to a value greater than zero specifies a value of -1 for the interpolation parameter. Park and Schowengerdt (see reference below) suggest that a value of -0.5 significantly improves the reconstruction properties of this algorithm.

Cubic convolution is an interpolation method that closely approximates the theoretically optimum sinc interpolation function using cubic polynomials. According to sampling theory, details of which are beyond the scope of this document, if the original signal, *f*, is a band-limited signal, with no frequency component larger than w_{0}, and *f* is sampled with spacing less than or equal to 1/(2w_{0}), then *f* can be reconstructed by convolving with a sinc function: sinc(*x*) = sin(p*x*) / (p*x*).

In the one-dimensional case, four neighboring points are used, while in the two-dimensional case 16 points are used.

NoteCubic convolution interpolation is significantly slower than bilinear interpolation. |

For further details see:

Rifman, S.S. and McKinnon, D.M., "Evaluation of Digital Correction Techniques for ERTS Images; Final Report", Report 20634-6003-TU-00, TRW Systems, Redondo Beach, CA, July 1974.

S. Park and R. Schowengerdt, 1983 "Image Reconstruction by Parametric Cubic Convolution", Computer Vision, Graphics & Image Processing 23, 256.

Set this keyword to a value to be substituted for pixels in the output image that map outside the input image.

Set this keyword to cause the image to pivot around the point *(X*_{0}, *Y*_{0}*)* so that this point maps into the same point in the output image. By default, the point *(X*_{0}, *Y*_{0} *)* in the input image is mapped into the center of the output image.

; Create a byte image: A = BYTSCL(DIST(256)) ; Display it: TV, A ; Rotate the image 33 degrees, magnify it 15 times, and use ; bilinear interpolation to make the output look nice: B = ROT(A, 33, 1.5, /INTERP) ; Display the rotated image: TV, B

NoteAlso see Rotating Images for a more extensive example. |

IDL Online Help (March 06, 2007)