From: Todd N. <to...@gm...> - 2005-02-10 19:20:05
|
On Thu, 10 Feb 2005 19:36:13 +0100, Justus Piater <Jus...@ul...> wrote: > Great to see that others too are interested in imrotate :-) > > Todd, thanks for reporting the half-pixel alignment problem revealed > by the modulo-90 rotations. I think that the cause is incorrect > round-off during computation of the center of rotation and/or the > projection of the corners. I hope to be able to look into this over > the weekend. > I think the problem has to do with the rounding of the corners as well. octave:15> imrotate(a,180) corners = 0.00000 0.00000 -3.00000 -1.00000 -3.00000 -3.00000 -1.00000 -3.00000 ans = 9 8 7 6 5 4 3 2 1 0 0 0 After rounding the corners: octave:16> imrotate(a,180) corners = 0 0 -3 -1 -3 -3 -1 -3 ans = 9 8 7 6 5 4 3 2 1 > In any case, a solution will have to be correct with respect to the > homography (which is sub-pixel accurate when used with > interpolation). In particular, the accelerated versions of the > modulo-90 rotations must produce exactly the same result as the > projection through the homography. > If the corners matrix is rounded then imrotate(a,90) == rot90(a) so the accelerated version is equivalent. On second thought round is probably not the proper way to handle the corners matrix, maybe something like "round to the nearest integer if it is within some value epsilon", this should fix the multiple of 90 degree rotations. > BTW, I submitted a new version of imrotate to octave-dev on February > 1st that adds bicubic interpolation and reintegrates Fourier > interpolation. > I thought it may have been fixed in this version but it wasn't committed to CVS and I was not on the list at the time, can I get this patch ? I am working on imresize and would be interested in seeing the bicubic interpolation code. I am trying to clone Matlab's bilinear interpolation from looking at the results of a resized matrix but I think that it is possible that Matlab is not doing an actual bilinear interpolation and only something extremely similar. Thanks, Todd |