comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL User's Library routine ROT
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDL User's Library routine ROT [message #429] Thu, 13 August 1992 07:29
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
In article <12AUG199218251536@stars.gsfc.nasa.gov>, fireman@stars.gsfc.nasa.gov
(Gwyn Fireman) writes...
> Hello, IDL users -
>
> I've been trying to figure out the IDL User's Library routine ROT, and
> am now pretty confused. It seems to me that a 90-degree rotation should have
> the same result for both ROT and the built-in function ROTATE, at least for
> square matrices, and that interpolation shuld have no effect. This is not the
> case. Even or odd array sizes make no difference. Am I missing something
> obvious? Is there a better routine for doing array rotations in non-multiples
> of 90 degrees?

(rest of message deleted)

The problem seems to be one of integer truncation. ROT uses "nearest neighbor"
interpolation. In other words, it tries to find the nearest pixel to where it
calculates the rotated pixel to be. When the rotation angle is 90 degrees,
that should give an exact solution. However, roundoff errors in the
calculation may calculate the nearest pixel as, say, 4.0001,5.9999 when it
should be 4,6. The 4.0001 is no problem since it be truncated correctly to 4.
The 5.9999, however, will be truncated incorrectly to 5. Thus, there will be
one pixel shifts in various parts of the image.

Maybe ROT could be rewritten to avoid these integer truncations. Another work
around is to use ROT_INT instead of ROT. Since this does bilinear
interpolation, it's not sensitive to this integer truncation problem. It also
gives a better looking rotated picture. There may be slight changes in the
values, particularly for integer arrays (a different truncation effect). There
are also some funny effects at the corners, which is unavoidable.

Bill Thompson
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL User's Library routine ROT
Next Topic: Re: IDL/PVWAVE History

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:42:07 PDT 2025

Total time taken to generate the page: 0.00553 seconds