Matt J
Posts:
4,997
Registered:
11/28/09


Re: subpixel shifting of a matrix
Posted:
Feb 24, 2010 10:12 AM


"Shalin Mehta" <shalinDOTmehtaHATESSPAM@gmail.com> wrote in message <h8svoe$rkb$1@fred.mathworks.com>... > Just found a useful solution: Use interp2 with '*linear' option. Works factor of 2.5 faster than imtransform. Any other ideas? =================
Yes, interp2 will still be quite slow because of all the different functionality it has to support, for example, interpolation on nonuniform grids. It is much faster to express the interpolation as a separable convolution and use conv2().
Namely if your shift in x and y are 0<sx<1 and 0<sy<1 respectively, then you can do
Image=conv2(Image,[sx, 1sx],'same'); Result=conv2(Image,[sy, 1sy],'same');

