|
Image Processing : Transforming Image Geometry |
|
Transposing an image array interchanges array dimensions, reflecting an image about a diagonal (for example, reflecting a square image about a 45 degree line). By default, the TRANSPOSE function reverses the order of the dimensions. However, you can control how the dimensions are altered by specifying the optional vector, P, in the following statement:
Result = TRANSPOSE(Array[,P])
The values for P start at zero and correspond to the dimensions of the array. The following example transposes a photomicrograph of smooth muscle cells.
| Example Code See transposeimage.pro in the examples/doc/image subdirectory of the IDL installation directory for code that duplicates this example. |
READ_JPEG, FILEPATH('muscle.jpg', $
SUBDIRECTORY=['examples', 'data']), image
DEVICE, DECOMPOSED = 0, RETAIN = 2
LOADCT, 0
WINDOW, 0, XSIZE = 652, YSIZE = 444, TITLE = 'Original Image' TV, image
smallImg = CONGRID(image, 183, 111)
transposeImg1 = TRANSPOSE(smallImg) WINDOW, 1, XSIZE = 600, YSIZE = 183, TITLE = 'Transposed Images' TV, transposeImg1, 0
transposeImg2 = TRANSPOSE(smallImg, [1,0]) TV, transposeImg2, 2
transposeImg3 = TRANSPOSE(smallImg, [0,1]) TV, transposeImg3, 2
The following figure displays the original image (top) and the results of the various TRANSPOSE statements (bottom).
![]() |
IDL Online Help (March 06, 2007)