help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: imrotate: Differences between Matlab and Octabe


From: Søren Hauberg
Subject: Re: imrotate: Differences between Matlab and Octabe
Date: Sat, 20 Mar 2010 14:27:56 -0700

Hi

Sorry about the late reply

man, 15 03 2010 kl. 09:17 -0500, skrev Journeaux, Ian:
> For our purposes, we were mainly interested in the nearest procedure
> as we want to minimize smoothing of the pixel values in the images.
> 
> We observed that the nearest versions of Matlab and Octave are not
> quite the same producing small differences in the results. About half
> (roughly) of Matlab pixels are 1 grey level above that of Octave, the
> rest being equal. This suggests a different way of rounding. The
> central pixel (100,100) where the major shift occurs there is a much
> larger difference - 8 grey levels. In all cases Matlab grey levels are
> exactly where they should be wrt the original image.
> 
>  
> 
> The results for “nearest” are probably good enough for us but since we
> had dug into it, and observed some differences, I  though we should
> share the results.

Thanks for sharing this stuff. 'imrotate' simply use the interpolation
function 'interp2', so your results made me look at this function.

The following example illustrates the difference

        X = meshgrid (1:4)
        interp2 (X, 2.5, 2.5, 'nearest')

In Matlab, this gives me '3', whereas Octave gives '2', which I guess is
the cause of the differences you observed.

I pushed the following changeset

  http://hg.savannah.gnu.org/hgweb/octave/rev/62bb59f927b1

which seems to fix this situation.

Søren




reply via email to

[Prev in Thread] Current Thread [Next in Thread]