
Re: subpixel shifting of a matrix
Posted:
Oct 30, 2009 6:07 AM


Hi Shalin,
Was wondering what your input parameters were when using interp2. Thanks
Dumebi
"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? > > best > shalin > "Shalin Mehta" <shalinDOTmehtaHATESSPAM@gmail.com> wrote in message <h8ss9r$jhf$1@fred.mathworks.com>... > > Hello world, > > > > I have data defined over a grid, e.g. > > [xx yy]=meshgrid(1:0.1:1); %each pixel represents distance of 0.1 > > data=xx.^2+yy.^2 ; > > > > I need to translate this data by subpixel distances which will inevitably involve interpolation. I can live with linear interpolation as the data is sampled quite finely. I am using imtransform to achieve this. The shifteddata need to be obtained only over the original grid. I want extrapolated locations to be zero. > > > > xshift=0.235; yshift=0.95; %Since shift is finer than sampling, subpixel shifting is required. > > xdata=[1 wt]; > > ydata=[1 ht]; > > T=maketform('affine',[1 0 0; 0 1 0; xshift yshift 1]); > > shifteddata=imtransform(data,T,'bilinear','XData',xdata,'YData',ydata); > > > > Results are satisfactory but slow as this shifting happens in the innermost loop. > > Can anyone suggest a method that involves direct indexing and hence would be faster? Any neat algorithm published in the literature for subpixel translation? > > > > best > > Shalin

