From: Paul K. <pki...@us...> - 2005-02-16 04:57:57
|
On Feb 13, 2005, at 2:35 PM, Justus Piater wrote: > I've fixed the problems reported by Todd Neal, and added support for > rot90(). Note that for "crop" one has to do the cropping after the > rot90(). Moreover, if the image dimensions are not of equal parity > (odd width and even height, or vice versa), a +/- 90 degree rotation > entails interpolation. This implies that rot90() cannot be used for > such rotations. > > The new code is designed to behave smoothly across small increments of > rotation angle, rot90 or not. The result should be exactly the same, > whether or not rot90 is used. > > Please try out the code (Todd!) and tell me what you think. Once I > have Todd's approval, this code (imrotate.m and imrotate_Fourier.m) > should replace the existing version of imrotate in CVS. > > There are two test functions, testimrotate and testrot90. Look at > their code and play with them. The other files are needed by these > two. > I replaced the old version of imrotate with what you sent. I would appreciate a few simple test cases which do not rely on a human visual system to determine if the result is correct. I tried the following: X = rand(30); Y = imrotate(imrotate(X,30,'bicubic'),-30,'bicubic'); norm(X(17+[1:5],17+[1:5])-Y(30+[1:5],30+[1:5])) ans = 0.46103 Using a smoother function worked better: X = peaks(30); Y = imrotate(imrotate(X,30,'bicubic'),-30,'bicubic'); norm(X(17+[1:5],17+[1:5])-Y(30+[1:5],30+[1:5])) ans = 0.0036647 Anyone have any better suggestions? Thanks, - Paul |