Note: If 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.
; Create a byte image:
A = BYTSCL(DIST(256))
; Display it:
; 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:
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, X0 equals the number of columns in the image divided by 2.
Y subscript for the center of rotation. If omitted, Y0 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 ω0, and f is sampled with spacing less than or equal to 1/(2ω0), then f can be reconstructed by convolving with a sinc function: sinc(x) = sin(πx) / (πx).
In the one-dimensional case, four neighboring points are used, while in the two-dimensional case 16 points are used.
Note: Cubic 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 cause the image to pivot around the point (X0, Y0) so that this point maps into the same point in the output image. By default, the point (X0, Y0) in the input image is mapped into the center of the output image.
This page has no comments yet. Be the first one!